简体   繁体   English

Maven不在Pom中使用surefire插件构建项目

[英]Maven doesn't build project with surefire plugin in pom

I have a maven project with Selenium WebDriver tests using TestNG. 我有一个使用TestNG进行Selenium WebDriver测试的Maven项目。 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: 我想按组运行测试,这就是为什么在pom文件中具有surefire插件很重要,这就是我添加到pom文件中的原因: 在此处输入图片说明

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. 如果我在使用maven添加了这些单词之后运行了我的项目(使用testNG仍在工作),则控制台中将出现错误,并且WebDriver甚至无法打开。

[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. 当然,您需要在pom中依赖于睾丸和硒。

Hope it helps. 希望能帮助到你。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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