Why does Maven not run my test class?
QuizMediumJava only
A new class src/test/java/com/shop/LoginChecks.java has TestNG tests, but mvn test never runs it. Other classes such as CartTest run fine. Why?
- By default Surefire only picks classes named Test*, *Test, *Tests or *TestCase; rename it to LoginChecksTest or add it to includes or the suite file
- Maven only runs one test class per package
- Test classes must be in src/main/java
- The class must be public static
This question is part of Pro+
Pro+ opens every question in Interview Prep and the mock interview. Every article and the first 2 questions of each topic stay free. Hands-on Selenium and API tasks follow their course lesson's own lock.