从java类运行geb测试 [英] running a geb test from a java class

查看:214
本文介绍了从java类运行geb测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近偶然发现了 geb ,它看起来像是一种在我们的网络上执行集成测试的好方法应用。我们的平台都是基于Java的,并通过阅读这些文章
$ b


Geb通过
与流行的集成为功能性Web测试提供一流的支持测试框架,如... JUnit,
TestNG ...


我认为这很容易执行测试从一个Java类(testng测试?)。

我是groovy和geb的新手。



到目前为止,我已经在我的pom中包含了geb-testng和groovy:

 < dependency> 
< groupId> org.codehaus.geb< / groupId>
< artifactId> geb-testng< / artifactId>
< version> 0.7.0< / version>
< /依赖关系>
< dependency>
< groupId> org.codehaus.groovy< / groupId>
< artifactId> groovy< / artifactId>
< version> 1.8.6< / version>
< /依赖关系>

...但是我找不到任何创建测试并从java运行它的示例



帮助表示赞赏。

解决方案

我st upon这个问题同时搜索Geb-TestNG示例。这是什么对我有用:

  import geb.testng.GebTest 
import org.testng.annotations.Test


类GroovyYourTestClass扩展了GebTest {

@Test
应该测试某些东西(){
到YourPageObject
// ...
}
}


I've recently stumbled across geb and it looks like a good way to perform integration tests on our web applications. Our platforms are all java based and from reading that

"Geb provides first class support for functional web testing via integration with popular testing frameworks such as ...JUnit, TestNG..."

i assumed it would be easy to execute a test from a java class (testng test?).

I'm new to groovy and geb.

So far I have included geb-testng and groovy in my pom:

<dependency>
    <groupId>org.codehaus.geb</groupId>
    <artifactId>geb-testng</artifactId>
    <version>0.7.0</version>
</dependency>
<dependency>
    <groupId>org.codehaus.groovy</groupId>
    <artifactId>groovy</artifactId>
    <version>1.8.6</version>
</dependency>

... However i can't find any examples of creating a test and running it from a java class.

help appreciated.

解决方案

I stumpled upon this question while searching a Geb-TestNG example. Here is what is working for me:

import geb.testng.GebTest
import org.testng.annotations.Test


class GroovyYourTestClass extends GebTest {

    @Test
    void "should test something"() {
        to YourPageObject
        // ...
    }
}

这篇关于从java类运行geb测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