|
85 | 85 | </div><section style="max-width: 640px; margin-left: auto; margin-right: auto;"> |
86 | 86 | <article> |
87 | 87 | <header><h1>Additional Reports</h1></header> |
88 | | -<p>To generate a report/custom-reports custom report 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.reporter.WebTauReport import org.testingisdocumenting.webtau.utils.JsonUtils import static org.testingisdocumenting.webtau.WebTauDsl.cfg class Report { static void generateReport(WebTauReport report) { def additionalData = [:] report.customDataStream.each { additionalData.putAll(it.toMap()) } 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" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "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" : 7.0, "min" : 7, "max" : 7, "count" : 1, "p95" : 7.0, "p99" : 7.0 } } ], "graphQLCoveredSuccessBranches" : [ { "name" : "weather", "type" : "query" } ], "graphQLSkippedSuccessBranches" : [ { "name" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "name" : "complete", "type" : "mutation" } ], "graphQLCoveredErrorBranches" : [ ], "graphQLSkippedErrorBranches" : [ { "name" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" }, { "name" : "weather", "type" : "query" }, { "name" : "uncomplete", "type" : "mutation" }, { "name" : "complete", "type" : "mutation" } ] } Coverage and Timing Statistics 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</p> |
| 88 | +<p>To generate a report/custom-reports custom report 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.reporter.WebTauReport import org.testingisdocumenting.webtau.utils.JsonUtils import static org.testingisdocumenting.webtau.WebTauDsl.cfg class Report { static void generateReport(WebTauReport report) { def additionalData = [:] report.customDataStream.each { additionalData.putAll(it.toMap()) } 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" : "uncomplete", "type" : "mutation" }, { "name" : "complete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" } ], "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" : 5.0, "min" : 5, "max" : 5, "count" : 1, "p95" : 5.0, "p99" : 5.0 } } ], "graphQLCoveredSuccessBranches" : [ { "name" : "weather", "type" : "query" } ], "graphQLSkippedSuccessBranches" : [ { "name" : "uncomplete", "type" : "mutation" }, { "name" : "complete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" } ], "graphQLCoveredErrorBranches" : [ ], "graphQLSkippedErrorBranches" : [ { "name" : "uncomplete", "type" : "mutation" }, { "name" : "complete", "type" : "mutation" }, { "name" : "taskById", "type" : "query" }, { "name" : "allTasks", "type" : "query" }, { "name" : "weather", "type" : "query" } ] } Coverage and Timing Statistics 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</p> |
89 | 89 | </article> |
90 | 90 | </section> |
91 | 91 | </div> |
|
175 | 175 | } ] |
176 | 176 | }, { |
177 | 177 | "lang" : "json", |
178 | | - "snippet" : "{\n \"graphQLSkippedQueries\" : [ {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n } ],\n \"graphQLCoveredQueries\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n } ],\n \"graphQLCoverageSummary\" : {\n \"coverage\" : 0.2,\n \"branchCoverage\" : 0.1,\n \"types\" : {\n \"mutation\" : {\n \"coverage\" : 0.0,\n \"declaredQueries\" : 2,\n \"coveredQueries\" : 0.0\n },\n \"query\" : {\n \"coverage\" : 0.3333333333333333,\n \"declaredQueries\" : 3,\n \"coveredQueries\" : 1.0\n }\n },\n \"successBranchCoverage\" : 0.2,\n \"errorBranchCoverage\" : 0.0,\n \"totalDeclaredQueries\" : 5.0,\n \"totalCoveredQueries\" : 1.0\n },\n \"graphQLQueryTimeStatistics\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\",\n \"statistics\" : {\n \"mean\" : 7.0,\n \"min\" : 7,\n \"max\" : 7,\n \"count\" : 1,\n \"p95\" : 7.0,\n \"p99\" : 7.0\n }\n } ],\n \"graphQLCoveredSuccessBranches\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n } ],\n \"graphQLSkippedSuccessBranches\" : [ {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n } ],\n \"graphQLCoveredErrorBranches\" : [ ],\n \"graphQLSkippedErrorBranches\" : [ {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n } ]\n}", |
| 178 | + "snippet" : "{\n \"graphQLSkippedQueries\" : [ {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n } ],\n \"graphQLCoveredQueries\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n } ],\n \"graphQLCoverageSummary\" : {\n \"coverage\" : 0.2,\n \"branchCoverage\" : 0.1,\n \"types\" : {\n \"mutation\" : {\n \"coverage\" : 0.0,\n \"declaredQueries\" : 2,\n \"coveredQueries\" : 0.0\n },\n \"query\" : {\n \"coverage\" : 0.3333333333333333,\n \"declaredQueries\" : 3,\n \"coveredQueries\" : 1.0\n }\n },\n \"successBranchCoverage\" : 0.2,\n \"errorBranchCoverage\" : 0.0,\n \"totalDeclaredQueries\" : 5.0,\n \"totalCoveredQueries\" : 1.0\n },\n \"graphQLQueryTimeStatistics\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\",\n \"statistics\" : {\n \"mean\" : 5.0,\n \"min\" : 5,\n \"max\" : 5,\n \"count\" : 1,\n \"p95\" : 5.0,\n \"p99\" : 5.0\n }\n } ],\n \"graphQLCoveredSuccessBranches\" : [ {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n } ],\n \"graphQLSkippedSuccessBranches\" : [ {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n } ],\n \"graphQLCoveredErrorBranches\" : [ ],\n \"graphQLSkippedErrorBranches\" : [ {\n \"name\" : \"uncomplete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"complete\",\n \"type\" : \"mutation\"\n }, {\n \"name\" : \"taskById\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"allTasks\",\n \"type\" : \"query\"\n }, {\n \"name\" : \"weather\",\n \"type\" : \"query\"\n } ]\n}", |
179 | 179 | "title" : "webtau.graphql-report.json", |
180 | 180 | "anchorId" : "additional-reports-webtau-graphql-report-json", |
181 | 181 | "type" : "Snippet" |
|
220 | 220 | } ] |
221 | 221 | } ] |
222 | 222 | } ], |
223 | | - "lastModifiedTime" : 1704063222499, |
| 223 | + "lastModifiedTime" : 1718106797039, |
224 | 224 | "tocItem" : { |
225 | 225 | "chapterTitle" : "GraphQL", |
226 | 226 | "pageTitle" : "Report", |
227 | 227 | "pageMeta" : { }, |
228 | 228 | "dirName" : "GraphQL", |
229 | 229 | "fileName" : "report", |
| 230 | + "fileExtension" : "md", |
230 | 231 | "viewOnRelativePath" : null, |
231 | 232 | "pageSectionIdTitles" : [ { |
232 | 233 | "title" : "Additional Reports", |
|
0 commit comments