WebFuzzing / EvoMaster

The first open-source AI-driven tool for automatically generating system-level test cases (also known as fuzzing) for web/enterprise applications. Currently targeting whitebox and blackbox testing of Web APIs, like REST, GraphQL and RPC (e.g., gRPC and Thrift).
GNU Lesser General Public License v3.0
454 stars 77 forks source link

Why is this test generated in EvoMaster_fault_representatives_Test.java #985

Open aruvic opened 1 month ago

aruvic commented 1 month ago

Hi,

Please, can you explain me why following test is generated by EvoMaster in file: EvoMaster_fault_representatives_Test.java

    @Test @Timeout(60)
    public void test_1() throws Exception {
        List<InsertionDto> insertions = sql().insertInto("MY_ENTITY", 3525L)
                .d("CREATION_DATE", "NULL")
                .d("DESCRIPTION", "NULL")
                .d("NAME", "\"gOFnxwrzB20w\"")
                .d("ROLE", "\"eNmP1rmXiaup\"")
                .d("STATUS", "\"\"")
            .dtos();
        InsertionResultsDto insertionsresult = controller.execInsertionsIntoDatabase(insertions);
        ExpectationHandler expectationHandler = expectationHandler();

        ValidatableResponse res_0 = given().accept("*/*")
                .header("x-EMextraHeader123", "_EM_982_XYZ_")
                .contentType("application/json")
                .body(" { " + 
                    " \"id\": 1, " + 
                    " \"description\": \"FsXh2mxjt\", " + 
                    " \"status\": \"UayT47OFx0Xfx\", " + 
                    " \"relatedParty\": {} " + 
                    " } ")
                .put(baseUrlOfSut + "/api/myentity/1?" + 
                    "EMextraParam123=_EM_981_XYZ_&" + 
                    "fields=sHL4")
                .then()
                .statusCode(200)
                .assertThat()
                .contentType("application/json")
                .body("'name'", nullValue())
                .body("'description'", containsString("FsXh2mxjt"))
                .body("'status'", containsString("UayT47OFx0Xfx"))
                .body("'creationDate'", nullValue())
                .body("'relatedParty'.'role'", nullValue());

        expectationHandler.expect(ems);
    }
arcuri82 commented 1 month ago

Hi @aruvic ,

thanks for reporting this bug. Indeed there would be no reason for why such a test should endup in fault_representatives group

aruvic commented 1 month ago

Indeed there would be no reason for why such a test should endup in fault_representatives group

That's what I thought as well. PUT is expected to perform full resource updates and PATCH for partial updates. In above example name is expected to be NULL after PUT where no name was provided.

Br, Alen