Webdriver-Jenkins, browser remains in background - browser

I have a project where I am trying to execute webdriver testcases (keyword driven) from jenkins.
I am using Ant to build and execute the project. My code works fine from eclipse and command-line.
I am trying to use jenkins to run automation test eveynight. ( I have to use jenkins, can not use windows scheduler due to some dependencies.)
I can check out my code from SVN, compile it using ant and run it. But, while running, jenkins opens firefox and keeps it in background. It appears that tests are executing fine (in backgournd) but can not see firefox UI in foreground.
Any one had this problem before? or any solutions ?
I really appreciate your help.

that a feature of jenkins called as the Execution of test cases in Headless browser mode

Related

Python automation project to run in the background

i just started working with python and with some scripts to automate some tasks. I manage to create a web scraper using selenium that notifies me daily with the latest news via a mail . Now the script works great if i run it manually , but my question is : How can i make the script to run automatically every day , and what option would you recomand . I know that you can use TaskScheduler and program it , but i was wondering if you know any options to run it directly in the cloud ? Also , i found some tutorials where they say to wrap all the code in an infinite loop and add a timer , and once you run the script it will stay active as a background process,
I just started working with scripts and automation , so i would really like to know your opinion on the best way to run the script automatically . Thanks a lot
If this is on a unix-based OS, check out cron (this is a pretty good guide). You can schedule it to run your python script daily.
Im not sure if that is what you are looking for, but (if you are on windows) you could attach your program to your autostart. Probably your Startup Folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
If you schedule in your computer, i think it may not be proper solution. It's better to deploy it on any cloud platforms & schedule at any particular time.
I personally suggest Heroku, I'm using it for running multiple scripts for free. You can use scheduler addon for scheduling scripts to run at particular time as well. Please refer to heroku documentation & get started! Note: The script may run more time than you expected, please refer here to fix this.

running sahi inside cruisecontrol

How to run sahi inside cruisecontrol? I'm a bit confused here, because some of the steps needed to do on running sahi is choosing the browser I would like to use for the test and pressing alt+double click... Is there any clue for me? Example on ccnet.config would be very helpful.
From a quick study, I can see that Cruise Control supports ANT. You can invoke sahi scripts using ANT targets. You need not open a browser and press alt+double click, Sahi can run scripts from command line using test runner also. For a detailed not on this, please look at: http://sahi.co.in/w/Running+multiple+tests+in+batch+mode.
I have not seen ccnet.config, but if you can invoke ANT targets, then this integration with jenkins will give you important pointers: http://sahi.co.in/w/integrate-with-jenkins
Thanks,
Vivek

Browsers not visible when running Selenium2/Webdriver tests with Hudson

I am using Hudson CI to run an ant script which compiles and executes Selenium2/Webdriver tests (written as TestNG tests). These tests are set to run in a Firefox browser, not with headless HTMLUnit. During the Hudson build, I don't see any errors in the console output or the TestNG report, and my custom report seems to indicate that my tests do run normally, but I noticed that no actual Firefox browser is ever launched during the build.
In contrast, whenever I run my Selenium2/WebDriver tests via Eclipse or the command line either as a TestNG test or an Ant build, the tests always launch a browser on which I can see the tests being run. I just can't figure out why the browser does not appear. All of the aforementioned details suggest that the tests are in fact run properly, but the Hudson server is run on my local machine and no additional resources are apparently used to run the tests in their own Firefox instance.
I am not using Selenium Grid at the moment. Also, regardless if I run the tests sequentially or in parallel across multiple threads through Hudson, I am still not able to see any active browsers. I do vaguely remember at one point seeing Hudson launch an actual browser yesterday when I began this work, but I have yet to see once since. This makes me wonder if I possibly configured something incorrectly in my Hudson job.
Any help is greatly appreciated!
Login to test node
Open the window services and locate Jenkins Slave services
Right click and select properties
Go to “Log On” tab
Make sure option “Local System Account” is selected and tick the option “Allow service to interact with desktop”
Click OK to save the setting
Restart the services.

Coded UI Tests automation

I want to automate the process of running coded UI tests.
Do i need to have user logged in to the system?
Or is it possible to run it using XYNT service?
We are able to run our coded ui tests in an automated fashion using windows scheduler and the command line MSTest.exe. Take a look at the following MSDN article on how to accomplish this:
http://msdn.microsoft.com/en-us/library/ms182486.aspx
I believe you can use Microsoft's Test Manager to accomplish this as well but we don't have TFS (yet) so I can't vouch for it.
As far as I know, CodedUI Tests require an active desktop session, so running them under a service account without an open desktop session may work, but not without a session.
I used the mstest to run the coded ui test and use Windows TaskScheduler to schedule the test.
You can find detail in MSTest.exe command-line documentation.
When you want to run it automatically, there are two things you should pay attention:
1. Set auto log on
2. Close the screen saver
You need to take the snapshot of your enviroment with user logged in and then you can run your test through MS Test Manager or TFS (nightly build process)
Write the test's in Visual Studio 2010/2012, this means you can manually edit the test's the code, then you should run them in Test Manager,
BTW you need TFS and Test Manager to be the same year otherwise it won't work.
I've being doing a lot of these recently if you have any questions post it online and send me a message, I'll be happy to help.

How can I control in which of my desktops the browser called by selenium remote server will pop up?

I am running tests from phpunit using selenium. Since the tests take a couple of minutes proceed, I would like to switch to another desktop and do some tasks while the tests are running in the background.
However, since every test calls a new browser via selenium remote server, and a new test management window and a application window are started, these new windows do not appear in the desktop which I started the php tests from, but in my current desktop taking the focus away from the window I am working in.
How can I control that the browsers are always opens in the desktop that is in the background (where I start phpunit)? I am using Kubuntu i.e. the KDE Desktop.
Thanks for any suggestions!
This is probably a bit late, but for anyone reading this: When you launch your selenium RC server, you could try exporting to a specific display using the command:
export DISPLAY="somedisplay" && java -jar /path/to/selenium-server.jar
Using this, you could also export it to for instance an X virtual frame buffer (Xvfb), effectively running it in the background.

Resources