Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --xctestrun-file for iOS #424

Merged
merged 1 commit into from
Dec 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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")
}
}