Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.

前端 未结 28 1412
予麋鹿
予麋鹿 2020-12-03 06:41

I have been trying from a couple of days to resolve the following error but I am unable to resolve it :(

My module\'s pom.xml file is:



        
相关标签:
28条回答
  • 2020-12-03 06:52

    Try this it works!

    <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M3</version>
                    <configuration>
                    <testFailureIgnore>true</testFailureIgnore>
                    <shutdown>kill</shutdown> <!-- Use it if required-->
                    </configuration>
                </plugin>
    
    0 讨论(0)
  • 2020-12-03 06:52

    after a few days of wondering, my solution was that I forgot to use @Test annotation before the @BeforeEach

    0 讨论(0)
  • 2020-12-03 06:56

    try in cmd: mvn clean install -Dskiptests=true

    that'll skip all unit test. Might be It'll work fine for you.

    0 讨论(0)
  • 2020-12-03 06:57

    Here is the simplest way to resolve this error:

    1) Go to your pom.xml file path

    2) And edit the pom.xml like:

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.12</version>
        </plugin>
    </plugins>
    

    3) Save the file That's it.

    0 讨论(0)
  • 2020-12-03 06:59

    Was facing the same issue multiple times and I have 2 solutions:

    Solution 1: Add surefire plugin reference to pom.xml. Watch that you have all nodes! In my IDEs auto import version was missing!!!

    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>3.0.0-M3</version>
        </plugin>
    </plugins>
    

    Solution 2: My IDE added wrong import to the start of the file.

    IDE added

    import org.junit.Test;
    

    I had to replace it with

    import org.junit.jupiter.api.Test;
    
    0 讨论(0)
  • 2020-12-03 06:59

    I was facing the same kind of issue, your version numbers in the dependency of Selenium, TestNG, Junit should the same that you have used in your project. For example, in your project you are using the Selenium version 3.8. This version number should be mentioned in the dependency.

     <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>7.0.0-beta1</version>
        <scope>test</scope>
    </dependency>
        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>4.12</version>
          <scope>test</scope>
        </dependency>
    
        <dependency>
          <groupId>org.seleniumhq.selenium</groupId>
          <artifactId>selenium-java</artifactId>
          <version>3.8.1</version>
        </dependency>       
        <dependency>                
          <groupId>org.testng</groupId>                             
          <artifactId>testng</artifactId>                               
          <version>6.8</version>                                
          <scope>test</scope>                                       
        </dependency>   
      </dependencies>
    
    0 讨论(0)
提交回复
热议问题