【问题标题】:Running protractor tests as part of the Maven build process在 Maven 构建过程中运行量角器测试
【发布时间】:2016-10-09 23:16:53
【问题描述】:

我有一个 Maven 项目,我不想更改 POM,以便在我构建项目(清理 + 安装)时,在编译部分之后,将开始一组量角器测试(打开 selenium 并做几件事) ,并且只有在测试通过时,构建本身才会通过。

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

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

【问题讨论】:

    标签: angularjs maven selenium testing protractor


    【解决方案1】:

    即使我尝试了同样的方法并给出以下错误

    ERROR] 无法在项目 maven-ng-protractor-demo 上执行目标 com.github.greengerong:maven-ng-protractor:0.0.1:run (ng-protractor):运行量角器测试时出现异常。量角器测试失败。 -> [帮助 1] [错误] [错误] 要查看错误的完整堆栈跟踪,请使用 -e 开关重新运行 Maven。 [错误] 使用 -X 开关重新运行 Maven 以启用完整的调试日志记录。 [错误] [错误] 有关错误和可能的解决方案的更多信息,请阅读以下文章: [错误] [帮助 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

    【讨论】:

      【解决方案2】:

      我正在使用 grunt 执行这些测试,如下所示:-

             <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>
      

      【讨论】:

        【解决方案3】:

        您可以使用以下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>
        

        【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-11-08
        • 2015-03-18
        • 1970-01-01
        • 2010-09-30
        • 1970-01-01
        • 1970-01-01
        • 2020-04-23
        相关资源
        最近更新 更多