2016-06-09 39 views
3

我有一个Maven项目,我不想更改POM,因此当我编译项目(Clean + Install)时,在编译部分之后,一组量角器测试将开始(打开硒并做几件事情),并且只有当测试通过时,构建本身才会通过。作为Maven构建过程的一部分运行量角器测试

我似乎无法找到给我这种功能的东西。有可能吗?如果是这样,我该如何使用它? 我们目前正在使用'com.github.eirslett'maven插件进行构建,我想知道是否可以在这个插件中添加量角器测试作为舞台。我可以看到它支持用'Karma'进行单元测试,但不支持与量角器有关的任何测试。

任何帮助将不胜感激!谢谢:)

回答

2

您可以使用下面的Maven插件https://github.com/greengerong/maven-ng-protractor

,你可以用它像这样

<plugin> 
    <groupId>com.github.greengerong</groupId> 
    <artifactId>maven-ng-protractor</artifactId> 
    <version>0.0.2</version> 
    <configuration> 
    <protractor>protractor</protractor> 
    <configFile>yourconfig.js</configFile> 
    </configuration> 
    <executions> 
    <execution> 
    <id>ng-protractor</id> 
    <phase>integration-test</phase> 
    <goals> 
     <goal>run</goal> 
    </goals> 
    </execution> 
    </executions> 
</plugin> 
+0

那就是诀窍。谢谢! – elmekiesIsrael

+0

Hei Elmekies,你真的解决了你的问题吗?看来这个项目并不完整,它根本就没有运行。我试图自己运行演示部分,但我得到了错误。请看看:https://github.com/greengerong/maven-ng-protractor/issues/5 – Neo182

0

我使用咕噜执行这些测试象下面这样: -

 <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>exec-maven-plugin</artifactId> 
      <version>1.2.1</version> 
      <executions> 
       <execution> 
        <id>Run Protractor Tests</id> 
        <phase>integration-test</phase> 
        <goals> 
         <goal>exec</goal> 
        </goals> 
        <configuration> 
         <executable>grunt${script.extension}</executable> 
         <arguments> 
          <argument>int-test</argument> 
         </arguments> 
         <workingDirectory>${basedir}/modules</workingDirectory> 
        </configuration> 
       </execution> 
      </executions> 
     </plugin> 
相关问题