Jenkins没有运行TestNG测试

时间:2014-01-15 19:31:11

标签: selenium jenkins testng

我有一个在Jenkins上运行的TestNG项目。由于某种原因,我不知道它停止了运行测试。它编译得很完美但不会运行测试。以下是运行的输出:

  <===[JENKINS REMOTING CAPACITY]===>channel started
  log4j:WARN No appenders could be found for logger 
  (org.apache.commons.beanutils.converters.BooleanConverter).
  log4j:WARN Please initialize the log4j system properly.
  Executing Maven:  -B -f C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB   SELENIUM-WEB-TEST\pom.xml clean install
  [INFO] Scanning for projects...
  [INFO]                                                                         
  [INFO] ------------------------------------------------------------------------
  [INFO] Building TEST-CMS-WEB 0.0.1
  [INFO] ------------------------------------------------------------------------
  [INFO] 
  [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ Web ---
  [INFO] 
  [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ Web ---
  [debug] execute contextualize
  [INFO] Using 'cp1252' encoding to copy filtered resources.
  [INFO] Copying 69 resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ Web ---
  [INFO] Compiling 73 source files to C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\target\classes
  [INFO] 
  [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ Web ---
  [debug] execute contextualize
  [INFO] Using 'cp1252' encoding to copy filtered resources.
  [INFO] skip non existing resourceDirectory C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\src\test\resources
  [INFO] 
  [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ Web ---
  [INFO] Compiling 2 source files to C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\target\test-classes
  [INFO] 
  [INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ Web ---
  [JENKINS] Recording test results
  [INFO] 
  [INFO] --- maven-jar-plugin:2.3.2:jar (default-jar) @ Web ---
  [INFO] Building jar: C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\target\Web-0.0.1.jar
  [INFO] 
  [INFO] --- maven-install-plugin:2.3.1:install (default-install) @ Web ---
  [INFO] Installing C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\target\Web-0.0.1.jar to C:\.m2\repository\Test\Web\0.0.1\Web-0.0.1.jar
  [INFO] Installing C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\pom.xml to C:\.m2\repository\Test\Web\0.0.1\Web-0.0.1.pom
  [INFO] ------------------------------------------------------------------------
  [INFO] BUILD SUCCESS
  [INFO] ------------------------------------------------------------------------
  [INFO] Total time: 5.211s
  [INFO] Finished at: Wed Jan 15 14:21:03 UYST 2014
  [INFO] Final Memory: 26M/310M
  [INFO] ------------------------------------------------------------------------
  [JENKINS] Archiving C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\pom.xml to C:\Java\jenkins-1.523\jobs\TEST_HEAD_NOEXPORT\modules\Test$Web\builds\2014-01-15_14-20-56\archive\Test\Web\0.0.1\Web-0.0.1.pom
  [JENKINS] Archiving C:\Java\jenkins-1.523\workspace\TEST_HEAD_NOEXPORT\CMS-WEB\SELENIUM-WEB-TEST\target\Web-0.0.1.jar to C:\Java\jenkins-1.523\jobs\TEST_HEAD_NOEXPORT\modules\Test$Web\builds\2014-01-15_14-20-56\archive\Test\Web\0.0.1\Web-0.0.1.jar
  Waiting for Jenkins to finish collecting data

如果有人知道会发生什么,我会很感激帮助。

2 个答案:

答案 0 :(得分:2)

如果你使用Maven Surefire,你是否正确指定了“测试包含”过滤器?测试阶段将在src / test / java中搜索包含@Test注释的类。很容易将Maven错误配置为src / test / java目录的位置,所以要小心,你会弄明白的。

答案 1 :(得分:0)

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M3</version>
            <configuration>
                <suiteXmlFiles>
                    <suiteXmlFile>testng.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>

在属性末尾和依赖项之前包含maven surefire插件。使用您的“ TestNG” XML文件名。使用上面的代码。