通过maven安装运行项目时构建失败

时间:2017-05-24 06:52:07

标签: eclipse maven selenium maven-install-plugin

尝试通过Right Click Project>>Run As>>Maven Install

在Eclipse中运行Project

我的src\\tests文件夹中只有2个测试用例,两个测试用例都运行良好。测试完成后,在控制台中获取构建失败。

  

错误: - 无法执行目标   org.apache.maven.plugins:Maven的万无一失,插件:2.19.1:测试   项目selenium-project上的(default-test):执行默认测试   目标org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test   失败:分叉进程出错   org.openqa.selenium.remote.SessionNotFoundException

请参阅以下屏幕截图 enter image description here

2 个答案:

答案 0 :(得分:0)

将以下代码添加到您的pom.xml。

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

让我知道它是否有效。

答案 1 :(得分:0)

我有以下方法使用Maven从testing.xml文件执行测试

在项目根目录中添加一个Testing.xml文件。内容就像

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestSuit">
  <test name="MyTest">
         <classes>      
                        <class name="package.subpackage.TestClassName"/>            
         </classes> 
  </test>
</suite>

pom.xml <dependencies>标记

上面的 <!-- Following plugin executes the testing tests --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.12.4</version> <configuration> <!-- Suite testng xml file to consider for test execution --> <suiteXmlFiles> <suiteXmlFile>testng.xml</suiteXmlFile> </suiteXmlFiles> </configuration> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> 添加以下代码

            

clang++ -std=c++14 -O0 -Wall -pedantic -pthread main.cpp && ./a.out
main.cpp:1:18: warning: braces around scalar initializer [-Wbraced-scalar-init]
void point(int = {1}, int = {2}) {}
                 ^~~
main.cpp:1:29: warning: braces around scalar initializer [-Wbraced-scalar-init]
void point(int = {1}, int = {2}) {}
                            ^~~

2 warnings generated.

执行以下步骤

右键单击Project&gt;运行方式&gt; Maven Clean

然后

右键单击Project&gt;运行方式&gt; Maven Build

然后

右键单击Project&gt;运行方式&gt; Maven测试

相关问题