dimanche 3 avril 2016

Executing tests in parallel using mvn test command

I have two tests SignInTest, SignUpTest which I want to execute them in parallel using mvn test command. Below is the contents of my testng.xml

<!DOCTYPE suite SYSTEM "http://ift.tt/19x2mI9" >
<suite name="Big Basket">
  <suite-files>
   <suite-file path="./Customer.xml" />
  </suite-files>
</suite>

Contents of Customer xml file is

<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>

I have attached my pom.xml file for reference.

When I type the command in mvn test, I see the below error messages

[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://ift.tt/N6g4hv
nException

But when I select testng.xml, right click and select Run As TestNG Suite, executes both the tests in parallel.

Could you please help on what mistake I'm doing?pom.xml

Aucun commentaire:

Enregistrer un commentaire