selenium - TestNG code will compile in Eclipse but not in Jenkins -



selenium - TestNG code will compile in Eclipse but not in Jenkins -

i building framework testing webpages using java, selenium, , testng. in build.xml referencing testing version 6.8.8. in eclipse have updated version. part of tests using retryanalyzer re-run failed tests once. cleaning testng study using ttestlistener remove failed tests (removing failed test result) passed on re-run (all code below).

my problem this. when compiling , running code in eclipse works fine; however, when commit , effort run through jenkins encounter exception stating have incompatible types between itestngmethod , itestresult. prior testng 6.8.6 removeresult() method allowed itestngmethods, according documentation includes ability remove itestresult (this evidenced in fact works when running through eclipse [http://grepcode.com/file/repo1.maven.org/maven2/org.testng/testng/6.8.8/org/testng/internal/resultmap.java#resultmap.removeresult%28org.testng.itestresult%29]). it's if jenkins using difference compiler or somehow not looking @ right version of testng.

i looking help in how resolve having jenkins compile code same way instance of eclipse does.

any direction great!

thanks.

rough code removing wrongly failed tests. since re-running test 1 time if , if failed on it's first fun, can assume if test in failed , passed list passed on it's subsequent effort , can hence removed failed set.

set<itestresult> failedset = context.getfailedtests().getresults(testmethod); set<itestresult> passedset = context.getpassedtests().getresults(testmethod); for(itestresult passedtest : passedset) { for(itestresult failedtest : failedset) { //parameter[0] unique testid if(failedtest.getparameters()[0].equals(passedtest.getparameters()[0])) { context.getfailedtests().removeresult(failedtest); } } }

the above works wonderfully in eclipse, won't compile in jenkins. exceptions stating:

error: incompatible types: itestresult cannot converted itestngmethod [javac] context.getfailedtests().removeresult(failedtest);

here build.xml file looks like:

<?xml version="1.0" encoding="utf-8" standalone="no"?> <!-- warning: eclipse auto-generated file. modifications overwritten. include user specific buildfile here, create 1 in same directory processing instruction <?eclipse.ant.import?> first entry , export buildfile again. --><project basedir="." default="build" name="automation"> <property environment="env"/> <property name="debuglevel" value="source,lines,vars"/> <property name="target" value="1.7"/> <property name="source" value="1.7"/> <path id="testng.libraryclasspath"> <pathelement location="../../../../../../eclipse/plugins/org.testng.eclipse_6.8.6.20130517_2218/lib/testng.jar"/> </path> <path id="automation.classpath"> <pathelement location="bin"/> <path refid="testng.libraryclasspath"/> <pathelement location="../../../../../../selenium/lib/jtds-1.3.0.jar"/> <pathelement location="../../../../../../selenium/lib/sqljdbc4-2.0.jar"/> <pathelement location="../../../../../../selenium/lib/selenium-server-standalone-2.42.2.jar"/> <pathelement location="../../../../../../selenium/lib/testng-6.8.8.jar"/> <pathelement location="../../../../../../selenium/lib/reportng-1.1.4.jar"/> <pathelement location="../../../../../../selenium/lib/velocity-dep-1.4.jar"/> <pathelement location="../../../../../../selenium/lib/guice-3.0.jar"/> <pathelement location="../../../../../../selenium/lib/saxon-8.7.jar"/> </path> <target name="init"> <mkdir dir="bin"/> <copy includeemptydirs="false" todir="bin"> <fileset dir="src"> <exclude name="**/*.java"/> </fileset> </copy> </target> <target name="clean"> <delete dir="bin"/> </target> <target depends="clean" name="cleanall"/> <target depends="build-subprojects,build-project" name="build"/> <target name="build-subprojects"/> <target depends="init" name="build-project"> <echo message="${ant.project.name}: ${ant.file}"/> <javac debug="true" debuglevel="${debuglevel}" destdir="bin" includeantruntime="false" source="${source}" target="${target}"> <src path="src"/> <classpath refid="automation.classpath"/> </javac> </target> <target description="build projects reference project. useful propagate changes." name="build-refprojects"/> <target description="copy eclipse compiler jars ant lib directory" name="init-eclipse-compiler"> <copy todir="${ant.library.dir}"> <fileset dir="${eclipse_home}/plugins" includes="org.eclipse.jdt.core_*.jar"/> </copy> <unzip dest="${ant.library.dir}"> <patternset includes="jdtcompileradapter.jar"/> <fileset dir="${eclipse_home}/plugins" includes="org.eclipse.jdt.core_*.jar"/> </unzip> </target> <target description="compile project eclipse compiler" name="build-eclipse-compiler"> <property name="build.compiler" value="org.eclipse.jdt.core.jdtcompileradapter"/> <antcall target="build"/> </target> <taskdef name="testng" classname="org.testng.testnganttask" classpathref="automation.classpath" /> <taskdef resource="testngtasks"> <classpath> <pathelement location="../../../../../selenium/lib/testng-6.8.8.jar"/> </classpath> </taskdef> <!-- = = = = = = = = = = = = = = = = = macrodef: runtestng = = = = = = = = = = = = = = = = = --> <macrodef name="runtestng"> <attribute name="xmlfile" default="testng.xml" /> <sequential> <testng classpathref="automation.classpath" outputdir="test-output" haltonfailure="no" usedefaultlisteners="true" listeners="org.uncommons.reportng.htmlreporter,org.uncommons.reportng.junitxmlreporter"> <sysproperty key="org.uncommons.reportng.title" value="fox test automation report"/> <sysproperty key="org.uncommons.reportng.escape-output" value="false"/> <xmlfileset dir="." includes="@{xmlfile}"/> </testng> <echo> /* testng study generated */ </echo> </sequential> </macrodef> <macrodef name="runxslt"> <sequential> <delete dir="${basedir}/testng-xslt"/> <mkdir dir="${basedir}/testng-xslt"/> <xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/testng-results.xsl" out="${basedir}/testng-xslt/index.html"> <classpath location="../../../../../../selenium/lib/saxon-8.7.jar" /> <param expression="${basedir}/testng-xslt/" name="testngxslt.outputdir"/> <param expression="true" name="testngxslt.sorttestcaselinks"/> <param expression="fail,skip,pass,conf,by_class" name="testngxslt.testdetailsfilter"/> <param expression="true" name="testngxslt.showruntimetotals"/> <classpath refid="automation.classpath"/> </xslt> <echo> /* xslt study generated */ </echo> </sequential> </macrodef> <target name="firstfile"> <echo message="running hoverbar/client/job/lead tests" /> <runtestng xmlfile="testng.xml" /> </target> <target name="test" depends="firstfile"> <runxslt /> </target> <target name="secondfile"> <echo message="running hoverbar/client/job/lead tests" /> <runtestng xmlfile="testng1.xml" /> </target> <target name="test1" depends="secondfile"> <runxslt /> </target> <!--target name="test1"> <echo message="running sec test"/> <testng classpathref="automation.classpath" outputdir="testng_output"> <xmlfileset dir="." includes="testng1.xml"/> </testng> </target --> <target name="thirdfile"> <echo message="running hoverbar/client/job/lead tests" /> <runtestng xmlfile="testng2.xml" /> </target> <target name="provider2" depends="thirdfile"> <runxslt /> </target> <target name="testngall"> <echo message="running automated tests" /> <runtestng xmlfile="testngall.xml" /> </target> <target name="alltests" depends="testngall"> <runxslt /> </target> <!-- running tests , testng study generation --> <!--target name="run"> <testng classpathref="automation.classpath" outputdir="test-output" haltonfailure="no" usedefaultlisteners="true" listeners="org.uncommons.reportng.htmlreporter,org.uncommons.reportng.junitxmlreporter"> <sysproperty key="org.uncommons.reportng.title" value="fox test automation report"/> <sysproperty key="org.uncommons.reportng.escape-output" value="false"/> <xmlfileset dir="." includes="testngall.xml"/> </testng> <echo> /* testng study generated */ </echo> </target> <target name="xslt" depends="run"> <delete dir="${basedir}/testng-xslt"/> <mkdir dir="${basedir}/testng-xslt"/> <xslt in="${basedir}/test-output/testng-results.xml" style="${basedir}/testng-results.xsl" out="${basedir}/testng-xslt/index.html"> <classpath location="../../../../../../selenium/lib/saxon-8.7.jar" /> <param expression="${basedir}/testng-xslt/" name="testngxslt.outputdir"/> <param expression="true" name="testngxslt.sorttestcaselinks"/> <param expression="fail,skip,pass,conf,by_class" name="testngxslt.testdetailsfilter"/> <param expression="true" name="testngxslt.showruntimetotals"/> <classpath refid="automation.classpath"/> </xslt> <echo> /* xslt study generated */ </echo> </target -->

a little more info: jenkins running on server (and has no connection ecliplse).

here definition of method trying use: org.testng.iresultmap.removeresult(itestresult r)

selenium jenkins testng

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -