Skip to content
Permalink
Browse files

generate more reports screenshots automatically for docs

  • Loading branch information...
MykolaGolubyev committed May 10, 2019
1 parent 49ede74 commit 9fd1b7f6963f724f5b59eb3d180272fde2ef5ce7
Showing with 203 additions and 33 deletions.
  1. +1 −1 README.md
  2. +5 −3 webtau-docs/webtau/REST/CRUD-separated.md
  3. +1 −1 webtau-docs/webtau/REST/CRUD.md
  4. +2 −2 webtau-docs/webtau/REST/report.md
  5. BIN webtau-docs/webtau/img/rest-crud-separated-report.png
  6. BIN webtau-docs/webtau/img/rest-report-http-calls.png
  7. BIN webtau-docs/webtau/img/rest-report-summary.png
  8. +1 −1 webtau-docs/webtau/lookup-paths
  9. +6 −0 webtau-feature-testing/examples/scenarios/rest/springboot/Customer.groovy
  10. +1 −1 webtau-feature-testing/examples/scenarios/rest/springboot/customerCrud.groovy
  11. +2 −7 webtau-feature-testing/examples/scenarios/rest/springboot/customerCrudSeparated.groovy
  12. +34 −0 webtau-feature-testing/examples/scenarios/rest/springboot/customerCrudSeparatedMissingMethod.groovy
  13. +4 −0 webtau-feature-testing/examples/scenarios/rest/springboot/withSpec.cfg
  14. +12 −2 ...-feature-testing/src/test/groovy/com/twosigma/webtau/featuretesting/WebTauRestFeaturesTest.groovy
  15. +19 −0 ...g/test-expectations/scenarios/rest/springboot/customerCrudSeparatedMissingMethod/run-details.json
  16. +4 −0 webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-crud-http-calls.json
  17. BIN webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-crud-http-calls.png
  18. +22 −0 webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-crud-separated-http-calls.json
  19. BIN webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-crud-separated-http-calls.png
  20. +22 −0 webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-http-calls.json
  21. BIN webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-http-calls.png
  22. +4 −0 webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-summary.json
  23. BIN webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-summary.png
  24. +4 −0 webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-test-summary.json
  25. BIN webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-test-summary.png
  26. +14 −0 webtau-report-testing/src/test/groovy/pages/Report.groovy
  27. +2 −0 webtau-report-testing/src/test/groovy/pages/ReportLocation.groovy
  28. +14 −0 webtau-report-testing/src/test/groovy/scenarios/crudOverview.groovy
  29. +27 −0 webtau-report-testing/src/test/groovy/scenarios/crudSeparatedOverview.groovy
  30. +0 −13 webtau-report-testing/src/test/groovy/scenarios/overview.groovy
  31. +2 −2 webtau-report-testing/src/test/groovy/webtau.cfg
