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.11k stars 75 forks source link

Publishing of Maven release, enabling programmatic usage in Java #76

Closed adriansuarez closed 8 months ago

adriansuarez commented 10 months ago

Are there any plans to publish a Maven release and allow CATS to be used programmatically, e.g. for usage in JUnit tests in a Java project?

This would enable running CATS along with all other tests that are run in the integration-test phase when invoking mvn verify.

Currently if I want to run CATS as part of continuous integration, I have to download the binary using curl, invoke the server setup script that would normally be automatically invoked in the pre-integration-test phase by Maven, invoke cats, invoke the post-integration-test script to tear down the server, and finally interpret the results by inspecting the cats-report directory to find failed tests.

It would be a lot easier to code the actual test in Java with access to the CATS APIs, rather than in a Bash script, and the parts having to do with setting up and tearing down the server would automatically be handled by Maven assuming that the CATS test is discoverable in the integration-test phase (it would be if it is just a JUnit test named CatsIT or something, which is how the Failsafe Plugin discovers integration tests).

en-milie commented 10 months ago

Hi @adriansuarez. Sounds like a good proposal. I will pick it up in the upcoming weeks so that releases are also published in Maven central.

adriansuarez commented 10 months ago

@en-milie Excellent! Looking forward to this improvement.

en-milie commented 9 months ago

CATS is now available on Maven Central: https://central.sonatype.com/artifact/com.endava/cats

adriansuarez commented 9 months ago

@en-milie Thanks for jumping on this.

Unfortunately, I'm having issues using the Maven package. It looks like there there is a special dependency com.squareup.okhttp3:okhttp:4.10.0-CATS that is checked into version control and can't be resolved as a transitive dependency. Maybe it should be packaged into the CATS JAR and not appear as a dependency in the POM.

I tried working around that by putting in an exclusion and explicitly declaring the published com.squareup.okhttp3:okhttp:4.10.0 as a dependency, but then I ran into an issue with the io.github.ludovicianul:pretty-logger dependency, which is published in the GitHub Maven registry that requires authentication. I should be able to workaround that one by configuring GitHub credentials in Maven, but it would be ideal if that wasn't necessary.

en-milie commented 9 months ago

Indeed. I need to rethink this a bit to make it as easy as possible to use it as dependency.

en-milie commented 9 months ago

With 9.0.4 it should be much easier to use CATS as a maven dependency: https://github.com/Endava/cats#experimental-maven-dependency-for-programmatic-use

en-milie commented 8 months ago

Final solution will imply publishing the okhttp fork in Maven central so that all fuzzers will run successfully.