Checkout our demo site to practice selenium https://magento.softwaretestingboard.com/

0 like 0 dislike
178 views
by Contributing Tester (92 points)
When we build maven project, project jar having name with the concatenation of GroupID-ArtifactID-Version is generated. Can we execute scripts on any machine using this jar?

1 Answer

0 like 0 dislike
by The go-to Tester (181 points)
selected by
 
Best answer

Usually maven Jar which is installed will not really contain your test package "src/test/java". So, you can not execute your automation script using Jar built using maven by default.

 

If you want to include your test classes into your Jar file, you can use below plugin.

 

<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
</plugin>
 
And once Jar is built, you can use with scope as test.
 
<dependency>
      <groupId>groupId</groupId>
      <artifactId>artifactId</artifactId>
      <type>test-jar</type>
      <version>version</version>
      <scope>test</scope>
</dependency>

 

Hope that answered your question.

...