@@ -30,6 +30,6 @@ scenario("search by specific query") {

## Precise Reporting

![report-image](webtau-docs/webtau/img/rest-crud-separated-report.png)
![report-image](webtau-report-testing/src/test/groovy/doc-artifacts/reports/report-http-calls.png)

[Full Documentation](https://opensource.twosigma.com/webtau/guide/)
@@ -3,13 +3,15 @@
One of the benefits of separating one CRUD `scenario` into multiple is to be able to run one test at a time.
In order to do it we will use `createLazyResource`.

:include-file: scenarios/rest/springboot/customerCrudSeparated.groovy {commentsType: "inline"}
:include-file: scenarios/rest/springboot/customerCrudSeparated.groovy {commentsType: "inline", title: "CRUD separated"}

Note: to run one scenario at a time use `sscenario` (additional `s` in front)
:include-file: scenarios/rest/springboot/Customer.groovy {commentsType: "inline", title: "Customer lazy resource"}

Note: to run one scenario at a time use `sscenario` (additional `s` in front). [Read more](groovy-specific-runner/selective-run)

# Report

As you can see in the report below, each `CRUD` operation has its own entry. If you follow this pattern, then you
can filter tests by `create`, `update`, `read`, `delete` to streamline investigation.

:include-image: img/rest-crud-separated-report.png {fit: true}
:include-image: doc-artifacts/reports/report-crud-separated-http-calls.png {fit: true}
@@ -24,7 +24,7 @@ If you don't have an explicit `statusCode` validation it will be automatically v

After your test executions a report will be produced.

:include-image: img/rest-report-http-calls.png {fit: true}
:include-image: doc-artifacts/reports/report-crud-http-calls.png {fit: true}

Note: asserted values are being tracked and highlighted inside the report

@@ -6,12 +6,12 @@ By default report is generated at `<workingdir>/webtau.report.html`. To change t

Out of the box report provides high level information like number of failed tests and HTTP Operations coverage.

:include-image: img/rest-report-summary.png {fit: true}
:include-image: doc-artifacts/reports/report-summary.png {fit: true}

# Test Summary

Selected test to see a summary information about test run
:include-image: report-test-summary.png {fit: true}
:include-image: doc-artifacts/reports/report-test-summary.png {fit: true}

# Navigation

Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,5 +22,5 @@
../../webtau-junit4-examples/src/test/java
../../webtau-junit5-examples/src/test/groovy
../../webtau-junit5-examples/src/test/java
../../webtau-report-testing/src/test/groovy/doc-artifacts
../../webtau-report-testing/src/test/groovy
../target/classes
@@ -0,0 +1,6 @@
package scenarios.rest.springboot

class Customer {
Number id
String url // store url of the created entity
}
@@ -5,7 +5,7 @@ import static com.twosigma.webtau.WebTauGroovyDsl.*
scenario("CRUD operations for customer") {
def customerPayload = [firstName: "FN", lastName: "LN"]

int id = http.post("/customers", customerPayload) {
def id = http.post("/customers", customerPayload) {
return id // return id value from response body
}

@@ -2,19 +2,14 @@ package scenarios.rest.springboot

import static com.twosigma.webtau.WebTauGroovyDsl.*

class Customer {
Number id
String url // store url of the created entity
}

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

def customer = createLazyResource("customer") { // lazy resource to be created on the first access
int id = http.post("/customers", customerPayload) {
def id = http.post("/customers", customerPayload) {
return id
}

return new Customer(id: id, url: "/customers/${id}")
return new Customer(id: id, url: "/customers/${id}") // definition is below
}

scenario("customer create") {
@@ -0,0 +1,34 @@
package scenarios.rest.springboot

import static com.twosigma.webtau.WebTauGroovyDsl.*

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

def customer = createLazyResource("customer") { // lazy resource to be created on the first access
int id = http.post("/customers", customerPayload) {
return id
}

return new Customer(id: id, url: "/customers/${id}")
}

scenario("customer create") {
customer.id.should != null // accessing resource for the first time will trigger POST (in this example)
}

scenario("customer read") {
http.get(customer.url) { // convenient re-use of url defined above
body.should == customerPayload
}
}

scenario("customer update") {
def changedLastName = "NLN"
http.put(customer.url, [*:customerPayload, lastName: changedLastName]) {
lastName.should == changedLastName
}

http.get(customer.url) {
lastName.should == changedLastName
}
}
@@ -0,0 +1,4 @@
url = "http://localhost:8080"

docPath = "doc-artifacts"
openApiSpecUrl = "scenarios/rest/api-spec.json"
@@ -93,13 +93,23 @@ class WebTauRestFeaturesTest {

@Test
void "crud"() {
runCli('springboot/customerCrud.groovy', 'springboot/webtau.cfg', "--url=$customersBaseUrl")
runCli('springboot/customerCrud.groovy', 'springboot/webtau.cfg',
"--url=$customersBaseUrl",
'--reportPath=doc-artifacts/reports/webtau-report-crud.html')
}

@Test
void "crud separated"() {
runCli('springboot/customerCrudSeparated.groovy', 'springboot/webtau.cfg',
"--url=$customersBaseUrl", '--reportPath=webtau-report-crud-separated.html')
"--url=$customersBaseUrl",
'--reportPath=doc-artifacts/reports/webtau-report-crud-separated.html')
}

@Test
void "crud separated missing method"() {
runCli('springboot/customerCrudSeparatedMissingMethod.groovy', 'springboot/withSpec.cfg',
"--url=$customersBaseUrl",
'--reportPath=doc-artifacts/reports/webtau-report-crud-separated-missing-method.html')
}

@Test
@@ -0,0 +1,19 @@
{
"scenarioDetails" : [ {
"scenario" : "customer create",
"stepsSummary" : {
"numberOfSuccessful" : 3
}
}, {
"scenario" : "customer read",
"stepsSummary" : {
"numberOfSuccessful" : 4
}
}, {
"scenario" : "customer update",
"stepsSummary" : {
"numberOfSuccessful" : 8
}
} ],
"exitCode" : 0
}
@@ -0,0 +1,4 @@
{
"shapes" : [ ],
"pixelRatio" : 2
}
Binary file not shown.
@@ -0,0 +1,22 @@
{
"shapes" : [ {
"id" : "rectangle1",
"type" : "rectangle",
"text" : "",
"color" : "red",
"x" : 949,
"y" : 226,
"width" : 24,
"height" : 27
}, {
"id" : "rectangle2",
"type" : "rectangle",
"text" : "",
"color" : "red",
"x" : 523,
"y" : 192,
"width" : 319,
"height" : 16
} ],
"pixelRatio" : 2
}
Binary file not shown.
@@ -0,0 +1,22 @@
{
"shapes" : [ {
"id" : "rectangle1",
"type" : "rectangle",
"text" : "",
"color" : "red",
"x" : 949,
"y" : 226,
"width" : 24,
"height" : 27
}, {
"id" : "rectangle2",
"type" : "rectangle",
"text" : "",
"color" : "red",
"x" : 523,
"y" : 192,
"width" : 319,
"height" : 16
} ],
"pixelRatio" : 2
}
Binary file not shown.
@@ -0,0 +1,4 @@
{
"shapes" : [ ],
"pixelRatio" : 2
}
Binary file not shown.
@@ -0,0 +1,4 @@
{
"shapes" : [ ],
"pixelRatio" : 2
}
Binary file not shown.
@@ -1,8 +1,12 @@
package pages


import static com.twosigma.webtau.WebTauDsl.*

class Report {
def fullScreenIcon = $(".fullscreen-icon")
def collapsedHeader = $(".collapsed-http-header")

def open(String reportName) {
browser.open(ReportLocation.fullUrl(reportName))
}
@@ -12,4 +16,14 @@ class Report {
navEntry.waitTo beVisible()
navEntry.click()
}

def selectHttpCalls() {
$(".tab-selection .tab-name").get('HTTP calls').click()
}

def expandHttpCall(number) {
def httpCalls = $(".test-http-call")
httpCalls.waitTo beVisible()
httpCalls.get(number).find(".collapse-toggle").click()
}
}
@@ -10,6 +10,8 @@ class ReportLocation {
.resolve('..')
.resolve('..')
.resolve('webtau-feature-testing')
.resolve('doc-artifacts')
.resolve('reports')
.resolve(reportName).toAbsolutePath()
}
}
@@ -0,0 +1,14 @@
package scenarios

import static com.twosigma.webtau.WebTauGroovyDsl.*
import static pages.Pages.*

scenario('http calls') {
report.open('webtau-report-crud.html')
report.selectTest('CRUD operations for customer')

report.selectHttpCalls()
report.expandHttpCall(2)

browser.doc.capture('report-crud-http-calls')
}
@@ -0,0 +1,27 @@
package scenarios

import static com.twosigma.webtau.WebTauGroovyDsl.*
import static pages.Pages.*

scenario('summary view') {
report.open('webtau-report-crud-separated-missing-method.html')
browser.doc.capture('report-summary')
}

scenario('customer update test summary') {
report.selectTest('customer update')
browser.doc.capture('report-test-summary')
}

scenario('customer update http calls') {
report.open('webtau-report-crud-separated.html')
report.selectTest('customer update')

report.selectHttpCalls()
report.expandHttpCall(2)

browser.doc.withAnnotations(
browser.doc.highlighter(report.fullScreenIcon),
browser.doc.highlighter(report.collapsedHeader))
.capture('report-crud-separated-http-calls')
}

This file was deleted.

Oops, something went wrong.
@@ -1,3 +1,3 @@
docPath = 'doc-artifacts'
docPath = 'doc-artifacts/reports'
windowWidth = 1200
windowHeight = 720
windowHeight = 920

0 comments on commit 9fd1b7f

Please sign in to comment.
You can’t perform that action at this time.