|
85 | 85 | </div><section style="max-width: 640px; margin-left: auto; margin-right: auto;"> |
86 | 86 | <article> |
87 | 87 | <header><h1>Minimal Groovy Setup</h1></header> |
88 | | -<p>Download and unzip https://repo.maven.apache.org/maven2/org/testingisdocumenting/webtau/webtau-dist/1.33/webtau-dist-1.33-webtau.zip webtau. Add it to your PATH . Generate webtau examples webtau --example Navigate into graphql example cd examples/graphql import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* scenario('fetch types from schema') { def query = '{ __schema { types { name } } }' graphql.execute(query) { __schema.types.numberOfElements().shouldBe > 0 } } To run test webtau introspection.groovy --url=http://localhost:8080 Note: using import is optional and is mainly for IDE auto completion. Imports are added implicitly during command line run. Url parameter can be moved to a webtau.cfg.groovy file. Please note that WebTau will automatically append /graphql to the url.Webtau will attempt to send an introspection query in order to obtain information about the GraphQL schema. If this fails, it will not be able to record coverage information for GraphQL. Should you wish to fail the test if introspection fails, please set the graphQLIgnoreIntrospectionFailures property to false . url = "http://localhost:8080/" graphQLIgnoreIntrospectionFailures = false configuration/environments Specify multiple environments to streamline test execution.</p> |
| 88 | +<p>Download and unzip https://repo.maven.apache.org/maven2/org/testingisdocumenting/webtau/webtau-dist/1.34/webtau-dist-1.34-webtau.zip webtau. Add it to your PATH . Generate webtau examples webtau --example Navigate into graphql example cd examples/graphql import static org.testingisdocumenting.webtau.WebTauGroovyDsl.* scenario('fetch types from schema') { def query = '{ __schema { types { name } } }' graphql.execute(query) { __schema.types.numberOfElements().shouldBe > 0 } } To run test webtau introspection.groovy --url=http://localhost:8080 Note: using import is optional and is mainly for IDE auto completion. Imports are added implicitly during command line run. Url parameter can be moved to a webtau.cfg.groovy file. Please note that WebTau will automatically append /graphql to the url.Webtau will attempt to send an introspection query in order to obtain information about the GraphQL schema. If this fails, it will not be able to record coverage information for GraphQL. Should you wish to fail the test if introspection fails, please set the graphQLIgnoreIntrospectionFailures property to false . url = "http://localhost:8080/" graphQLIgnoreIntrospectionFailures = false configuration/environments Specify multiple environments to streamline test execution.</p> |
89 | 89 | </article> |
90 | 90 |
|
91 | 91 | <article> |
92 | 92 | <header><h1>Minimal JUnit Setup</h1></header> |
93 | | -<p>Groovy <dependency> <groupId>org.testingisdocumenting.webtau</groupId> <artifactId>webtau-groovy</artifactId> <version>1.33</version> </dependency> Java <dependency> <groupId>org.testingisdocumenting.webtau</groupId> <artifactId>webtau</artifactId> <version>1.33</version> </dependency> Groovy 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 } } } 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)); }); } } Add webtau.properties to test class path url = http://localhost graphQLIgnoreIntrospectionFailures = false</p> |
| 93 | +<p>Groovy <dependency> <groupId>org.testingisdocumenting.webtau</groupId> <artifactId>webtau-groovy</artifactId> <version>1.34</version> </dependency> Java <dependency> <groupId>org.testingisdocumenting.webtau</groupId> <artifactId>webtau</artifactId> <version>1.34</version> </dependency> Groovy 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 } } } 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)); }); } } Add webtau.properties to test class path url = http://localhost graphQLIgnoreIntrospectionFailures = false</p> |
94 | 94 | </article> |
95 | 95 |
|
96 | 96 | <article> |
|
129 | 129 | "text" : "Download and unzip ", |
130 | 130 | "type" : "SimpleText" |
131 | 131 | }, { |
132 | | - "url" : "https://repo.maven.apache.org/maven2/org/testingisdocumenting/webtau/webtau-dist/1.33/webtau-dist-1.33-webtau.zip", |
| 132 | + "url" : "https://repo.maven.apache.org/maven2/org/testingisdocumenting/webtau/webtau-dist/1.34/webtau-dist-1.34-webtau.zip", |
133 | 133 | "isFile" : false, |
134 | 134 | "type" : "Link", |
135 | 135 | "content" : [ { |
|
294 | 294 | "name" : "Groovy", |
295 | 295 | "content" : [ { |
296 | 296 | "lang" : "xml", |
297 | | - "snippet" : "<dependency>\n <groupId>org.testingisdocumenting.webtau</groupId>\n <artifactId>webtau-groovy</artifactId>\n <version>1.33</version>\n</dependency>", |
| 297 | + "snippet" : "<dependency>\n <groupId>org.testingisdocumenting.webtau</groupId>\n <artifactId>webtau-groovy</artifactId>\n <version>1.34</version>\n</dependency>", |
298 | 298 | "title" : "Maven Dependency", |
299 | 299 | "type" : "Snippet" |
300 | 300 | } ] |
301 | 301 | }, { |
302 | 302 | "name" : "Java", |
303 | 303 | "content" : [ { |
304 | 304 | "lang" : "xml", |
305 | | - "snippet" : "<dependency>\n <groupId>org.testingisdocumenting.webtau</groupId>\n <artifactId>webtau</artifactId>\n <version>1.33</version>\n</dependency>", |
| 305 | + "snippet" : "<dependency>\n <groupId>org.testingisdocumenting.webtau</groupId>\n <artifactId>webtau</artifactId>\n <version>1.34</version>\n</dependency>", |
306 | 306 | "title" : "Maven Dependency", |
307 | 307 | "type" : "Snippet" |
308 | 308 | } ] |
|
417 | 417 | } ] |
418 | 418 | } ] |
419 | 419 | } ], |
420 | | - "lastModifiedTime" : 1604812521923, |
| 420 | + "lastModifiedTime" : 1605924949780, |
421 | 421 | "tocItem" : { |
422 | 422 | "sectionTitle" : "GraphQL", |
423 | 423 | "pageTitle" : "Getting Started", |
|
0 commit comments