Selenium Integration with Jenkins

Posted by Mufi on 7:41 AM with No comments
Operate PushToTest TestMaker tests from Continuous Integration environments. PushToTest checks TestMaker compatibility with Hudson and Bamboo. 
1. Product Version Details
TestMaker Version : 5.5 RC3
Bamboo Version : 
2.6.2 (Standalone)
Hudson Version : 
1.374
Java Verison : 
1.6 (1.6.18 or later)
Tomcat Verison : 
6.0.26 (To run Hudson)
2. Setup Build to run tests in Hudson (Windows - localhost)
  • Setup a build in Hudson
  • Pre-requisite to execute the build
  • Execute the build in Hudson
  • Configure the build/test output to detect failures in Junit output
Setup a build in Hudson:
Hudson comes with a web archive file (hudson.war). You need a web server (tomcat/jboss/jetty) to run Hudson.
Tomcat Console (runs in 8090 http port)
Tomcat Console

Hudson Home

Create New Job link to create a new Job

Create New Job link

Click OK to proceed

OK to proceed

You can select Source Code Management option to checkout the code from (CVS/Subversion). All the source/tests will checkout in the build workspace directory.

Select Execute Windows build Command from the Build

Execute

Type the following command

%TESTMAKER_HOME%\TestMaker.cmd -t example_agents\AjaxRIASeleniumTest_Tutorial\Calendar_Functional_Test.scenario -log-junit testreport\junitreport.xml

Note: The scenario file path (example_agents\AjaxRIASeleniumTest_Tutorial\Calendar_Functional_Test.scenario) and reports path (testreport\junitreport.xml
) is relative to your build workspace.

Calendar function


Click Save.

Pre-requisite to execute the build:

Create Environment variables:

Create the below two environment variables in Hudson Console (Hudson -> Manage Hudson -> Configure Your System -> Global Properties) as shown below:

JAVA_HOME
TESTMAKER_HOME
TestMaker Home

TestMaker

TestMaker

Or you can create these two system environment variables (My computer -> Advanced -> Environment Variables)
Environment Variables
Environment Variable

Start TestNode:

If required, start the Testmaker testnode. The current example is using the local testnode which runs in 8080 http port.

Testnode console
Testnode console


Execute the build in Hudson:

Hudson

Click on Build Now link available in the left side to start the build
Build Now

Due to some reason, the first build failed, so I ran the build for the second time.

You can watch the logs by clicking the build link build link

logs

Click on the Console output


Console Output

In the meantime, you can watch the testnode logs:

testnode logs



Configure the build/test output to detect failures in Junit output:

Check the Publish JUnit test result report option from the Post-build Actions

Post-build actions

Note: You may not have the report file for the first time build. So, do not select this option until unless you have the report file (junitreport.xml) available in the specified directory.

Click on the Test Result
Test Results

Test Results

3. Setup Build to run tests in Hudson (Linux - localhost)
  • Setup a build in Hudson
  • Pre-requisite to execute the build
  • Execute the build in Hudson
  • Configure the build/test output to detect failures in Junit output
Setup a build in Hudson:

Same as windows - Please refer windows section

build

You can select Source Code Management option to checkout the code from (CVS/Subversion). All the source/tests will checkout in the build workspace directory.

Select Execute Shell from the Build

Execute Shell

Type the following command

$TESTMAKER_HOME/TestMaker.sh -t example_agents/AjaxRIASeleniumTest_Tutorial/Calendar_Functional_Test.scenario -log-junit testreport/junitreport.xml

Note: The scenario file path (example_agents/AjaxRIASeleniumTest_Tutorial/Calendar_Functional_Test.scenario) and reports path (testreport/junitreport.xml
) is relative to your build workspace.

Make sure the / , $, TestMaker.sh

TestMaker


Click Save.

Pre-requisite to execute the build:

Create Environment variables:

--Same as Windows

But only the Path is going to change. It has to be valid unix path.


unix path

Start the TestNode:

--Same as Windows


Execute the build in Hudson:

--Same as Windows

Configure the build/test output to detect failures in Junit output:

--Same as Windows