This is a tool for generate rest API tests.
The tool consists of generating calls to rest services with values generated by the tool and checking if the HTTP code returned is expected.
The user can define some contract rules that the API must obey, eg code 1, these rules helped the tool's data generation.
The tool generates a set of 5 values for each service parameter, and then generates a Cartesian plan for those parameters to use in a rest call to the API. So if an endpoint has two parameters, it generates 5 values for each parameter and then executes 25 calls on that endpoint with the possible combinations.
After that he checks if the return was expected, always considering the rules that were defined.
It is important to note that the values generated are not completely random, the values defined in the rules will always be part of the set generated for that field. For example if I define that the service should return 400 when a parameter 'level' is greater than 100, at least one of the 5 values generated will be greater than 100.
Download the jar
@Test
open fun generateRandomTestWithSpecifPool() {
// Config endpoint
val endpoint = Endpoint(
url = "https://restcountries-v1.p.rapidapi.com/alpha/",
method = HttpMethod.GET
)
// Config params
endpoint.addParam(Param.query("codes", pool = "br, ar, us, col, ger, rus, can, esp, it, par, uru"))
.addParam(Param.header("X-RapidAPI-Key", pool = "e32bcdbb08msh727433a443862bap1cc32ajsn3bac0c915139"))
// Config Rules
val testConfig = TestConfig(endpoint = endpoint)
.addRule("codes=aaa", 404)
// Generate and execute Tests
Assertions.assertTrue(testConfigService.itsAllCorrect(testConfig))
}