Endava / cats

CATS is a REST API Fuzzer and negative testing tool for OpenAPI endpoints. CATS automatically generates, runs and reports tests with minimum configuration and no coding effort. Tests are self-healing and do not require maintenance.
Apache License 2.0
1.2k stars 73 forks source link

NullPointerException when traing to run app #103

Closed qarmin closed 8 months ago

qarmin commented 9 months ago

Describe the bug When trying to run command

./cats --server=http://localhost:5000 --contract=/home/rafal/Pobrane/openapi.json -b  -k -f DefaultValuesInFields,EmptyStringsInFields,ExamplesFields,IterateThroughEnumValuesFields

I got this null pointer exception

java.lang.NullPointerException
    at com.endava.cats.args.FilterArguments.matchWildCardPaths(FilterArguments.java:472)
    at com.endava.cats.args.FilterArguments.matchSuppliedPathsWithContractPaths(FilterArguments.java:451)
    at com.endava.cats.args.FilterArguments.getPathsToRun(FilterArguments.java:438)
    at com.endava.cats.command.CatsCommand.printConfiguration(CatsCommand.java:330)
    at com.endava.cats.command.CatsCommand.doLogic(CatsCommand.java:224)
    at com.endava.cats.command.CatsCommand.run(CatsCommand.java:178)
    at picocli.CommandLine.executeUserObject(CommandLine.java:2026)
    at picocli.CommandLine.access$1500(CommandLine.java:148)
    at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
    at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
    at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
    at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
    at picocli.CommandLine.execute(CommandLine.java:2170)
    at com.endava.cats.CatsMain.run(CatsMain.java:42)
    at com.endava.cats.CatsMain_ClientProxy.run(Unknown Source)
    at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
    at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
    at io.quarkus.runner.GeneratedMain.main(Unknown Source)

I cannot provide openapi file to test

Environment:

Key           | Value
------------- | --------------------
OS Name       | Linux
OS Version    | 6.5.0-21-generic
OS Arch       | amd64
Binary Type   | native
Cats Version  | 11.0.0
Cats Build    | 2024-02-18T19:01:38Z
Term Width    | 79
Term Type     | xterm-256color
Shell         | /bin/bash
en-milie commented 9 months ago

Can you please rerun with --verbosity DETAILED --debug. The nullpointer is caused by this line: Set<String> allContractPaths = openAPI.getPaths().keySet(); which suggests that the OpenAPI specs were not properly parsed.

qarmin commented 9 months ago

I now noticed that in the script I am downloading openapi from an incorrect address, so openapi.json is empty and shows this error

en-milie commented 8 months ago

I'll close this one.