diff --git a/integration_tests/src/test/kotlin/integration/ManyTestsOnSingleShardIT.kt b/integration_tests/src/test/kotlin/integration/ManyTestsOnSingleShardIT.kt new file mode 100644 index 0000000000..1de85aa16f --- /dev/null +++ b/integration_tests/src/test/kotlin/integration/ManyTestsOnSingleShardIT.kt @@ -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) + } +} diff --git a/integration_tests/src/test/resources/cases/flank_android_many_tests_on_single_shard.yml b/integration_tests/src/test/resources/cases/flank_android_many_tests_on_single_shard.yml new file mode 100644 index 0000000000..24874163ab --- /dev/null +++ b/integration_tests/src/test/resources/cases/flank_android_many_tests_on_single_shard.yml @@ -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