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.17k stars 74 forks source link

IllegalStateException when cats executes DELETE/GET requests with URL parameters and w/o requested body #122

Closed AbdulinRuslan closed 5 months ago

AbdulinRuslan commented 5 months ago

Describe the bug

Here's my scheme

To Reproduce Steps to reproduce the behaviour:

  1. Run cats --contract=fastapi.json --server=http://127.0.0.1:8000 --httpMethods=DELETE

Expected behaviour I expect cats will successfully create and execute tests for DELETE/GET /users/{user_uid} endpoints.

Environment: Key Value
OS Name Mac OS X
OS Version 14.3.1
OS Arch aarch64
Binary Type native
Cats Version 11.4.0
Cats Build 2024-04-03T17:31:02Z
Term Width 204
Term Type xterm-256color
Shell /bin/zsh

Additional context It works good for PUT, but the difference between PUT and GET/DELETE is only the requested body

AbdulinRuslan commented 5 months ago

I've forgot about the ouptut

java.lang.IllegalStateException: OpenAPI spec is missing definition for user_id at com.endava.cats.fuzzer.http.RandomResourcesFuzzer.fuzzNonBodyMethods(RandomResourcesFuzzer.java:109) at com.endava.cats.fuzzer.http.RandomResourcesFuzzer.fuzz(RandomResourcesFuzzer.java:63) at com.endava.cats.command.CatsCommand.lambda$runFuzzers$7(CatsCommand.java:412) at java.base@22/java.util.ArrayList.forEach(ArrayList.java:1597) at com.endava.cats.command.CatsCommand.runFuzzers(CatsCommand.java:408) at com.endava.cats.command.CatsCommand.fuzzPath(CatsCommand.java:385) at com.endava.cats.command.CatsCommand.startFuzzing(CatsCommand.java:299) at com.endava.cats.command.CatsCommand.doLogic(CatsCommand.java:231) at com.endava.cats.command.CatsCommand.run(CatsCommand.java:181) 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:41) 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) at java.base@22/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

en-milie commented 5 months ago

Hi @AbdulinRuslan. Thank you for taking the time to report this bug. It's fixed now.