这次我用Groovy尝试了Arquillian Drone和Graphene,我有以下2个测试,我想做的是第二次测试使用第一次测试的浏览器。但是在第一次测试结束后浏览器关闭了 - 有没有办法将浏览器传递给第二次测试?
@RunWith(ArquillianSputnik)
@RunAsClient
@Stepwise
class testclass extends Specification {
@Drone
private WebDriver browser;
@Page
SubPage subPage
@ArquillianResource
URL url
def 'It should navigate to subscription page'() {
when: 'I go to subscription page'
browser.get('http://localhost:8585/');
then: 'It should should enter sub name'
subPage.enterName("Name")
}
def "Enter subdescription"() {
when: "I enter a sub description"
sub.enterDescription('Description')
then: "Subscription description should be visible in description input field"
}
答案 0 :(得分:0)
第二次测试看起来像
def "Enter subdescription"() {
when: "I enter a sub description"
browser.getCurrentUrl()
sub.enterDescription('Description')
then: "Subscription description should be visible in description input field"
}