Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No BaseStepListener POST XX not registered, while iterating values in parallel stream and to result. #2870

Open
CuriousQA opened this issue Jul 15, 2022 · 1 comment

Comments

@CuriousQA
Copy link

CuriousQA commented Jul 15, 2022

My framework: Serenity with Cucumber

A step in a scenario gets the records from database, passes the DB result as input to API and validates API response against expected output. As the number of DB results are around 5k, my plan is to use Streams. However,
the following code(using Streams) is executed only for the main thread but not for the Fork commonPools. Is there any way that this gets executed and reported in Serenity or should we develop a custom logic based on that?

kindly share your thoughts and opinions

On other note, I have seen that for Serenity with JUnit5, we have annotations @testdata, @SerenityParameterizedRunner available. Please share if you are aware of anything similar to Cucumber framework.

result =DBResponse_In_LIST
result.parallelStream().map(x ->  {
            Response respToken = SerenityRest.given()
                    .pathParam("username", username)
                    .pathParam("password", password)
                    .when()
                    .post(authentication);
            String resToken = respToken .jsonPath().getJsonObject("token"); 
             Serenity.reportThat("call resToken : " + resToken ,
                    () -> Assertions.assertThat(resToken ).isEqualToIgnoringCase("ABCD")
            );
           return null;
    }).collect(Collectors.toList());

Output:

`17:25:52.038 [ForkJoinPool.commonPool-worker-4] INFO net.serenitybdd.rest.decorators.request.RequestSpecificationDecorated - No BaseStepListener, POST request4 not registered.

17:25:52.038 [ForkJoinPool.commonPool-worker-3] INFO net.serenitybdd.rest.decorators.request.RequestSpecificationDecorated - No BaseStepListener, POST request2 not registered.

17:25:52.038 [ForkJoinPool.commonPool-worker-2] INFO net.serenitybdd.rest.decorators.request.RequestSpecificationDecorated - No BaseStepListener, POST request3 not registered.`

Request1 gets executed in main thread and hence username and password are passed from step definition
Basically the request1, request2, request3 & request4 are same but with change in value that we get from Streams. Requests 2,3,4 which are executed using ForkJoinPool are thrown the not registered error. Username and password are not passed to these requests 2,3 &4.

also, The output is shown only for main thread execution but not for the ForkJoinPool.commonPool-worker-{1,2,3,4,5,6}

@wakaleo
Copy link
Member

wakaleo commented Aug 22, 2022

Possibly fixed in 3.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants