Amine Barrak
Amine Barrak

Reputation: 139

How to match number of Test run in maven log with source code?

I am trying to link the number of Test run founded on the log file in https://api.travis-ci.org/v3/job/29350712/log.txt of the project presto of facebook with the real test in source code. The source code linked to this run of the build is located in the following link: https://github.com/prestodb/presto/tree/bd6f5ff8076c3fdb2424406cb5a10f506c7bfbeb/presto-raptor/src/test/java/com/facebook/presto/raptor

I am computing the number of places where I encounter '@Test' in the source code then it should be the same number of Test run in the log file.

In most of cases it works. But there is some of them like the subproject 'presto-raptor' where there is 329 Tests run. But in the source code I found 27 time the @Test. I notice that there is some test preceded by: @Test(singleThreaded = true)

This is an example in the following link: https://github.com/prestodb/presto/blob/bd6f5ff8076c3fdb2424406cb5a10f506c7bfbeb/presto-raptor/src/test/java/com/facebook/presto/raptor/metadata/TestRaptorSplitManager.java

@Test(singleThreaded = true)
public class TestRaptorSplitManager
{

I expected to have the same number of Test run as in the log file. But It seems that the source code is running in parallel (multi-thread)

My question here is how do I match the number 329 Tests run with real test cases in source code.

Upvotes: 0

Views: 164

Answers (1)

Krishnan Mahadevan
Krishnan Mahadevan

Reputation: 14746

TestNG counts the number of tests based on the following (apart from the regular way of counting tests)

  1. Data driven tests are counted as new tests. So if you have a @Test that is powered by a data provider (and lets say the data provider gives 5 sets of data), then to TestNG, there were 5 tests that were run.
  2. Tests with multiple invocation counts are also counted as individual tests (so for e.g., if you have @Test(invocationCount = 5), then TestNG would report this test as 5 tests in the reports, which is what Maven console is showing as well.

So not sure how it would be possible for you to build a matching capability that would cross check this against the source code (especially when your tests involve a data provider)

Upvotes: 1

Related Questions