Selenium RC Using Other Testing Fram...

Last updated by fletcherr 2 years ago

Using Other Testing Frameworks

Selenium tests do not have to be written as JUnit test cases. Theoretically the SeleniumTest mixin could be applied to almost any test case written in another framework. Page objects are also agnostic of the test framework.

Currently the plugin has tested support for the Spock Plugin. Other testing frameworks such as EasyB, TestNG, JUnit 4, etc. may well work already and support is planned in future versions of the Selenium plugin.

To write Selenium tests using Spock, simply create your specification under test/selenium and (if you are not using page objects) use the SeleniumTest mixin then run tests as normal. For example:

import spock.lang.*
import grails.plugins.selenium.*

@Mixin(SeleniumTest) class HomepageSpecification extends Specification { def "user can load application homepage"() { when: selenium.open(contextPath) then: selenium.isTextPresent("Welcome to Grails") } }