2013-04-17 227 views
1

运行TestNG的我的测试套件有问题下面是堆栈跟踪的错误,我看到对詹金斯

[INFO] --- maven-surefire-plugin:2.8.1:test (default-test) @ eselenium-smartpearsonplayer-pageobjects --- 
[INFO] Surefire report directory: c:\jenkins\workspace\MediaPlayerTest\target\surefire-reports 
There are no tests to run. 

我知道,这可能是由于什么。所以让我试着给你提供更多的信息,虽然这是一个很长的镜头,也许你可以提供帮助。 我使用硒webdriver 2.29来编写测试。 我也在用maven构建。 我正在尝试使用testng来配置我正在使用的测试。 我使用jenkins来运行maven项目,我试图做“干净的验证”,有时候是“干净的测试”,因为我不知道两者之间的区别。

本地我正在使用eclipse。本地我可以使用maven测试在maven上运行测试,并使用maven验证。

这是我的朋友。

<!-- attempt to use surefire to run tests --> 
      <plugin> 
      <groupId>org.apache.maven.plugins</groupId> 
      <artifactId>maven-surefire-plugin</artifactId> 
      <version>2.8.1</version> 
       <configuration> 
        <suiteXmlFiles> 
          <suiteXmlFile>src\test\resources\testng\TestBrowserPOC_Test.xml</suiteXmlFile> 
        </suiteXmlFiles> 
       </configuration> 
      </plugin> 
      <!-- end attempt --> 

同样,当我在eclipse上进行maven验证时,测试运行良好。

这是我的testng xml。

<!DOCTYPE Suite SYSTEM "http://testng.org/testng-1.0.dtd"> 
    <suite name="BrowserPOC_Tests"> 

     <!-- class does not exist --> 
     <!-- <test name="Demo Test"> <parameter name="url"  value="src/test/resources/testData/login.html"></parameter> 
      <groups> <run> <exclude name="errorDetector"></exclude> </run> </groups> 
      <classes> <class name="com.pearson.demotests.DemoTestIT" /> </classes>   </test> --> 
     <test name="POC test"> 
      <groups> 
       <run> 
        <include name="volumeTest"></include> 
       </run> 
      </groups> 
      <classes> 
       <class name="com.pearson.poc_tests.BrowserPOCIT" /> 
      </classes> 
     </test> 
</suite> 

现在我要尝试改变我的XML名称遵循“命名约定”,看看有没有做任何事情。再次,测试在eclipse上运行良好,只是不在jenkins上。我不确定在这里做什么或者我需要什么其他信息。我从这里开始的步骤只是为了得到詹金斯专家的更多帮助。

哦,我认为我的测试xml的命名约定是正确的。 我也认为我正在使用一个构建为maven的自由式项目。 我应该使用“mvn clean test”而不是“clean test”吗?

+1

您是否曾尝试在没有Eclipse的情况下运行'mvn test',即从命令行运行? –

+0

是否在工作区中提供了测试代码? –

回答

0

我过去使用过maven fail-safe插件。以下是我的配置。你会运行mvn clean verify。总是推荐mvn clean,因为它会在编译和运行测试之前删除目标目录。

<properties> 
     <functionalSourceDirectory>src/itest</functionalSourceDirectory> 
</properties> 

<plugin> 
    <artifactId>maven-failsafe-plugin</artifactId> 
    <version>2.11</version> 
    <configuration> 
     <testSourceDirectory>${functionalSourceDirectory}</testSourceDirectory> 
     <suiteXmlFiles> 
     <suiteXmlFile>src/itest/resources/testng.xml</suiteXmlFile> 
     </suiteXmlFiles> 
    </configuration> 
    <executions> 
     <execution> 
      <id>verify</id> 
      <phase>verify</phase> 
      <goals> 
      <goal>verify</goal> 
      </goals> 
     </execution> 
    </executions> 
</plugin> 
1

谢谢大家。原来我的jenkins配置中有两个存储库。詹金斯正在寻找错误项目中的测试。