WebTau Guide
Continuous Integration
Reference
light
Introduction
Wed Jun 12 2024

WebTau http module lets you exercise and validate HTTP endpoints. It provides a simplified way to make HTTP calls and validate responses
Now with Data Coverage.
GroovyJava
wait on http response value
private final def livePrice = http.resource("/prices/:ticker").price

...

livePrice.of("IBM").waitToBe > 115
console output
> waiting for value of /prices/IBM: price to be greater than 115
  > [1/3] executing HTTP GET http://localhost:43675/prices/IBM
    . header.statusCode equals 200 (0ms)
    
    response (application/json):
    {
      "price": **100**
    }
  . [1/3] executed HTTP GET http://localhost:43675/prices/IBM (3ms)
  > [3/3] executing HTTP GET http://localhost:43675/prices/IBM
    . header.statusCode equals 200 (0ms)
    
    response (application/json):
    {
      "price": ~~120~~
    }
  . [3/3] executed HTTP GET http://localhost:43675/prices/IBM (2ms)
. value of /prices/IBM: price greater than 115 (210ms)
GroovyJava
REST API test (Groovy specific runner)
package scenarios.rest

import static org.testingisdocumenting.webtau.WebTauGroovyDsl.*

scenario("check weather") {
    http.get("/weather") {
        temperature.shouldBe < 100
    }
}
REST API test (JUnit5)
package com.example.tests.junit5

import org.junit.jupiter.api.Test
import org.testingisdocumenting.webtau.junit5.WebTau

import static org.testingisdocumenting.webtau.WebTauGroovyDsl.*

@WebTau
class WeatherGroovyTest {
    @Test
    void checkWeather() {
        http.get("/weather") {
            temperature.shouldBe < 100
        }
    }
}
Server Response
{
  "temperature": 88
}
console output
> executing HTTP GET http://localhost:44451/weather
  . body.temperature less than 100 (0ms)
  . header.statusCode equals 200 (0ms)
  
  response (application/json):
  {
    "temperature": ~~88~~
  }
. executed HTTP GET http://localhost:44451/weather (32ms)