How do I specify base url for REST API tests with WebTau

194 Views Asked by At

In WebTau documentation on how to test CRUD, examples are using relative urls

def customerPayload = [firstName: "FN", lastName: "LN"]

def id = http.post("/customers", customerPayload) {
    return id
}

http.get("/customers/${id}") {
    body.should == customerPayload
}

How do I set base url to use?

1

There are 1 best solutions below

0
Mykola Golubyev On BEST ANSWER

If you are using Groovy standalone runner you can base url via command line

webtau --url=http://localhost:8080

or have a groovy config file webtau.cfg.groovy

url = "http://localhost:8080

In case of Java src/test/resources/webtau.properties file

url = http://localhost:8080

or pass it via system property for test execution

-Durl="http://localhost:8080"

for both Java and Groovy you can also provide base url via environment variable

WEBTAU_URL=http://localhost:8080