Skip to content

Commit

Permalink
Add --async (#416)
Browse files Browse the repository at this point in the history
  • Loading branch information
bootstraponline authored Dec 3, 2018
1 parent f0a6c86 commit b5fb31a
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 2 deletions.
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/args/AndroidArgs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class AndroidArgs(
override val resultsBucket: String
override val recordVideo = cli?.recordVideo ?: cli?.noRecordVideo?.not() ?: gcloud.recordVideo
override val testTimeout = cli?.timeout ?: gcloud.timeout
override val async = gcloud.async
override val async = cli?.async ?: gcloud.async
override val projectId = gcloud.project
override val resultsHistoryName = gcloud.resultsHistoryName

Expand Down
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 @@ -36,7 +36,7 @@ class IosArgs(
override val resultsBucket: String
override val recordVideo = cli?.recordVideo ?: cli?.noRecordVideo?.not() ?: gcloud.recordVideo
override val testTimeout = cli?.timeout ?: gcloud.timeout
override val async = gcloud.async
override val async = cli?.async ?: gcloud.async
override val projectId = gcloud.project
override val resultsHistoryName = gcloud.resultsHistoryName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,7 @@ class AndroidRunCommand : Runnable {
|possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m,
| or s. If no unit is given, seconds are assumed. """])
var timeout: String? = null

@Option(names = ["--async"], description = ["""Invoke a test asynchronously without waiting for test results."""])
var async: Boolean? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ class IosRunCommand : Runnable {
|possible testing time is 30m on physical devices and 60m on virtual devices. The TIMEOUT units can be h, m,
| or s. If no unit is given, seconds are assumed. """])
var timeout: String? = null

@Option(names = ["--async"], description = ["""Invoke a test asynchronously without waiting for test results."""])
var async: Boolean? = null
}
15 changes: 15 additions & 0 deletions test_runner/src/test/kotlin/ftl/args/AndroidArgsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -576,4 +576,19 @@ AndroidArgs
assertThat(AndroidArgs.load(yaml).testTimeout).isEqualTo("2m")
assertThat(AndroidArgs.load(yaml, cli).testTimeout).isEqualTo("1m")
}

@Test
fun cli_async() {
val cli = AndroidRunCommand()
CommandLine(cli).parse("--async")

val yaml = """
gcloud:
app: $appApk
test: $testApk
async: false
"""
assertThat(AndroidArgs.load(yaml).async).isEqualTo(false)
assertThat(AndroidArgs.load(yaml, cli).async).isEqualTo(true)
}
}
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 @@ -296,4 +296,19 @@ IosArgs
assertThat(IosArgs.load(yaml).testTimeout).isEqualTo("2m")
assertThat(IosArgs.load(yaml, cli).testTimeout).isEqualTo("1m")
}

@Test
fun cli_async() {
val cli = IosRunCommand()
CommandLine(cli).parse("--async")

val yaml = """
gcloud:
test: $testPath
xctestrun-file: $xctestrunFile
async: false
"""
assertThat(IosArgs.load(yaml).async).isEqualTo(false)
assertThat(IosArgs.load(yaml, cli).async).isEqualTo(true)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class AndroidRunCommandTest {
assertThat(cmd.recordVideo).isNull()
assertThat(cmd.noRecordVideo).isNull()
assertThat(cmd.timeout).isNull()
assertThat(cmd.async).isNull()
}

@Test
Expand Down Expand Up @@ -208,4 +209,12 @@ class AndroidRunCommandTest {

assertThat(cmd.timeout).isEqualTo("1m")
}

@Test
fun async_parse() {
val cmd = AndroidRunCommand()
CommandLine(cmd).parse("--async")

assertThat(cmd.async).isTrue()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class IosRunCommandTest {
assertThat(cmd.recordVideo).isNull()
assertThat(cmd.noRecordVideo).isNull()
assertThat(cmd.timeout).isNull()
assertThat(cmd.async).isNull()
}

@Test
Expand Down Expand Up @@ -94,4 +95,12 @@ class IosRunCommandTest {

assertThat(cmd.timeout).isEqualTo("1m")
}

@Test
fun async_parse() {
val cmd = IosRunCommand()
CommandLine(cmd).parse("--async")

assertThat(cmd.async).isTrue()
}
}

0 comments on commit b5fb31a

Please sign in to comment.