diff --git a/src/main/java/com/askimed/nf/test/commands/RunTestsCommand.java b/src/main/java/com/askimed/nf/test/commands/RunTestsCommand.java index 2dc71791..f13a9dad 100644 --- a/src/main/java/com/askimed/nf/test/commands/RunTestsCommand.java +++ b/src/main/java/com/askimed/nf/test/commands/RunTestsCommand.java @@ -243,16 +243,6 @@ public Integer execute() throws Exception { DependencyExporter.generateDotFile(resolver, graph); } - - if (scripts.isEmpty()) { - System.out.println(AnsiColors - .yellow("No tests to execute.")); - log.warn("No tests or directories found containing test files. Or all testcases were filtered."); - return 0; - } else { - log.info("Detected {} test files.", scripts.size()); - } - loadPlugins(manager, plugins); GroupTestExecutionListener listener = setupExecutionListeners(); @@ -267,13 +257,22 @@ public Integer execute() throws Exception { List testSuits = testSuiteResolver.parse(scripts, new TagQuery(tags)); testSuits.sort(TestSuiteSorter.getDefault()); - if (shard != null) { + if (shard != null && !testSuits.isEmpty()) { if (shardStrategy.equalsIgnoreCase(SHARD_STRATEGY_ROUND_ROBIN)){ testSuits = TestSuiteSharder.shardWithRoundRobin(testSuits, shard); } else { testSuits = TestSuiteSharder.shard(testSuits, shard); } } + + int totalTests = testSuits.stream().mapToInt(testSuite -> testSuite.getTests().size()).sum(); + log.info("Found {} tests to execute.", totalTests); + + if (testSuits.isEmpty()) { + System.out.println(AnsiColors + .yellow("No tests to execute.")); + return 0; + } TestExecutionEngine engine = new TestExecutionEngine(); engine.setListener(listener); diff --git a/src/main/java/com/askimed/nf/test/lang/dependencies/DependencyResolver.java b/src/main/java/com/askimed/nf/test/lang/dependencies/DependencyResolver.java index 28d21cc5..80c0b60f 100644 --- a/src/main/java/com/askimed/nf/test/lang/dependencies/DependencyResolver.java +++ b/src/main/java/com/askimed/nf/test/lang/dependencies/DependencyResolver.java @@ -53,7 +53,7 @@ public List findAllTests() throws Exception { } } - log.info("Found {} tests.", results.size()); + log.info("Found {} files containing tests.", results.size()); return results; } @@ -80,8 +80,8 @@ public List findTestsByFiles(List files) throws Exception { } } - log.info("Found {} tests.", results.size()); - log.debug("Found tests: " + results); + log.info("Found {} files containing tests.", results.size()); + log.debug("Found files: " + results); return results; } @@ -111,7 +111,7 @@ public List findRelatedTestsByFiles(File ... files) throws Exception { results.addAll(findRelatedTestsByFile(file.getAbsoluteFile())); } long time1 = System.currentTimeMillis(); - log.info("Found {} tests for file {} in {} sec", results.size(), files, (time1 - time0) / 1000.0); + log.info("Found {} files containing tests for file {} in {} sec", results.size(), files, (time1 - time0) / 1000.0); return new Vector(results); }