I have created Maven project for testing one of my web application. I wanted to execute my project based on few parameters. So I added few parameters to my POM.XML and passed those properties as input to my plugins.
During execution of my maven project, I am getting below error for last two days [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project Sanity: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
I even referred the earlier stack over flow link to resolve this error.[Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.
But none of the solutions helped me to resolve the issue. I tried most of the solutions suggested
1) Tried cleaning project
2) updated my maven project and dependencies.
3) Ran in debug mode also
4) Recreated my maven project also
Please share your suggestions to resolve this issue
Also, I am posting my POM.XML file from Build tag remvoing dependecy plugins, Test Ng file, Java file used for invoking
- POM.XML
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- This configuration need to be modified for the environment to be run and type of test to be executed -->
<test>Web</test>
<!-- Sanity, Regression -->
<testtype>Sanity</testtype>
<sanitysuiteFile>Sanity.xml</sanitysuiteFile>
<regressionsuiteFile>Regression.xml</regressionsuiteFile>
</properties>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>${sanitysuiteFile}</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
- TestNg.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
<test name="Test">
<parameter name="selenium.env" value="UAT" />
<parameter name="selenium.browser" value="IE" />
<parameter name="selenium.pbrowser" value="Mozilla" />
<classes>
<class name="test.SanityTest"/>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Below error received when ran the project in debug mode
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project Sanity: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.20:test (default-test) on project Sanity: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: No tests were executed! (Set -DfailIfNoTests=false to ignore this error.)
at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution(SurefireHelper.java:86)
at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary(SurefirePlugin.java:334)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:937)
at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:785)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
are you getting error when you trying to build the project? if yes the add the following plugin in your pom.xml i will ignore the test cases and build your project.