package main
import (
"regexp"
"fmt"
)
func main() {
var re = regexp.MustCompile(`.*@company-gherkin:.*`)
var str = ` /**
* #########################
* Gherkin Glue Code
* ########################
*/
@And(/^.*click next.*$/)
def clickNext() {
def selectNext = new TestObject('selectNext')
selectNext.addProperty("xpath", ConditionType.EQUALS, "//button[contains( text(), 'next')]", true)
WebUI.click(selectNext)
}
/**
* @company-gherkin: Step: go to the list. Description: Navigates to the list.
*/
@Given(/^.*go to the list.*$/)
def goToList() {
// open the browser
openWebBrowser()
WebUI.navigateToUrl(GlobalVariable.G_SiteURL)
}
/**
* @company-gherkin: Step: select (.*) the item. Description: Select something to save, more than likely the usual. '(.*)' represents any value from the drop down list.
*/
@And(/^.*select (.*) the item.*$/)
def selectFixture(String fixture) {
if(!fixture || fixture == " ") {
fixture = "theItem"
}
fixture = fixture.trim()
// println "fixture is:"+fixture
// Select iotaa from the drop down list
WebUI.selectOptionByValue(findTestObject('path/to/item'), fixture, false)
}
`
for i, match := range re.FindAllString(str, -1) {
fmt.Println(match, "found at index", i)
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Golang, please visit: https://golang.org/pkg/regexp/