Gr8 stack community Goals: Education Networking Professional Development Contact Us @Gr8Ladies on twitter Gr8Ladies.org LinkedIn, Facebook search Gr8Ladies Contribute to our website via GitHub
Gradle –build automation tool Used to build Android Apps Griffon – desktop app framework Spock – testing framework Many other minor frameworks and development tools
UserController.list() renders /views/user/list.gsp Special tags for forms, links, looping and other tasks Reference model data by ${model.attribute}
dependencies { test "org.seleniumhq.selenium:selenium-support:2.40.0" test "org.seleniumhq.selenium:selenium-firefox-driver:2.40.0" test "org.gebish:geb-spock:0.9.2” } plugins { test ":geb:0.9.2" compile ":remote-control:1.4“ // For accessing the context of the // grails app from tests // Spock is already included in Grails 2.3.6 }
the link that is navigated to // on the 'to' call static url = "employee/list" // the closure that is verified on // the 'at' call static at = { pageTitle.text() == 'Employee List Page' } // The navigator objects static content = { pageTitle(wait: true) { $('h2.title') } employeeLink(wait: true, to: EmployeeShowPage) { id -> $('a.employeeLink', 'id': "${id}") } } // It is good practice to wrap all the // navigator objects in methods boolean employeeLinkIsPresent(Long id) { employeeLink(id).isDisplayed() } EmployeeShowPage clickEmployeeLink(Long id) { employeeLink(id).click() return browser.page } } <html> <head> <title>Employee</title> </head> <body> <h2 class="title">Employee List Page</h2> <ul> <li> <a href="/gebDemo/employee/show/1" id="1” class="employeeLink"> Alice LastName </a> </li> <li> <a href="/gebDemo/employee/show/2" id="2” class="employeeLink"> Bob LastName2 </a> </li> <li> <a href="/gebDemo/employee/show/3" id="3” class="employeeLink"> Charles LastName3 </a> </li> </ul> </body> </html>
extends GebReportingSpec { EmployeeRemoteControl remote = new EmployeeRemoteControl() Long employeeId_1 Long employeeId_2 Long employeeId_3 def setup() { EmployeeRemoteControl remote = new EmployeeRemoteControl() employeeId_1 = remote.createEmployee('Alice', 'LastName') employeeId_2 = remote.createEmployee('Bob', 'LastName2') employeeId_3 = remote.createEmployee('Charles', 'LastName3') } CONTINUED def 'A descriptive name for the feature'() { given: 'Setup stuff' // Can be blank when: 'The employee list page is navigated to' EmployeeListPage employeeListPage = to EmployeeListPage then: 'The employee list page header is displayed' assert at(EmployeeListPage) // All statements in a // then-block are implicitly // asserted and: 'The employee is listed' assert employeeListPage.employeeLinkIsPresent( employeeId_1) when: 'The employee is clicked' employeeListPage.clickEmployeeLink(employeeId_1) then: 'At the show employee page' assert at(EmployeeShowPage) } def cleanup() { remote.deleteEmployee(employeeId_1) remote.deleteEmployee(employeeId_2) remote.deleteEmployee(employeeId_3) } }
grails create-domain-class User Creates domain class and test file grails generate-all appName.User Auto generates views and controllers based on the properties of the domain class
for coupon code Programming Grails – Bert Beckwith (O’reilly animal book) Groovy In Action - Dierk Koenig with Andrew Glover, Paul King, Guillaume Laforge and Jon Skeet Many Tutorials available on grails.org
of the month at Smart Things Join Gr8Ladies for hack sessions and contribute to the gr8ladies website on github Gr8Ladies.org or @Gr8Ladies on twitter