DEV Community

loading...

Discussion on: Introduction to Unit Testing with Java

Collapse
khmarbaise profile image
Karl Heinz Marbaise

Hi, just a small hint. In case you add a dependency in Maven which is only intended for testing, which TestNG is, you should do it like this:

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>6.14.2</version>
    <scope>test</scope>
</dependency>

Apart from that if suggest to name a test class *Tests.java you have add an example to use the most recent versions of maven-surefire-plugin (2.21.0+). Otherwise this will not being executed as test. The best it to name it *Test.java this will work with older versions well..

Collapse
chrisvasqm profile image
Christian Vasquez Author

Thank you, Karl!

That's really helpful 😄