-
-
Notifications
You must be signed in to change notification settings - Fork 513
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
Test-cases using serenity.batch commands are not being split up #2199
Comments
This would be a question for @nbarrett. |
Okay @timothyjmtan, here are some thoughts...
Hope this helps! |
Hello @nbarrett, thanks for the in-depth suggestions! Just some updates:
So it seems to be that there is something iffy with the batch allocation of the tests. Are there are any lower-level logs which I can access to see where the issue may be at? From where I currently stand, I'm not entirely sure if it is a maven or serenity issue... |
Hi again @timothyjmtan - well it does seem like you are being very methodical in your approach and doing all the right things. I now recall that I did have a very similar problem to you and raised #736 but ended up resolving it by fixing the maven plugin configuration as described in this note. Around this time, I started work on a batch refactoring PR which included:
However due to resolving my problem, there was no need at the time to make fixes changes to serenity. I think it might be a good idea if I bring this up to date and then submit it, then hopefully the logging will be available in the core product. What does that sound like? |
Hello @nbarrett , yes I suppose that would be extremely useful for anyone who is running into issues using the batching functionality! Just curious, is it a must to include the |
I've never personally used any of those parameters, it should work with just the two we've already discussed. Okay will try and get that PR submitted later on 👍 |
I've got one last thought.... when you mention the 4 tests in your diagnosis, how are they allocated? For instance are there 4 |
Howdy @nbarrett, after digging through the code, I think I have found the issue. Based on my understanding of how the batching works within the BatchManager:
What I've noticed is that in my code, before any test-case is actually 'executed', the batch manager is parsing through every single test-case, and doing the With an example, my code is currently giving the following values: Number of test-cases: 4 TestCaseA.java --> expected: As such, batches 1-3 will always return 0 TCs to execute, and It is worth noting that I am actually using an older version of Serenity, i.e. |
Hi @timothyjmtan - great diagnostics and very similar to what I did when I was exploring back here in #736. The BatchManager implementations do rely on being executed in the same sequence and in such a way that the atomic integer increments gradually throughout the execution of the suite and is not reset between each test case. For some reason it seems that some people's configuration (yours included), causes these conditions to not occur resulting in incorrect batching behaviour. I did spend some time on the PR last night and cleaned things up quite a bit and added logging, but I didn't make any changes to the batching algorithm itself. My preference would be to implement the same approach for batching as has been done for Cucumber, namely using MultiRunTestStatistics, as this works really well. The challenge I've yet to resolve is that this algorithm needs to build a list of all tests in the suite before any tests are run. I just need to work out how to hook this point in the lifecycle reliably. I'll do some more work on this later on and hopefully get that in the PR as well. |
Hey @nbarrett , just to give another update. We've managed to pinpoint and resolve the issue. We're using a parent-child pom model in our project, and it turns out that the parent pom's
Commenting these out will allow the batching to be done correctly. However this gives us another issue where we are now not able to execute the tests within each batch in parallel (via forking). Is this a functionality that can be taken a look at and fixed? |
Why not check the code and see what it is doing? If it uses thread-local counters then parallel execution for a given batch will not work. |
@wakaleo Does not seems like forking or parallel threading runs would work. After that the BatchManager reads this file during integrationTest phases. This will probably be more deterministic but the logic and computation may take some time and i think it should be able to support forking/threading |
Yes, that kind of thing was what I had in mind. I'll try and finish my PR this weekend. |
Hello, I've just come across this problem. Has this been solved? |
Sorry @thePantz - I now recall I promised to complete my PR but didn't find time yet. Will try and do soon! |
Hello,
I am having some difficulties in running the JUnit test-cases in batches via the serenity.batch.count commands documented here:
Serenity Parallel Batches
My testing stack is as follows:
Jenkins -> Openshift pod (slave) -> AWS browser stack
Upon Jenkins job trigger, an openshift pod will spin up dynamically, and coordinate with the AWS stack to run the tests.
Expectation
By using serenity.batch.count=3, there should be 3 openshift pods spun up, and each will handle a test-suite corresponding to its batch number.
Observation
3 openshift pods spin up, and from console logs it is running the correct mvn command with the correct batch numbers:
Pod #1 -
mvn clean verify -Dserenity.batch.number=1 -Dserenity.batch.count=3
--> runs 0 test-casesPod #2 -
mvn clean verify -Dserenity.batch.number=2 -Dserenity.batch.count=3
--> runs 0 test-casesPod #3 -
mvn clean verify -Dserenity.batch.number=3 -Dserenity.batch.count=3
--> runs 200 test-casesHowever, 2 pods will execute 0 test-cases, and 1 pod will run the entire test-suite. This suggests that the splitting is not being handled properly somewhere.
No difference with the inclusion of the
serenity.batch.strategy
parameter.It has the same behaviour when executing on plain windows machines as well.
I don't reckon I need to set the following in
maven-failsafe-plugin
in pom.xml, as its for subdivisions within a test machine.Is there anywhere that I can take a look at to troubleshoot?
The text was updated successfully, but these errors were encountered: