使用Gradle和TestNG从Jenkins运行时,Selenium UI测试不会启动

时间:2019-04-09 13:16:57

标签: selenium jenkins selenium-webdriver gradle testng

我有一个正在运行的Selenium Automation框架,该框架已配置了TestNG测试。该项目使用gradle进行构建。我已经安装了本地Jenkins,并尝试通过gradle构建来触发测试,但是实际上并没有触发测试,并且该工作不断进行。

OS: Windows10

下面是我在build.gradle中配置的测试

test.dependsOn 'cleanTest'

test {
  dependsOn 'cleanTest'
  useTestNG(){
    suites 'testng.xml'
  }
}

我的TestNG XML如下所示。

<?xml version="1.0" encoding="UTF-8"?>
<suite name="example suite 1" verbose="1" >
  <test name="Regression suite" >
    <classes>
      <class name="ocam.test.SomeNameHere"/>
      <methods>
        <include name="MethodName1"/>
        <include name="MethodName2"/>
        <include name="MethodName3"/>
      </methods>
    </classes>
  </test>
</suite>

当我从命令行界面运行“ gradle clean build”时,它将选择TestNG XML中提到的测试方法并通过打开浏览器执行。

我安装了本地jenkins实例并配置了jenkins作业以运行gradle构建,以便可以触发测试。但是我的测试未触发,也没有打开浏览器。作业不断运行。

詹金斯设置:

Source Code Management -> File System
Build -> Gradle -> clean build
JDK -> System

Jenkins的控制台输出:

FSSCM.check completed in 17.647 seconds
System is not Unix, Xvfb will not be started
[ocam auto] $ cmd /c call C:\WINDOWS\TEMP\jenkins1500873736424301633.bat

C:\Program Files (x86)\Jenkins\workspace\ocam auto>gradle clean build 
Starting a Gradle Daemon (subsequent builds will be faster)

> Configure project :
OS FAMILY : win32

> Task :clean
> Task :compileJava NO-SOURCE
> Task :compileGroovy
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

> Task :processResources NO-SOURCE
> Task :classes
> Task :jar
> Task :assemble
> Task :cleanTest UP-TO-DATE
> Task :compileTestJava NO-SOURCE
> Task :compileTestGroovy
> Task :processTestResources NO-SOURCE
> Task :testClasses
> Task :test   ======>>>>>KEEPS LOADING HERE. NOTHING HAPPENS NEXT
Terminate batch job (Y/N)? 
Build was aborted
Aborted by Kiran Venkatesan
Finished: ABORTED

我希望从Jenkins和chrome触发硒测试,就像从CLI运行时一样。

0 个答案:

没有答案