From c770f52b6502274056abe3f76a19f6dfff9214c6 Mon Sep 17 00:00:00 2001 From: arcuri82 Date: Fri, 25 Oct 2024 09:53:19 +0200 Subject: [PATCH] fixed E2E --- .../EndpointFocusAndPrefixTest.java | 9 ++++++--- .../hypermutation/AdaptiveHypermutationTest.java | 3 ++- .../openapi/v3/bodyundefined/BodyUndefinedEMTest.kt | 11 ++++++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/endpointfocusandprefix/EndpointFocusAndPrefixTest.java b/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/endpointfocusandprefix/EndpointFocusAndPrefixTest.java index 464186f423..26fc134b1a 100644 --- a/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/endpointfocusandprefix/EndpointFocusAndPrefixTest.java +++ b/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/endpointfocusandprefix/EndpointFocusAndPrefixTest.java @@ -163,6 +163,7 @@ public void testRunBlackboxWithFocusWithParameters() throws Throwable { args.add(baseUrlOfSut + "/v2/api-docs"); args.add("--endpointFocus"); args.add(endpointFocus); + setOption(args, "advancedBlackBoxCoverage", "false"); // no endpointFocus or endpointPrefix is provided Solution solution = initAndRun(args); @@ -174,7 +175,7 @@ public void testRunBlackboxWithFocusWithParameters() throws Throwable { assertAllSolutionsHavePathFocusOrPrefixList(solution, pathsToCheck, true); // The solution should include 4 solutions, 3 endpoints and 1 failure case - assertEquals(solution.getIndividuals().size(), 4); + assertEquals(4, solution.getIndividuals().size()); // write test into the output folder compile(outputFolder); @@ -283,6 +284,7 @@ public void testRunBlackboxWithPrefixWithParameters() throws Throwable { args.add(baseUrlOfSut + "/v2/api-docs"); args.add("--endpointPrefix"); args.add(endpointPrefix); + setOption(args, "advancedBlackBoxCoverage", "false"); // no endpointFocus or endpointPrefix is provided Solution solution = initAndRun(args); @@ -294,7 +296,7 @@ public void testRunBlackboxWithPrefixWithParameters() throws Throwable { assertAllSolutionsHavePathFocusOrPrefixList(solution, pathsToCheck, false); // The solution should include 5 solutions, 4 endpoints and 1 failure case - assertEquals(solution.getIndividuals().size(), 5); + assertEquals(5, solution.getIndividuals().size()); // write test into the output folder compile(outputFolder); @@ -323,6 +325,7 @@ public void testRunBlackboxPrefixNonExistingFocusValidPrefix() throws Throwable args.add(baseUrlOfSut + "/v2/api-docs"); args.add("--endpointPrefix"); args.add(endpointPrefix); + setOption(args, "advancedBlackBoxCoverage", "false"); // no endpointFocus or endpointPrefix is provided Solution solution = initAndRun(args); @@ -334,7 +337,7 @@ public void testRunBlackboxPrefixNonExistingFocusValidPrefix() throws Throwable assertAllSolutionsHavePathFocusOrPrefixList(solution, pathsToCheck, false); // The solution should include 5 solutions, 4 endpoints and 1 failure case - assertEquals(solution.getIndividuals().size(), 5); + assertEquals(5, solution.getIndividuals().size()); // write test into the output folder compile(outputFolder); diff --git a/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/hypermutation/AdaptiveHypermutationTest.java b/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/hypermutation/AdaptiveHypermutationTest.java index 94b8a1daf0..e08e3b4e29 100644 --- a/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/hypermutation/AdaptiveHypermutationTest.java +++ b/e2e-tests/spring-rest-openapi-v2/src/test/java/org/evomaster/e2etests/spring/examples/hypermutation/AdaptiveHypermutationTest.java @@ -48,7 +48,8 @@ public void testRunAdaptiveHypermutation() throws Throwable { //minimization loses impact info args.add("--minimize"); args.add("false"); - + //this had side-effects + setOption(args, "advancedBlackBoxCoverage", "false"); Solution solution = initAndRun(args); diff --git a/e2e-tests/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/bodyundefined/BodyUndefinedEMTest.kt b/e2e-tests/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/bodyundefined/BodyUndefinedEMTest.kt index f8de61f8b0..936787d1ac 100644 --- a/e2e-tests/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/bodyundefined/BodyUndefinedEMTest.kt +++ b/e2e-tests/spring-rest-openapi-v3/src/test/kotlin/org/evomaster/e2etests/spring/openapi/v3/bodyundefined/BodyUndefinedEMTest.kt @@ -25,6 +25,9 @@ class BodyUndefinedEMTest : SpringTestBase() { 20 ) { args: MutableList -> + //TODO remove once fixed issue + setOption(args, "advancedBlackBoxCoverage", "false") + val solution = initAndRun(args) Assertions.assertTrue(solution.individuals.size >= 1) @@ -35,7 +38,13 @@ class BodyUndefinedEMTest : SpringTestBase() { There is some weird bug in Jersey that it looks like it transform the GET into a POST ?!? When we upgrade Jersey (once moving ot JDK 11), need to fix AbstractRestFitness and RestActionBuilderV3. Then, we will need to check if this fails, and if so, change - into a 400 and 200 instead of 415 + into a 400 and 200 instead of 415. + + Even more weird, need to deactivate advancedBB coverage, otherwise generated tests + add a .body(" {} ") to the GET. + in Jersey, this still give a 415, but then a different code in RestAssured when compiled + tests are executed... WTF!!! + TODO look into this once upgraded Jersey */ assertHasAtLeastOne(solution, HttpVerb.GET, 415, "/api/bodyundefined", null) }