-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add IT for large shard test suite (#1737)
Fixes #1650 ## Test Plan > How do we know the code works? New IT succeed. ## Checklist - [x] Integration tests updated
- Loading branch information
1 parent
72a2d29
commit 596ce90
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
integration_tests/src/test/kotlin/integration/ManyTestsOnSingleShardIT.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package integration | ||
|
||
import FlankCommand | ||
import com.google.common.truth.Truth.assertThat | ||
import org.junit.Test | ||
import run | ||
import utils.CONFIGS_PATH | ||
import utils.FLANK_JAR_PATH | ||
import utils.androidRunCommands | ||
import utils.asOutputReport | ||
import utils.assertCostMatches | ||
import utils.assertCountOfFailedTests | ||
import utils.assertCountOfSkippedTests | ||
import utils.assertExitCode | ||
import utils.assertTestCountMatches | ||
import utils.findTestDirectoryFromOutput | ||
import utils.firstTestSuiteOverview | ||
import utils.json | ||
import utils.loadAsTestSuite | ||
import utils.removeUnicode | ||
import utils.toJUnitXmlFile | ||
import utils.toOutputReportFile | ||
|
||
class ManyTestsOnSingleShardIT { | ||
|
||
private val name = this::class.java.simpleName | ||
|
||
@Test | ||
fun `return with exit code 0 and has correct output`() { | ||
val result = FlankCommand( | ||
flankPath = FLANK_JAR_PATH, | ||
ymlPath = "$CONFIGS_PATH/flank_android_many_tests_on_single_shard.yml", | ||
params = androidRunCommands | ||
).run("./", name) | ||
val expectedTestCount = 60 | ||
|
||
assertExitCode(result, 0) | ||
|
||
val resOutput = result.output.removeUnicode() | ||
val outputDirectory = resOutput.findTestDirectoryFromOutput() | ||
|
||
// validate JUnitReport.xml | ||
val testSuites = outputDirectory.toJUnitXmlFile().loadAsTestSuite() | ||
assertThat(testSuites.testSuites.first().testCases.size).isEqualTo(expectedTestCount) | ||
(0 until expectedTestCount).forEach { testNumber -> | ||
assertThat(testSuites.testSuites.any { it.name == "test$testNumber" }) | ||
assertThat(testSuites.assertCountOfFailedTests(0)) | ||
assertThat(testSuites.assertCountOfSkippedTests(0)) | ||
} | ||
|
||
// validate general | ||
val outputReport = outputDirectory.toOutputReportFile().json().asOutputReport() | ||
outputReport.assertCostMatches() | ||
assertThat(outputReport.testResults).isNotEmpty() | ||
assertThat(outputReport.weblinks).isNotEmpty() | ||
assertThat(outputReport.error).isEmpty() | ||
outputReport.firstTestSuiteOverview.assertTestCountMatches(total = expectedTestCount) | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
integration_tests/src/test/resources/cases/flank_android_many_tests_on_single_shard.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
gcloud: | ||
app: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app_many_tests-debug.apk | ||
test: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app_many_tests-debug-androidTest.apk | ||
|
||
flank: | ||
disable-sharding: true | ||
disable-results-upload: true | ||
disable-usage-statistics: true | ||
output-report: json |