Running automated Web browser tests under Hudson - selenium

I'm running Hudson for my automated builds and love it.
I'd now like to create automated Web browser tests using either WaTiN (preferred) or Selenium.
As my Hudson runs as a Windows service (under Tomcat), how can I configure this to run? Will I be forced to log in as a user on the Hudson box so my automated browser tests will find a browser? Or is there some other sorcery with an interactive session that I can conjure up?
If possible I'd like the Hudson box itself to run the tests.

After some research I've found that WaTin won't work so well as I'd need to configure Hudson to run in an interactive Java session.
Selenium Grid, however, is perfect - there's a Hudson plug-in that can control it, too.
So that's what we'll use.

I'd now like to create automated Web
browser tests ... my Hudson runs as a
Windows service ... Will I be forced
to log in as a user on the Hudson box
so my automated browser tests will
find a browser? Or is there some other
sorcery with an interactive session
that I can conjure up? If possible I'd
like the Hudson box itself to run the
tests.
A Windows service can indeed run a browser, even when logged in as the LocalSystem account. We have that exact setup, with Hudson installed as a Windows service, although deploying it to Tomcat and running that as a service should work equally well. We use Sahi for our automated testing, which runs our test suite in both IE and Firefox.
You didn't say what problem you had with Watin, but in case it's relevant, Sahi needs to set the browser's HTTP proxy to a special host and port. This works no problems with Firefox because Sahi configures its proxy via a profile specified on the Firefox command line. IE is a little tricker, because its proxy settings are in the Windows registry, and when running as the LocalSystem account, these come from a special place in the registry (not HKCU as for a logged-in user). See this SF answer for the details. If that was the problem you were having, you may yet be able to achieve your goal of running everything on the Hudson box.

Have you checked here? This shows the Selenium Grid plug-in to Hudson.

Related

Create a test web application replay to test and also to warm up a server

I would like to record a step through of a web application, and then replay this for testing. However it would be brilliant if this could be replayed say on a VM every so often to emulate a user to warm up a server.
JMeter, Katalon and Selenium have come up.
EDIT:
I have been playing with Katalon Studio and I'm very impressed with it in recording tests and replaying in a browser. This seems more about functional testing, ie do all the pages work. JMeter is about Load Testing. So different tools. However being able to export JMeter (JMX) files from Katalon would be fab, but I haven't heard it is possible.
JMeter can/is used also for functional testing and have selenium integration
Can JMeter and Selenium collaborate?
Yes. There are various situations where both tools can sync on the same testing application.
You can follow JMeter's recording steps to compare with katalon recording
You can do that with Katalon Studio.
Here's what I do to warm-up the servers:
I wrote a simple script (login with username and password, wait for web elements to load, logout),
It is repeated on various servers,
I put this Test Case in a Test Suite (because I can run test suites from command line),
Generate a console command,
Use windows scheduler to run the test suite daily early in the morning, before users start working.

Bamboo not running NUnit webdriver tests

We have a CI setup using bamboo where one job was to run our automation, it checks out our Automation Solution from a repository, and run it using NUnit runner where it contains tests using selenium webdriver and some unit tests. It runs unit tests(not using webdriver commands) just fine, but not the webdriver tests.
We are sure that the solution is being checkout correctly because we can run the test using the command line referencing the created local repository, including tests that uses webdriver using the command below:
C:\pathToNUnitConsole\nunit-console C:\pathToCreatedLocalRepositoryInTheServer\NUnitTest.dll -include=FirefoxBrowserTest
We can see that the bamboo job never launched a browser, and we are getting test failure for not seeing browser elements. Also, we are getting error as we see in the logs:
10-Apr-2015 13:19:49 http://10.215.12.28:15871/cgi-bin/blockpage.cgi?ws-session=587410860
10-Apr-2015 13:20:42 JavaScript error: resource://gre/modules/CertUtils.jsm, line 168: NS_ERROR_ABORT: Certificate issuer is not built-in.
I don't know if this is your problem, but it sounds very similar to an issue I had trying to get NUnit runner to run tests built in SpecsFor.MVC, which is a wrapper that deals with instantiating an IIS Express instance, deploying a target web application to known location, then using Selenium/Chrome Driver to run the tests against the web app.
The problem I had was trying to run the Bamboo remote agent as a windows service. The Local Service account was not able to access the interactive desktop. Also, changing the service to run as a specific user account still failed, as the service was not allowed access to the user's isolated Session0.
I could login as that test user and run the test from the command line no trouble, but I couldn't get it to run when initiated by the remote agent windows service.
I eventually fixed it by using AlwaysUp (not a plug. I'm sure other similar solutions are available). This allowed me to set the machine running the tests to always log in as the test user on startup, would automatically restart the bamboo remote agent if it was closed for some reason and most importantly, to give the service access to the user's isolated session0.
Hope that might give you a few clues...

Run protractor test remotely

I'm a QA Engineer where I work and I want to enable all the other
team members to run the tests without me- i.e - even when I'm not here- they can for example get to some url, enter the url of the environment they want to test and play the tests, without installing anything on their computers.
what would be the best practice?
thanks.
Sounds like Jenkins will do what you want.
In that situation I would:
Install Jenkins on a dedicated machine (onsite or in the cloud), or try out a commercial Jenkins cloud provider
Configure a Jenkins job that executes your tests (you can configure the tests to run on the same machine where Jenkins is installed, or if you would rather have Jenkins run the tests on a second machine, that's possible too)
Show your team members how to access Jenkins and launch the test job (or, you can also configure your test job to run automatically at a certain time of day, or even better, when changes are made in your version control system)

Selenium with hudson:firefox browser is not getting lanuched while selenium scripts are running through hudson

i integrated my selenium scripts (using junit) with Hudson. i invoked my job through ant . My problem was my scripts are running successfully but the fire fox browser is not getting opened. At this moment i am not using selenium grid .please provide any suggestion
Check whether you run Hudson as a service using your own account. If you want to see Firefox browser you must select Local System Account as a service runner (Log on option in service properties) Then there is a possibility to check interact with desktop checkbox and it makes browser "visible" while running your tests.

Store selenium tests on a server but run them on local browsers, through a framework like fitnesse

I've been working on a webdriver framework for a while now, I guess it is
keyword driven now. We would like for there to be a central place for users to
store tests, preferably on a wiki, but then when they are run they would open up
the browser on users local machine.
I originally started working using Fitnesse, which works great for storing the
tests however when we hosted it on a server when a user tries to run a test it
opens the browser on the server which the user can't view. Does anyone know a
way that I could force Fitnesse to open the users local browser or display the
browser to the user? Or do you know another framework/way to store tests in a
central place but run them in local.
I've been looking at sending through the local users ip through a fixture to start up the initial framework, I was hoping that fitnesse would already know the ip.
Thanks,
James
You can either find a framework that does what you want, or the bare minimum would be to create a thin wrapper that copies the test dll's and executeable to a machine and executes psexec to execute the tests on the remote machine. You could probably write the entire thing in maybe 20 lines of code.