Gradle non-deterministically skips many tests - gradle

I'm in the process of migrating a Java project from Gradle 4.4 to Gradle 7.5. Most of this seems to be under control. However, there's one very serious problem:
The project has 692 unit tests (all using JUnit; we're using JUnit 4.13.2). When I run gradle test with 7.5, however, only about 500 tests run. To be specific, it's a number that fluctuates between 527 and 529 tests.
Does anyone have any suggestions about how I troubleshoot this issue? Is it some kind of version compatibility problem? I would have put in the content of the build file, screen output, etc., but honestly, with this kind of problem I simply have no idea what kinds of diagnostics from me would be helpful!
Thanks.

Related

Running into ArrayIndexOutOfBoundsException issues with PMD

I am trying to build a spring-boot project with pmd integrated in gradle and running into ArrayIndexOutOfBoundsException for lot of test cases. Even when I run single test case in debug mode to understand where I am hitting ArrayIndexOutOfBoundsException, by default it is throwing ArrayIndexOutOfBoundsException even before jumping into the class. I am assuming this is due some config or version mismatch or due to missing plugins. can someone please help me what could be the causes for this ? I am using below versions
Jacoco: 0.8.8, pmd: 6.5.4

Slow Gradle build times after migration to Java 11

I have a large project with quite a few Gradle modules (around 90+) and we're seeing some strange build behaviour - especially after migrating to a Java 11 build (from Java 8).
Specifically our test execution times are... wonky.
Running the test target for the entire project this module takes 4min 55s to executes the tests.
Running the test target for a single module on its own it merely takes 1min 15s for the exact same tests with the same results.
Note: Before these both Gradle tests a clean on the entire project had been executed. These times are reproducible with minor time differences.
As a reference: running the tests for the module in IntelliJ I'm at 1min 18s.
I have played around with maxParallelForks and forkEvery, but I did not notice any significant changes.
I'm at a loss to what I could try and would appreciate any ideas and suggestions.

Intellij: Need a way to speed up gradle import and build process

I have a Java microservices project with 37 different modules (and growing). Whenever my versions change, Intellij reimports the Gradle build info and rebuilds all of them, including downloading the dependencies. This takes almost TWO hours! What can be done to speed this up?
I gave the compiler 3g of RAM hoping that would help, but the difference is minimal. Are there any other settings I can tweak?
Just wanted to add that I'm on a 64-bit, 6 core box, so I should certainly be able to build faster than this.

How to break up Jenkins Testing

Background
I am currently in the process of writing test scripts in Java with Testng, Maven, selenium and Jenkins. I have a plan to write hundreds of scripts. At this current time I have about 80 scripts written. Only 8 scripts have been uploaded to Bitbucket. Note that each script can have anywhere between 5-25 tests in it based on complexity, for example the 8 scripts currently on the server run 100 tests.
Problem
The issue I can see arising here very very quickly is that a huge amount of test scripts running.Jenkins runs the entire Maven project that sits on Bitbucket. Currently with only 8 scripts Jenkins takes a total of 20 mins to run. By the time I have the more complex ones up this could take hours to run even days with all of the scripts I plan on uploading.
Research
So far I've looked around for some way to break up the testing process so for instance I would have separate Maven projects in my Bitbucket repository for different areas. Then I would have several different builds on Jenkins one for each area of the site. I'm not sure how that would work though since Jenkins seems to just go in and read all of the tests on my repo.
I'm almost certain that having all of the tests in a single build is bad practice but I just cant find information on how to handle a huge test suit, I'm hoping someone with real experience can clarify this for me.
Software
Added as a side note in-case anyone wants to know what I'm using
Maven: 3.3.3
Java: 1.7.0_79
Selenium: 2.46 & 2.47(currently 2.47)
Jenkins: 1.622
Conclusion
I believe there must be a way of breaking the test suit up without having separate bit-bucket repos for each section.
One possible solution is using selenium grid. This will allow you to distribute tests over several vm's. Its fairly well documented.

Adding Report watching makes the Ant tests really slow

We are using TeamCity 6.0.2 and have a build configuration that runs SoapUI tests. The tests themselves run in approx. 45 seconds when running in command line.
To see the results of the test, we use Ant JUNit report watcher with this Report paths value:
TestSoapUI\SoapUI-testresults\TEST-*.xml
And then the tests are taking up to 15 minutes, with a CPU at 100%.
What can we do to reduce this time? Other report path? Separate the test step from the report step?
(We also filed an issue to JetBrains, if you're interested:
http://youtrack.jetbrains.net/issue/TW-16404)
The issue was solved by the JetBrains team:
http://youtrack.jetbrains.net/issue/TW-16404
Upgrade to TeamCity 6.0.3 if you have the same problem.

Resources