Skip to content

This is for practicing, learning, and teaching Groovy, Geb, and Spock

License

Notifications You must be signed in to change notification settings

benweese/Groovy_Automation

Repository files navigation

Groovy_Automation

This project is for practiceing Groovy, Geb, and Spock.

Badges

CircleCI Actions Docker Hub

GitHub Known Vulnerabilities GitHub issues StackShare

Motivation

This is to keep my automations skills sharp.

Notification

This automation is happy path only and does not test for failures. It is an example and learning on how it can done. If you wish to test more thoroughly then I would suggest using Cucumber and Scenario Outlines to test many different scenarios including failures.

Tools

BDD framework used

Built with

Continuous Intergration

Depandacy Maintenance

Downloads

Spock

Features

With testing our Circle-CI runner will use maven to run our automation scripts in Command line.

Code Example

Setup

chromeHeadless {
        driver = {
            ChromeOptions options = new ChromeOptions()
            options.addArguments('headless')
            options.addArguments("--no-sandbox")
            options.addArguments("--disable-gpu")
            options.addArguments("--window-size=1400x1200")
            options.addArguments("--disable-extensions")
            new ChromeDriver(options)
        }
    }

Test

def "Can get to Software Testing"(){
       when:
       to BenWeeseDevHome

       then:
       sideMenu.links[1].text().startsWith("Software Testing")

       when:
       sideMenu.links[1].click()

       then:
       at SoftwareTestingPage

   }

Page Object

class SoftwareTestingPage extends Page{
    static url = "QA/softwaretesting/"
    static at = { title.startsWith("Software Testing") }

    static content = {
        sideMenu { module(SideMenuModule) }
    }
}

Module

class SideMenuModule extends Module{
    static content = {
        linksContainer { $(".navigation-list") }
        links { linksContainer.find("a") }
    }
}

Other Examples

Credits

Ben Weese