简体   繁体   中英

Maven doesn't build project with surefire plugin in pom

I have a maven project with Selenium WebDriver tests using TestNG. I would like to run tests in groups, thats why is important to have surefire plugin in pom file, thats what i added to pom file: 在此处输入图片说明

If i run my project after adding those words using maven(using testNG is still working), i get an error in console and WebDriver doesn't even open.

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test
(default-test) on project PORefactor: Execution default-test of goal 
org.apache.maven.plugins:maven-surefire-plugin:2.15:test failed: There was an error in 
the forked process.

and also :

[ERROR] Cannot find class in classpath: com.volnoboy.POImplementation

I tried to refresh and clean project. I moved project to a different computer and error is the same. Internet connection is good. What should i do?

This is my pom

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.15</version>
            <configuration>
                <!-- <groups>1</groups> -->
                <suiteXmlFiles>
                    <suiteXmlFile>testSuites\testng1.xml</suiteXmlFile>
                    <suiteXmlFile>testSuites\testng1.xml</suiteXmlFile>
                </suiteXmlFiles>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-report-plugin</artifactId>
            <version>2.15</version>
        </plugin>

Try with that plugin.

And of course you need the testng and selenium dependecies in your pom.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM