Skip to content

Commit

Permalink
fix(cli): change help for parse --include-flaky-tests + optimize exec…
Browse files Browse the repository at this point in the history
…ution
  • Loading branch information
Malinskiy committed Jan 23, 2024
1 parent 1d62f7b commit 26470f7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Parse(
.file()
.default(File("Marathonfile"))
private val parseOutputFileName by option("--output", "-o", help="Output file name in yaml format")
private val includeFlakyTests by option("--include-flaky-tests", "-f", help="Include/Exclude flaky tests that will be run too in the output")
private val includeFlakyTests by option("--include-flaky-tests", "-f", help="Include/exclude flaky tests that will have preventive retries according to the current flakinessStrategy")
.convert { it.toBoolean() }
.default(false)
override fun run() {
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/kotlin/com/malinskiy/marathon/Marathon.kt
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,12 @@ class Marathon(

if (parsedAllTests.isEmpty()) throw NoTestCasesFoundException("No tests cases were found")
val parsedFilteredTests = applyTestFilters(parsedAllTests)
val shard = prepareTestShard(parsedFilteredTests, analytics)

if (executionCommand is ParseCommand) {
val flakyTests = if (executionCommand.includeFlakyTests) shard.flakyTests.toList() else emptyList()
// Delay potentially querying remote TSDB unless user requested to get flaky tests
val flakyTests = if (executionCommand.includeFlakyTests) {
prepareTestShard(parsedFilteredTests, analytics).flakyTests.toList()

Check warning on line 144 in core/src/main/kotlin/com/malinskiy/marathon/Marathon.kt

View check run for this annotation

Codecov / codecov/patch

core/src/main/kotlin/com/malinskiy/marathon/Marathon.kt#L144

Added line #L144 was not covered by tests
} else emptyList()
marathonTestParseCommand.execute(
tests = parsedFilteredTests,
flakyTests = flakyTests,
Expand All @@ -150,6 +152,8 @@ class Marathon(
return true
}

val shard = prepareTestShard(parsedFilteredTests, analytics)

usageTracker.trackEvent(Event.TestsTotal(parsedAllTests.size))
usageTracker.trackEvent(Event.TestsRun(parsedFilteredTests.size))

Expand Down
12 changes: 8 additions & 4 deletions docs/runner/intro/execute.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,18 @@ Options:
## Parse command
```shell-session
foo@bar $ marathon parse -h
Usage: marathon parse [OPTIONS]
Usage: marathon parse [<options>]
Print the list of tests without executing them
Options:
-m, --marathonfile PATH Marathonfile file path
-o, --output TEXT Output file name in yaml format
-h, --help Show this message and exit
-m, --marathonfile=<path> Marathonfile file path
-o, --output=<text> Output file name in yaml format
-f, --include-flaky-tests=<value>
Include/exclude flaky tests that will have
preventive retries according to the current
flakinessStrategy
-h, --help Show this message and exit
```

## Version command
Expand Down

0 comments on commit 26470f7

Please sign in to comment.