Jenkins Job Setup - Test Script Execution using Selenium Web Driver and Testng pluin in Eclipse IDE

105 views
Skip to first unread message

Raghavendra Pise

unread,
Apr 3, 2015, 2:11:44 AM4/3/15
to jenkins...@googlegroups.com

Dear All,

 

We are using Eclipse IDE and Selenium Web driver for test automation project and we have test cases written in Java.

 

The test execution is happening through 'Testng Plugin' in Eclipse IDE and we have installed it.

 

We can able to run testng xml from Eclipse IDE and it will trigger 'testng xml' file and its working fine.

 

I would like to know whether we can able to trigger this xml through Windows Batch command in Jenkins Job.

 

Please share your opinion and kindly let me know if you need more clarification

 

Thanks,
Raghav


Ginga, Dick

unread,
Apr 3, 2015, 8:19:48 AM4/3/15
to jenkins...@googlegroups.com

The only way I know how to do this is to have Eclipse create an ANT build.xml file. Look under File->Export. Then I use these commands. The first one builds the tests the second runs them.

 

call "C:\apache-ant-1.9.4\bin\ant.bat" -file build.xml build

call "C:\apache-ant-1.9.4\bin\ant.bat" -file build.xml Suite1Runner

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/033dfbc6-9af3-4da9-b164-c44d7d268758%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raghavendra Pise

unread,
Apr 5, 2015, 1:33:05 AM4/5/15
to jenkins...@googlegroups.com
Thank you very much for your information.

I have started writing a build.xml and I found some hint how to write build.xml from following post.


I have tweaked my code as per the requirement but I encountered few errors in Jenkins.

Please find below code snippet.

<project name="projectname" basedir="." default="runTest">
 
 <property name="src.dir" location="${basedir}/src/XcellentCare_Scripts" />
 <property name="lib.dir" location="${basedir}/lib" />
 <property name="exec.dir" location="${basedir}/exec" />
 <property name="exec.bin.dir" location="${exec.dir}/bin" />
 <property name="functional.base.dir" location="${basedir}/../../" />
 <property name="reports.dir" location="${exec.dir}/reports" />
 <property name="failure.dir" location="${exec.dir}/reports/xml" />

 <path id="ft.classpath">
 <fileset dir="${lib.dir}">
 <include name="*.jar" />
 </fileset>
 <pathelement location="${exec.dir}" />
 </path>
 <taskdef resource="testngtasks" classpath="${lib.dir}/testng.jar" />
 <target name="clean">
 <delete dir="${exec.dir}" />

 </target>
 <target name="prepare">
 <mkdir dir="${exec.dir}" />
 <mkdir dir="${reports.dir}/output" />
 <copy todir="${exec.bin.dir}">
 <fileset dir="${src.dir}" />
 </copy>
 </target>

 <target name="compile" depends="clean, prepare">
 <javac classpathref="ft.classpath" srcdir="${src.dir}" destdir="${exec.dir}" />
 </target>

 <target name="runTest" depends="compile">
 <testng classpathref="ft.classpath" outputdir="${reports.dir}/Test 1" suitename="suite1">
 <xmlfileset dir="${basedir}" includes="testng.xml"/>
 </testng>
 </target>
 
 </project>

And I am getting following error,

 [javac] E:\Philips\XC_RM_KT\Workspace\XcellentCare\build.xml:39: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds
    [javac] Compiling 9 source files to E:\Philips\XC_RM_KT\Workspace\XcellentCare\exec
    [javac] E:\Philips\XC_RM_KT\Workspace\XcellentCare\src\XcellentCare_Scripts\SprintI.java:13: error: package XcellentCare_Library does not exist
    [javac] import XcellentCare_Library.Generic;
    [javac]                            ^
    [javac] E:\Philips\XC_RM_KT\Workspace\XcellentCare\src\XcellentCare_Scripts\SprintI.java:14: error: package XcellentCare_Library does not exist
    [javac] import XcellentCare_Library.SuperTestNG;
    [javac


Any how to add source code from XcellentCare_Library in build.xml target file.

Here I have code in below location.

E:\Philips\XC_RM_KT\Workspace\XcellentCare\src\XcellentCare_Scripts
E:\Philips\XC_RM_KT\Workspace\XcellentCare\src\XcellentCare_Pages
E:\Philips\XC_RM_KT\Workspace\XcellentCare\src\XcellentCare_Library

Thanks,
Raghu Pise

Ginga, Dick

unread,
Apr 7, 2015, 8:30:29 AM4/7/15
to jenkins...@googlegroups.com

I can’t help with any of these issues as I don’t know how the build.xml works. Just how to use it when eclipse creates it.

Reply all
Reply to author
Forward
0 new messages