STAMP-project / test-runner

test driver to run JUnit tests isolated in a new JVM
GNU General Public License v3.0
16 stars 15 forks source link

Parallelize coverage analysis in CoveredTestResultPerTestMethod #112

Closed andre15silva closed 3 years ago

andre15silva commented 3 years ago

Running the jacoco analyzer is an expensive operation.

Unfortunately, jacoco doesn't provide a way of doing an analysis of several executions at once, which is why test-runner needs to analyze them separately.

This PR introduces parallelism in that stage, moving analysis from the end of each test case to the end of the entire test suite and running it inside of a parallel stream.

Running flacoco with this modification on math70 on my PC (4 cores) reduced the execution time by around 40%.

coveralls commented 3 years ago

Pull Request Test Coverage Report for Build 1100800272


Changes Missing Coverage Covered Lines Changed/Added Lines %
src/main/java/eu/stamp_project/testrunner/listener/utils/ListenerUtils.java 8 9 88.89%
src/main/java/eu/stamp_project/testrunner/runner/coverage/JUnit5JacocoRunnerPerTestMethod.java 0 1 0.0%
src/main/java/eu/stamp_project/testrunner/listener/junit5/CoveragePerJUnit5TestMethod.java 0 5 0.0%
<!-- Total: 46 53 86.79% -->
Files with Coverage Reduction New Missed Lines %
src/main/java/eu/stamp_project/testrunner/listener/impl/CoveragePerTestMethodImpl.java 1 84.0%
src/main/java/eu/stamp_project/testrunner/listener/junit5/CoveragePerJUnit5TestMethod.java 1 0%
src/main/java/eu/stamp_project/testrunner/runner/coverage/JUnit5JacocoRunnerPerTestMethod.java 1 0%
src/main/java/eu/stamp_project/testrunner/listener/impl/CoveredTestResultPerTestMethodImpl.java 2 73.75%
<!-- Total: 5 -->
Totals Coverage Status
Change from base Build 1044521416: 0.6%
Covered Lines: 1086
Relevant Lines: 2392

💛 - Coveralls
andre15silva commented 3 years ago

Hi @danglotb ,

Yes, for sure. I moved the cloning into an Utils class, but not the insertion since they are different implementation classes.