Open dtk72 opened 1 year ago
Hey! Could you please provide the full call stack for the error?
Hi! For sure,
java.lang.NullPointerException: Cannot invoke "java.nio.file.attribute.FileTime.toInstant()" because "this.minResultTime" is null
at com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder.GenerationStatisticsBuilder.build([GenerationStatisticsBuilder.java:60]
at com.github.viclovsky.swagger.coverage.core.generator.Generator.lambda$run$1([Generator.java:49]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept([ForEachOps.java:183]
at java.base/java.util.stream.ReferencePipeline$2$1.accept([ReferencePipeline.java:179]
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining([ArrayList.java:1625]
at java.base/java.util.stream.AbstractPipeline.copyInto([AbstractPipeline.java:484]
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto([AbstractPipeline.java:474]
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential([ForEachOps.java:150]
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential([ForEachOps.java:173]
at java.base/java.util.stream.AbstractPipeline.evaluate([AbstractPipeline.java:234]
at java.base/java.util.stream.ReferencePipeline.forEach([ReferencePipeline.java:596]
at com.github.viclovsky.swagger.coverage.core.generator.Generator.run([Generator.java:48]
at com.github.viclovsky.swagger.coverage.karate.SwaggerCoverageRunner$SwaggerCoverageBuilder.generateReport([SwaggerCoverageRunner.java:126]
at com.github.viclovsky.swagger.coverage.karate.SwaggerCoverageRunner$SwaggerCoverageBuilder.parallel([SwaggerCoverageRunner.java:163]
at TestRunner.testAll([TestRunner.java:16]
at java.base/java.util.ArrayList.forEach([ArrayList.java:1511]
at java.base/java.util.ArrayList.forEach([ArrayList.java:1511]
Hey, sorry for the late response, I'm super busy atm. I had a quick look at it, and I think I know what could be going on. Can you maybe share the log file?
Hi, I've recently bumped into this same issue and would really like to try this module to check swagger coverage with Karate. Do you have any updates on this? Thank you!
Hey guys, sorry I haven't gotten back to you on this issue. Can you also provide me with your log4j.log file and ideally a small reproduction project? I will try to take a look at this asap!
Hi, sorry I hadn't come back to this issue. I managed to prepare a small reproduction project (which I've attached), but wasn't able at first to get the error above.
I was finally able to reproduce the null pointer exception, but only if I change protocol to https in karate-config.js when the proxy is used (which is wrong):
if (karate.properties['proxy.port']){ console.log("Proxy server is used"); protocol = "https"; }
My main problem, though, is I'm not able to run tests using the proxy with https endpoints. I tried the workaround described here:
but with no success. Is it possible to work with https while using the proxy to measure swagger coverage?
Thanks again! myproject.zip
I 've got the same error and same stack than the one from @dtk72 when i upgrade version of karate 1.4.1 and other libraries:
Update karate version to 1.4.1
Update jackson to 2.5.13 to be compatible
Update other libraries:
- armeria 1.26.4
- classgraph 4.8.165
- netty 4.1.104
- thymeleaf 3.1.2.RELEASE
- wiremock 2.27.2
https://github.com/tdeverdiere/swagger-coverage/tree/update-karate
Error : "java.lang.NullPointerException: Cannot invoke "java.nio.file.attribute.FileTime.toInstant()" because "this.minResultTime" is null"
I got same issue, karate version is 1.4.0, swagger-coverage version is 1.5.0
Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.nio.file.attribute.FileTime.toInstant()" because "this.minResultTime" is null
at com.github.viclovsky.swagger.coverage.core.results.builder.prebuilder.GenerationStatisticsBuilder.build(GenerationStatisticsBuilder.java:60)
at com.github.viclovsky.swagger.coverage.core.generator.Generator.lambda$run$1(Generator.java:49)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
at com.github.viclovsky.swagger.coverage.core.generator.Generator.run(Generator.java:48)
at com.github.viclovsky.swagger.coverage.CommandLine.run(CommandLine.java:77)
at java.base/java.util.Optional.orElseGet(Optional.java:362)
at com.github.viclovsky.swagger.coverage.CommandLine.main(CommandLine.java:34)
I 've got the same error and same stack than the one from @dtk72 when i upgrade version of karate 1.4.1 and other libraries:
Update karate version to 1.4.1 Update jackson to 2.5.13 to be compatible Update other libraries: - armeria 1.26.4 - classgraph 4.8.165 - netty 4.1.104 - thymeleaf 3.1.2.RELEASE - wiremock 2.27.2
https://github.com/tdeverdiere/swagger-coverage/tree/update-karate
Error : "java.lang.NullPointerException: Cannot invoke "java.nio.file.attribute.FileTime.toInstant()" because "this.minResultTime" is null"
Is the issue fixed on your side?
Hello No so i created an implementation of a Karate RuntimeHook: SwaggerCoverageRuntimeHook And use it in the Runner configuration:
Results results = Runner.path("classpath:...")
.outputCucumberJson(true)
.outputJunitXml(true)
.hook(new SwaggerCoverageRuntimeHook("target", "target/test-classes/swagger-coverage-config.json"))
.reportDir(karateOutputPath)
.parallel(1);
To write SwaggerCoverageRuntimeHook i mostly use the code from swagger-coverage-karate: SwaggerCoverageRunner#generateReport And i copy also the all class Generator from swagger-coverage-commandline/src/main/java/com/github/viclovsky/swagger/coverage/core/generator/Generator.java
I could give you the all code in my repo if you want
This looks like related to https://github.com/karatelabs/karate/issues/2048
can you share repo @tdeverdiere
@tdeverdiere can you share the repo or provide any pointers on how to integrate this tool into Karate Runner? Thanks
I'm submitting a ...
Error when running
mvn clean test
java.lang.NullPointerException: Cannot invoke "java.nio.file.attribute.FileTime.toInstant()" because "this.minResultTime" is null
If the current behavior is a bug, please provide steps to reproduce, broken swagger specification and swagger-coverage-output:
Followed this code example provided in the README to generate a swagger coverage report after running karate tests for my own API:
The error seems to arise when the code reaches .parallel(1)
Other information