@@ -26,6 +26,7 @@ class IosArgsTest {
2626 private val testPath = " ./src/test/kotlin/ftl/fixtures/tmp/EarlGreyExample.zip"
2727 private val xctestrunFile =
2828 " ./src/test/kotlin/ftl/fixtures/tmp/EarlGreyExampleSwiftTests_iphoneos12.1-arm64e.xctestrun"
29+ private val invalidApp = " ../test_app/apks/invalid.apk"
2930 private val xctestrunFileAbsolutePath = xctestrunFile.absolutePath()
3031 private val testAbsolutePath = testPath.absolutePath()
3132 private val iosNonDefault = """
@@ -91,10 +92,10 @@ class IosArgsTest {
9192 fun iosArgs_invalidXcodeExits () {
9293 exceptionRule.expectMessage(" Xcode 99.9 is not a supported Xcode version" )
9394 IosArgs (
94- GcloudYml (),
95- IosGcloudYml (IosGcloudYmlParams (test = testPath, xctestrunFile = xctestrunFile, xcodeVersion = " 99.9" )),
96- FlankYml (),
97- IosFlankYml (),
95+ GcloudYml (),
96+ IosGcloudYml (IosGcloudYmlParams (test = testPath, xctestrunFile = xctestrunFile, xcodeVersion = " 99.9" )),
97+ FlankYml (),
98+ IosFlankYml (),
9899 " "
99100 )
100101 }
@@ -256,6 +257,30 @@ IosArgs
256257 }
257258 }
258259
260+ @Test
261+ fun `disableSharding allows using invalid app` () {
262+ val yaml = """
263+ gcloud:
264+ test: $invalidApp
265+ xctestrun-file: $invalidApp
266+ flank:
267+ disableSharding: true
268+ """
269+ IosArgs .load(yaml).testShardChunks
270+ }
271+
272+ @Test(expected = RuntimeException ::class )
273+ fun `Invalid app throws` () {
274+ val yaml = """
275+ gcloud:
276+ test: $invalidApp
277+ xctestrun-file: $invalidApp
278+ flank:
279+ disableSharding: false
280+ """
281+ IosArgs .load(yaml).testShardChunks
282+ }
283+
259284 // gcloudYml
260285
261286 @Test
@@ -591,4 +616,60 @@ IosArgs
591616 val androidArgs = IosArgs .load(yaml, cli)
592617 assertThat(androidArgs.flakyTestAttempts).isEqualTo(3 )
593618 }
619+
620+ private fun getValidTestsSample () = listOf (
621+ " ClassOneTest/testOne" ,
622+ " ClassOneTest/testTwo" ,
623+ " ClassOneScreenshots/testOne" ,
624+ " ClassTwoScreenshots/testTwo" ,
625+ " ClassThreeTest/testName" ,
626+ " ClassFourTest/testFour"
627+ )
628+
629+ @Test
630+ fun filterTests_emptyFilter () {
631+ val tests = getValidTestsSample()
632+ val actual = filterTests(tests, emptyList())
633+
634+ assertThat(actual).containsExactlyElementsIn(tests)
635+ }
636+
637+ @Test
638+ fun filterTests_regularFilter () {
639+ val tests = getValidTestsSample()
640+ val filter = listOf (" ClassOneTest/testOne" , " ClassFourTest/testFour" )
641+ val actual = filterTests(tests, filter)
642+
643+ val expected = listOf (" ClassOneTest/testOne" , " ClassFourTest/testFour" )
644+
645+ assertThat(actual).containsExactlyElementsIn(expected)
646+ }
647+
648+ @Test
649+ fun filterTests_starFilter () {
650+ val tests = getValidTestsSample()
651+ val filter = listOf (" .*?Test/testOne" , " .*?/testFour" )
652+ val actual = filterTests(tests, filter)
653+
654+ val expected = listOf (
655+ " ClassOneTest/testOne" ,
656+ " ClassFourTest/testFour"
657+ )
658+
659+ assertThat(actual).containsExactlyElementsIn(expected)
660+ }
661+
662+ @Test
663+ fun filterTests_starAndRegularFilter () {
664+ val tests = getValidTestsSample()
665+ val filter = listOf (" .*?Screenshots/testTwo" , " ClassOneTest/testOne" )
666+ val actual = filterTests(tests, filter)
667+
668+ val expected = listOf (
669+ " ClassTwoScreenshots/testTwo" ,
670+ " ClassOneTest/testOne"
671+ )
672+
673+ assertThat(actual).containsExactlyElementsIn(expected)
674+ }
594675}
0 commit comments