持续集成-Jenkins不调用WedDriver测试

持续集成-Jenkins不调用WedDriver测试,jenkins,selenium-webdriver,continuous-integration,Jenkins,Selenium Webdriver,Continuous Integration,我试图使用jenkins来运行SeleniumWebDriver测试持续集成,但到目前为止我还没有成功。我的设置: -蚀 -testng -ant build.xml文件 -詹金斯 -一切都在本地托管 我在并行的1个测试,3个浏览器中运行我的测试,如果我运行testng文件,如果我运行ant文件build.xml,它会说“build successful”,但是如果在jenkins中运行相同的文件,它会说同样的事情“build successful”,但同样不会发生任何事情。由此我可以推断jen

我试图使用jenkins来运行SeleniumWebDriver测试持续集成,但到目前为止我还没有成功。我的设置: -蚀 -testng -ant build.xml文件 -詹金斯 -一切都在本地托管 我在并行的1个测试,3个浏览器中运行我的测试,如果我运行testng文件,如果我运行ant文件build.xml,它会说“build successful”,但是如果在jenkins中运行相同的文件,它会说同样的事情“build successful”,但同样不会发生任何事情。由此我可以推断jenkins正在运行正确的文件,但它只是没有执行测试。我甚至尝试过使用maven,但我不理解它,所以当我采用这种方法时,代码甚至无法编译。 有没有人能帮我指出正确的方向,因为我相信我错过了什么。我已经附上了我的jenkins套装的照片,下面是我的ant文件的副本:

![<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- WARNING: Eclipse auto-generated file.
              Any modifications will be overwritten.
              To include a user specific buildfile here, simply create one in the same
              directory with the processing instruction <?eclipse.ant.import?>
              as the first entry and export the buildfile again. --><project basedir="." default="build" name="jenkins_run_selenium">
    <property environment="env"/>
    <property name="ECLIPSE_HOME" value="../../../Program Files (x86)/eclipse-standard-kepler-R-win32-x86_64/Eclipse"/>
    <property name="junit.output.dir" value="junit"/>
    <property name="debuglevel" value="source,lines,vars"/>
    <property name="target" value="1.7"/>
    <property name="source" value="1.7"/>
    <path id="jenkins_run_selenium.classpath">
        <pathelement location="bin"/>
        <pathelement location="../../../Program Files (x86)/Eclipse/selenium-2.40.0/selenium-java-2.40.0-srcs.jar"/>
        <pathelement location="../../../Program Files (x86)/Eclipse/selenium-2.40.0/selenium-server-standalone-2.40.0.jar"/>
        <pathelement location="../Desktop/Jar Files and Sources/testng-6.8.5-javadoc.jar"/>
        <pathelement location="../Desktop/Jar Files and Sources/testng-6.8.jar"/>
    </path>
    <target name="init">
        <mkdir dir="bin"/>
        <copy includeemptydirs="false" todir="bin">
            <fileset dir="src">
                <exclude name="**/*.launch"/>
                <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="jenkins_run_selenium.classpath"/>
        </javac>
    </target>
    <target description="Build all projects which reference this project. Useful to propagate changes." name="build-refprojects"/>
    <target description="copy Eclipse compiler jars to 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 with Eclipse compiler" name="build-eclipse-compiler">
        <property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
        <antcall target="build"/>
    </target>
    <target name="jenkins_run_selenium">
        <mkdir dir="${junit.output.dir}"/>
        <junit fork="yes" printsummary="withOutAndErr">
            <formatter type="xml"/>
            <classpath refid="jenkins_run_selenium.classpath"/>
        </junit>
    </target>
    <target name="junitreport">
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${junit.output.dir}"/>
        </junitreport>
    </target>
</project>][1]

我可以用jenkins、maven和code来解释我的做法。它应该与ant非常相似。这肯定会让詹金斯解雇你的测试

代码: 创建测试套件类,如下所示

@RunWithSuite.class @套房套房 { Test1.class, Test2.class } 公共类UnitTestSuite{}

在maven中:在pom.xml中使用maven surefire插件,如下所示:

            <!-- TEST -->
        <plugin>
            <!-- Runs the unit tests. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>
            <configuration>
                <includes>
                    <include>**/UnitTestSuite.java</include>
                </includes>                 
            </configuration>
        </plugin>
<target name="jenkins_run_selenium">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
<test name="tests.MyUnitTests" todir="${junit.output.dir}"/>
        <classpath refid="jenkins_run_selenium.classpath"/>
    </junit>
</target>

尝试通过添加目标jenkins_run_Seleniu来修改ant文件,如下所示:

            <!-- TEST -->
        <plugin>
            <!-- Runs the unit tests. -->
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.version}</version>
            <configuration>
                <includes>
                    <include>**/UnitTestSuite.java</include>
                </includes>                 
            </configuration>
        </plugin>
<target name="jenkins_run_selenium">
    <mkdir dir="${junit.output.dir}"/>
    <junit fork="yes" printsummary="withOutAndErr">
        <formatter type="xml"/>
<test name="tests.MyUnitTests" todir="${junit.output.dir}"/>
        <classpath refid="jenkins_run_selenium.classpath"/>
    </junit>
</target>

如果您想批量运行所有测试,请参阅

无法查看jenkins的照片/图像。请在调试模式下运行ant,查看是否显示任何异常/错误详细信息。参考这个网站-嘿,伙计们,谢谢你们的帮助,但不幸的是,我还没有找到解决方案。我试图接受甘尼什的建议,但什么也没有。谢谢anyway@user2389482您是否尝试过在ant中添加“测试”目标?非常感谢Ganesh,我将尝试并再次发布,让您知道