-
Notifications
You must be signed in to change notification settings - Fork 1
Sahagin Groovy overview
Nozomi Ito edited this page Sep 27, 2015
·
16 revisions
Sahagin-Groovy is Groovy implementation for Sahagin, which provides highly readable HTML test script viewer and test result report.
Sahagin-Groovy supports Geb, Spock, JUnit4, and can easily generate their result reports.
See Sahagin overview for more information about Sahagin.
Let's dig in with Spock and Geb page object example.
This is the Geb page object class with Sahagin-Groovy testDoc:
@PageDoc("Contact page")
class ContactPage extends Page {
static url = "http://www-demo.trident-qa.com/en/contact"
static content = {
name { $(name: "your-name") }
mail { $(name: "your-email") }
organization { $(name: "your-organization") }
subject { $(name: "your-subject") }
message { $(name: "your-message") }
sendButton { $("input.wpcf7-submit") }
successMessage { $(name: "success-message") }
}
// define testDoc for each content in contentTestDoc field
static contentTestDoc = {
name { "name" }
mail { "mail address" }
organization { "organization" }
subject { "subject" }
message { "inquiry cotent" }
successMessage { "success message" }
}
@TestDoc("send inquiry")
void send() {
sendButton.click()
}
}
and this is the Spock and Geb test code with the page object:
def "inquiry should success"() {
setup: "switch to contact page"
to ContactPage
when: "set test input"
name = "test user"
mail = "***@***.com"
organization = "TRIDENT Inc."
subject = "test"
message = "this is test inquiry"
and: "send test input"
send()
then: "message is shown"
successMessage == "message is successfully sent"
}
After executing the test, the HTML report is generated. (This report shows the test has failed.)
The current latest version of Sahagin-Groovy supports:
- Groovy2.4 or later (Maybe Sahagin-Groovy also works with older version Groovy, but it is unconfirmed)
- Spock, JUnit4
- Geb
The next step is Getting started.