使用mvn test命令并行执行测试

时间:2016-04-04 04:26:21

标签: maven testing parallel-processing testng

我有两个测试SignInTest,SignUpTest我想用mvn test命令并行执行它们。以下是我的testng.xml

的内容
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Big Basket">
  <suite-files>
   <suite-file path="./Customer.xml" />
  </suite-files>
</suite>

Customer xml文件的内容是

<suite name="Customer" parallel="tests" thread-count="2">
  <test name="Sign Up Test" >
    <classes>
      <class name="com.bigbasket.customer.SignUpTest" />
    </classes>
  </test>
  <test name="Sign In Test" >
    <classes>
      <class name="com.bigbasket.customer.SignInTest" />
    </classes>
  </test>
</suite>

我附上了我的pom.xml文件以供参考。

当我在mvn test中输入命令时,我看到以下错误消息

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
19.1:test (default-test) on project BigBasket: Execution default-test of goal or
g.apache.maven.plugins:maven-surefire-plugin:2.19.1:test failed: There was an er
ror in the forked process
[ERROR] org.apache.maven.surefire.testset.TestSetFailedException: Suite file E:\
Selenium\BigBasket\testng.xml is not a valid file
[ERROR] at org.apache.maven.surefire.testng.TestNGXmlTestSuite.locateTestSets(Te
stNGXmlTestSuite.java:98)
[ERROR] at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider
.java:120)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameCla
ssLoader(ForkedBooter.java:290)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(Fork
edBooter.java:242)
[ERROR] at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:
121)
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutio
nException

但是当我选择testng.xml时,右键单击并选择Run As TestNG Suite,并行执行两个测试。

你能帮忙解决我正在做的错误吗?pom.xml

0 个答案:

没有答案