TFS 2015 running cucumber selenium in a build - ruby

I'm trying to run a set of cucumber selenium tests as part of a build in TFS2015, but it doesn't appear to be running them at all. I only get a timeout error. What I can conclude is that it is having difficulty starting up the browsers. I suspect that it is not running them properly from the script. Any idea how to fix?

We include Selenium tests in our feature test build by wrapping each Selenium test with MSTest and/or CodedUI attributes which works perfectly. You do have to make sure the build/test agent is configured to run in Interactive mode otherwise the test run won't have access to the desktop to automate the browser.
http://donovanbrown.com/post/2015/08/28/auto-start-build-agent-in-interactive-mode
We don't use Cucumber however so that may be the issue for you, not sure.

Related

Jenkins : Selenium GUI tests are not visible on Windows 7

When I run my selenium test (mvn test) from jenkins (windows) I see only the console output. I don't see the real browsers getting opened. How can I configure jenkins so that I can see the browsers running the test?
I think you're mis-understanding the reason you would use Jenkins, i believe it's designed to do exactly what it is doing, you need to install a different test-framework along with Maven and Selenium.
Jenkins is an open source DevOps tool which is basically use to automate repetitive tasks like code deployment on server.
SERVER being the main operating word here, you are trying to run your automation scripts from your desktop.
https://www.youtube.com/watch?v=peDWh9q_d0s
Above is a video tutorial of how to setup Maven and a very popular automation test framework, testNG.
Give me a shout if you need any more from me,
All the best,
Jack

Cucumber rerun failed tests not working in chrome

I am using cucumber and watir with Ruby for test automation and pretty much new to it.
I am trying to rerun failed tests for which I am using cucumber rerun formatter.
Tests are rerunning fine on Firefox, but on chrome not all failed tests are getting re-executed.
Is there any dependency of cucumber with chrome for rerun to happen?
My bad , this was design issue rather than browser specific issue. :/
After redesigning the rerun feature flow , the issue is resolved.
The reason this was happening was multi-threading issue since multiple docker containers are involved.
Thank you for looking into it.

Mocha tests in browser to output xunit reports

I'm running a set of tests with mocha and i need the tests to run in the browser, therefore ; i'm doing this :
mocha.setup('bdd')
the tests do run fine in the browser, but i need this to be executed in jenkins. I must run the tests in the browser and i'm trying to get the reporter to output xunit reports .
i've tried the xunit-file package and another one called "mocha-multi" , it looks like browser tests only support the html reporter. Is there a way to output both the xunit and browser reports? or at least to execute the tests in the browser and report xunit results?
so there is no way to have two reporters if you're running the tests in the browsers and not in node js. After digging into mocha,i realized that there is a tests results variable as part of the mocha objects that you can instantiate in the browser. You need to use this to actually access the resutls and write the report yourself.

UI automation seems to run in background without launching browser

I'm trying to setup Jenkins to execute our UI automation(Ranorex) tests. When the job runs, the IE browser does NOT launch, thus the tests don't run.
Is there some setting that I'm missing here?
The UI automation code is built into a .exe, which is called from a .bat file.
Thanks for any help.
Have you already read the blog Integrating Ranorex Automation in Jenkins CI Process on the Ranorex website?

Configuring Rational Functional Tester (RFT) to run in Hudson/Jenkins

I've just installed Hudson and it is running beautifully. It builds, runs JUnit-tests and also CheckStyle analysis.
Next step for us would be to create an installation, install it and then run automated tests on the actual installation. I would then like to fail the build if the tests fail or at least publish the results somehow. I think we would set it up so that part runs periodically or manually triggered.
We use InstallAnywhere for installation and IBM Rational Functional Tester for automated tests.
So questions are: anyone created a similar setup? are there any plugins, tutorials or other resource that could help me along. Or do you have any tips or advice in general.
The command line reference for Rational Functional Tester:
http://publib.boulder.ibm.com/infocenter/rfthelp/v8r0m0/index.jsp?topic=/com.ibm.rational.test.ft.doc/topics/RobotJCommandLine.html
Sample command for running a test:
java -classpath "C:\IBM\RFT\FunctionalTester\bin\rational_ft.jar"
com.rational.test.ft.rational_ft -datastore \\My_project\AUser\RobotJProjects -user admin -project
\\My_project\AUser\TestManagerProjects\Test.rsp -build "Build 1" -logfolder "Default" -log
"Al_SimpleClassicsA#1" -rt.log_format "TestManager" -rt.bring_up_logviewer true -playback
basetests.SimpleClassicsA_01
An additional note, you'll want to configure windows properly on your agent machine which will be running the tests. This is not advice specific to Hudson or RFT, but rather all GUI automation tools on Windows. RFT will require an interactive desktop environment for it to be able to click buttons, etc. If you have your Hudson agent running as a Windows service, there will be no desktop. See the following: Silverlight tests not working unless RDP connection open
We have run a fairly complicated distributed build on Hudson, it is a process that basically follows:
Test on Windows.
Test on OSX, run code coverage & push results to server.
Test on OSX Tiger.
Package for OSX Leopard & push build to server.
Package for Windows & push build to server.
Update product website.
We don't use InstallAnywhere or Rational Functional Tester, but have similar sorts of mechanisms in their place. The key we found to making it all sing in Hudson was being able run our various steps from the command line. Maven and appropriate plugins made short work of this task. So my advice would be just that, using whatever build tool you are using (ant, maven, ?) configure them so that you can run your rational functional tester and install anywhere from the command line with a simple goal passed to your build tool (i.e. mvn test or mvn assembly:assembly).
After that, make sure whatever machine Hudson is running on has everything installed (i.e. Rational Functional Tester) and configured, so that you can open up the command line and type in the goal and have your tests correctly execute.
Hooking it up in Hudson from that point on is fairly simple - just pass in the goal when you configure the build.
I believe the best answer is that integrating RFT with Hudson/Jenkins is a useless endeavor.
As this IBM FAQ says, to make RFT work you must:
be logged in the machine;
the screen can't be locked;
if you are remotely connected, you can't minimize the connection screen.
So you can't run Jenkins/Hudson as a service, making it not very useful. You must run it from your logged account. If you are in a corporate computer (very probable if you are using RFT), you probably must use a hack to prevent the screen saver to start. If the screen is locked, your tests will always fails.
It isn't very difficult to configure your tests to run from the command line, you just have to take care of the return codes when the tests fail and succeed.
Jenkins/Hudson would also give you some advantages, like integrating the tests with your version control, probably automatically running the tests when a commit is made. It would also help sending emails when the tests fail.
But you still would have to integrate the RFT logs with some kind of JUnit plugin to have a nice report. You also would have to have script to run the tests using the command line.
I think it is not worth the trouble to use an continuous integration server with RFT. Better just have your tests running every day in Windows Task Scheduler. It is a simpler solution with less failure points.
Or use my final solution: quit RFT and use the free Selenium with a headless web driver.
I have some general advice on this because I have not yet implemented this myself.
I am assuming you want to have Hudson run the RFT scripts automatically for you via a build or Hudson process?
I want to implement something similar in my organisation as well.
I have not yet been able to implement this because of organisational constraints but here is what I have thought out/done so far:
Downloaded Windows process viewer, got the command for running the tests.
Made shell Script out of it, separated out the variables etc
The future plan is to setup a Windows Slave machine which would have all the tools in it that would be required once the Tests are kicked off, for eg. the correct versions of browsers, and environment variables, and other tools that are required.
Hudson would kick off a process which runs the shell scripts created which runs all the RFT Scripts and performs necessary operations on the slave machine.

Resources