WebTau

WebTau (Web Test automation) - concise and expressive way to create REST API, GraphQL API and Web UI tests.Tests can be written in any JVM language. Language specific syntactic sugar is available for Groovy .Tests can take the form of either scenario files, executed via a command line tool or Maven plugin, or JUnit tests.WebTau provides a succinct DSL for querying REST APIs and asserting on responses. Groovy package scenarios.rest import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* scenario("check weather") { http.get("/weather") { temperature.shouldBe < 100 } } package com.example.tests.junit4 import org.testingisdocumenting.webtau.junit4.WebTauRunner import org.junit.Test import org.junit.runner.RunWith import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* @RunWith(WebTauRunner.class) class WeatherGroovyIT { @Test void checkWeather() { http.get("/weather") { temperature.shouldBe < 100 } } } json { "temperature": 88 } Java package com.example.tests.junit4; import org.testingisdocumenting.webtau.junit4.WebTauRunner; import org.junit.Test; import org.junit.runner.RunWith; import static org.testingisdocumenting.webtau.WebTauDsl.*; @RunWith(WebTauRunner.class) public class WeatherJavaIT { @Test public void checkWeather() { http.get("/weather", (header, body) -> { body.get("temperature").shouldBe(lessThan(100)); }); } } json { "temperature": 88 } Similar to REST APIs, WebTau also provides the ability to test GraphQL servers with its GraphQL DSL. Groovy package scenarios.rest import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* scenario("check weather") { def query = "{ weather { temperature } }"; graphql.execute(query) { weather.temperature.shouldBe < 100 } } package com.example.tests.junit4 import org.junit.Test import org.junit.runner.RunWith import org.testingisdocumenting.webtau.junit4.WebTauRunner import static org.testingisdocumenting.webtau.WebTauDsl.graphql @RunWith(WebTauRunner.class) class GraphQLWeatherGroovyIT { @Test void checkWeather() { def query = "{ weather { temperature } }"; graphql.execute(query) { weather.temperature.shouldBe < 100 } } } json { "data": { "weather": { "temperature": 88 } } } Java package com.example.tests.junit4; import org.junit.Test; import org.junit.runner.RunWith; import org.testingisdocumenting.webtau.junit4.WebTauRunner; import static org.testingisdocumenting.webtau.Matchers.lessThan; import static org.testingisdocumenting.webtau.WebTauDsl.graphql; @RunWith(WebTauRunner.class) public class GraphQLWeatherJavaIT { @Test public void checkWeather() { String query = "{ weather { temperature } }"; graphql.execute(query, (header, body) -> { body.get("data.weather.temperature").shouldBe(lessThan(100)); }); } } json { "data": { "weather": { "temperature": 88 } } } UI tests follow an identical pattern to API tests. package scenarios.ui import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* import static pages.Pages.* scenario("search by specific query") { search.submit("search this") search.numberOfResults.should == 2 }