Additional Reports

To generate custom reports or upload report data to your server, specify a reportGenerator config property. package scenarios.graphql url = "http://localhost:8180" graphQLIgnoreIntrospectionFailures = false reportGenerator = Report.&generateReport Where Report.&generateReport is implemented as follows: package scenarios.graphql import org.testingisdocumenting.webtau.console.ConsoleOutputs import org.testingisdocumenting.webtau.console.ansi.Color import org.testingisdocumenting.webtau.report.ReportDataProviders import org.testingisdocumenting.webtau.reporter.WebTauReport import org.testingisdocumenting.webtau.utils.JsonUtils import static org.testingisdocumenting.webtau.WebTauDsl.cfg class Report { static void generateReport(WebTauReport report) { def additionalData = [:] ReportDataProviders.provide(report.tests) .map { it.toMap() } .forEach { additionalData.putAll(it) } def reportData = [:] reportData.graphQLSkippedQueries = additionalData.graphQLSkippedQueries // All queries present in the GraphQL schema but not tested reportData.graphQLCoveredQueries = additionalData.graphQLCoveredQueries // All queries present in the GraphQL schema and tested reportData.graphQLCoverageSummary = additionalData.graphQLCoverageSummary // Summary of test coverage compared to the GraphQL schema reportData.graphQLQueryTimeStatistics = additionalData.graphQLQueryTimeStatistics // Summary of timing by query reportData.graphQLCoveredSuccessBranches = additionalData.graphQLCoveredSuccessBranches // All queries present in the GraphQL schema that were hit with a success result reportData.graphQLSkippedSuccessBranches = additionalData.graphQLSkippedSuccessBranches // All queries present in the GraphQL schema but not hit with a success result reportData.graphQLCoveredErrorBranches = additionalData.graphQLCoveredErrorBranches // All queries present in the GraphQL schema that were hit with an error result reportData.graphQLSkippedErrorBranches = additionalData.graphQLSkippedErrorBranches // All queries present in the GraphQL schema but not hit with an error result def reportPath = cfg.workingDir.resolve('webtau.graphql-report.json') ConsoleOutputs.out('generating report: ', Color.PURPLE, reportPath) reportPath.toFile().text = JsonUtils.serializePrettyPrint(reportData) } } The output looks as follows: { "graphQLSkippedQueries" : [ { "name" : "allTasks", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "complete", "type" : "mutation" } ], "graphQLCoveredQueries" : [ { "name" : "weather", "type" : "query" } ], "graphQLCoverageSummary" : { "coverage" : 0.2, "branchCoverage" : 0.1, "types" : { "mutation" : { "coverage" : 0.0, "declaredQueries" : 2, "coveredQueries" : 0.0 }, "query" : { "coverage" : 0.3333333333333333, "declaredQueries" : 3, "coveredQueries" : 1.0 } }, "successBranchCoverage" : 0.2, "errorBranchCoverage" : 0.0, "totalDeclaredQueries" : 5.0, "totalCoveredQueries" : 1.0 }, "graphQLQueryTimeStatistics" : [ { "name" : "weather", "type" : "query", "statistics" : { "mean" : 4.0, "min" : 4, "max" : 4, "count" : 1, "p95" : 4.0, "p99" : 4.0 } } ], "graphQLCoveredSuccessBranches" : [ { "name" : "weather", "type" : "query" } ], "graphQLSkippedSuccessBranches" : [ { "name" : "allTasks", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "complete", "type" : "mutation" } ], "graphQLCoveredErrorBranches" : [ ], "graphQLSkippedErrorBranches" : [ { "name" : "allTasks", "type" : "query" }, { "name" : "weather", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "complete", "type" : "mutation" } ] } Webtau will implicitly invoke your GraphQL server's introspection queries in order to fetch a subset of the schema. It uses this schema in conjunction with the requests in tests to compute:query coverage - which queries were invoked by tests and which were not as well as an overall summary of coverage timing information - http call timing statistics by query