spideruci / tacoco

Integrated Software Analysis Framework
https://github.com/spideruci/tacoco
MIT License
8 stars 7 forks source link

tacoco fails with Null pointer Exception if no test-class found in the test class folder #80

Closed reetasingh closed 5 years ago

reetasingh commented 7 years ago

If tacoco does not find any test class inside the folder. It fails with Null pointer Exception.

In the method runTests in AbstractRuntimeAnalyzer, the AbstractTestRunner sets to null if AbstractBuildProbe does not return any testclass. This leads to Null pointer exception when runner tries to run the class.

protected void runTests(List<Class<?>> klasses) { List<Future> futureAnalysisResults = new ArrayList<>(); int nThread = Integer.parseInt(readOptionalArgumentValue(THREAD, "1")); ExecutorService threadPool = Executors.newFixedThreadPool(nThread); AbstractTestRunner runner = AbstractTestRunner.getInstance(this.buildProbe); // Here runner is null if no test class found.

reetasingh commented 7 years ago

Hanlding the null case with simple if-else check. If null - then print No test class found and exit. Else move ahead.

VijayKrishna commented 7 years ago

who is heading up the merge for this?