Skip to content

Commit

Permalink
Add --xctestrun-file for iOS (#424)
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline authored Dec 3, 2018
1 parent ada745e commit 2e3d0ce
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/IosArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IosArgs(

private val iosGcloud = iosGcloudYml.gcloud
var xctestrunZip = cli?.test ?: iosGcloud.test
var xctestrunFile = iosGcloud.xctestrunFile
var xctestrunFile = cli?.xctestrunFile ?: iosGcloud.xctestrunFile
val xcodeVersion = iosGcloud.xcodeVersion
val devices = iosGcloud.device

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,10 @@ class IosRunCommand : Runnable {
| beginning with gs://. Note: any .xctestrun file in this zip file will be ignored if --xctestrun-file
| is specified."""])
var test: String? = null

@Option(names = ["--xctestrun-file"], description = ["""The path to an .xctestrun file that will override any
|.xctestrun file contained in the --test package. Because the .xctestrun file contains environment variables
|along with test methods to run and/or ignore, this can be useful for customizing or sharding test suites. The
| given path may be in the local filesystem or in Google Cloud Storage using a URL beginning with gs://."""])
var xctestrunFile: String? = null
}
15 changes: 15 additions & 0 deletions test_runner/src/test/kotlin/ftl/args/IosArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,19 @@ IosArgs
assertThat(IosArgs.load(yaml).xctestrunZip).isEqualTo(xctestrunFileAbsolutePath)
assertThat(IosArgs.load(yaml, cli).xctestrunZip).isEqualTo(testAbsolutePath)
}

@Test
fun cli_xctestrunFile() {
val cli = IosRunCommand()
CommandLine(cli).parse("--xctestrun-file=$xctestrunFile")

val yaml = """
gcloud:
test: $testPath
xctestrun-file: $testPath
"""

assertThat(IosArgs.load(yaml).xctestrunFile).isEqualTo(testAbsolutePath)
assertThat(IosArgs.load(yaml, cli).xctestrunFile).isEqualTo(xctestrunFileAbsolutePath)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class IosRunCommandTest {
assertThat(cmd.testTargetsAlwaysRun).isNull()
assertThat(cmd.testTargets).isNull()
assertThat(cmd.test).isNull()
assertThat(cmd.xctestrunFile).isNull()
}

@Test
Expand Down Expand Up @@ -168,4 +169,12 @@ class IosRunCommandTest {

assertThat(cmd.test).isEqualTo("a")
}

@Test
fun test_xctestrunFile() {
val cmd = IosRunCommand()
CommandLine(cmd).parse("--xctestrun-file=a")

assertThat(cmd.xctestrunFile).isEqualTo("a")
}
}

0 comments on commit 2e3d0ce

Please sign in to comment.