0

I am trying to run my tests from the command line using Maven when I run the tetst directly from intelliJ IDE tests run as expected, when I try to run then using mvn test I am getting the following messages:

------------------------------------------------------- T E S T S ------------------------------------------------------- Running TestSuite Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator@34c4973 log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. 2020-06-29 17:32:49 [ERROR]failed to create 'BaseTest-531000' directory Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.99 sec Results : Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 

And this is my POM.xml:

 <modelVersion>4.0.0</modelVersion> <groupId>com.takeaway.automation</groupId> <artifactId>takeaway-project</artifactId> <version>1.0-SNAPSHOT</version> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> <java.version>1.8</java.version> <testng.version>7.1.0</testng.version> <awaitility.version>3.0.0</awaitility.version> </properties> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>8</source> <target>8</target> </configuration> </plugin> </plugins> </build> <dependencies> <!-- https://mvnrepository.com/artifact/log4j/log4j --> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.17</version> </dependency> <!-- https://mvnrepository.com/artifact/org.testng/testng --> <dependency> <groupId>org.testng</groupId> <artifactId>testng</artifactId> <version>${testng.version}</version> <scope>test</scope> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> <version>4.5.12</version> </dependency> <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-configuration2 --> <dependency> <groupId>org.apache.commons</groupId> <artifactId>commons-configuration2</artifactId> <version>2.0</version> </dependency> <!-- https://mvnrepository.com/artifact/commons-lang/commons-lang --> <dependency> <groupId>commons-lang</groupId> <artifactId>commons-lang</artifactId> <version>2.6</version> </dependency> <dependency> <groupId>commons-beanutils</groupId> <artifactId>commons-beanutils</artifactId> <version>1.9.3</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core --> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.9.8</version> </dependency> <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml --> <dependency> <groupId>com.fasterxml.jackson.dataformat</groupId> <artifactId>jackson-dataformat-xml</artifactId> <version>2.10.3</version> </dependency> </dependencies> </project> 

And my tests are under the class name is HTTPTester.java where there I got all my testng Test cases:

 src/testjava/com/takeaway/automation/tests/api/HTTPTester.java 

2 Answers 2

2

Unless you configure it otherwise, the surefire maven plugin is expecting your test to be at:

src/test/java/com/takeaway/automation/tests/api/HTTPTest.java 

(src/test/java, not src/testjava and *Test.java not *Tester.java)

See more details here: https://maven.apache.org/surefire/maven-surefire-plugin/examples/inclusion-exclusion.html

Sign up to request clarification or add additional context in comments.

1 Comment

So as I understood from you I did put the test class in the right location, it is still not running...
1

OK, I found what was missing , adding 'maven-surefire-plugin' plugin was missing:

 <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>3.0.0-M5</version> <configuration> <includes> <include>HTTPTester.java</include> </includes> </configuration> </plugin> 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.