Skip to content

Commit

Permalink
Process junit xml even when full junit is not enabled (#935)
Browse files Browse the repository at this point in the history
* Process junit xml even when full junit is not enabled

* Update release notes

Co-authored-by: bootstraponline <[email protected]>
  • Loading branch information
kozaxinan and bootstraponline authored Aug 8, 2020
1 parent a3965db commit cfedb49
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Run `./gradlew check` to fix lint issues

## Adding new gcloud property common to iOS and Android

- Add property to `GcloudYml` and update `keys`
- Add property to `GcloudYml` and update `keys` in config files
- Update `IArgs` with new property
- Update `AndroidArgs` to reference the propery and update `toString`
- Update `IosArgs` to reference the propery and `toString`
Expand Down
2 changes: 1 addition & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
- [#950](https://github.com/Flank/flank/pull/950) Fix crash when --legacy-junit-result set. ([adamfilipow92](https://github.com/adamfilipow92))
- [#948](https://github.com/Flank/flank/pull/948) Increment retry tries and change sync tag for jfrogSync. ([piotradamczyk5](https://github.com/piotradamczyk5))
- [#946](https://github.com/Flank/flank/pull/946) Added tests for flank scripts. ([piotradamczyk5](https://github.com/piotradamczyk5))
-
- [#935](https://github.com/Flank/flank/pull/935) Process junit xml even when full junit is not enabled. ([kozaxinan](https://github.com/kozaxinan))
-
-

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,8 @@ data class CommonFlankConfig @JsonIgnore constructor(
"ignore-failed-tests",
"keep-file-path",
"output-style",
"disable-results-upload"
"disable-results-upload",
"full-junit-result"
)

const val defaultLocalResultsDir = "results"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ object ReportManager {
when {
args.fullJUnitResult -> processFullJunitResult(args, matrices, testShardChunks)
args.useLegacyJUnitResult -> processJunitXml(testSuite, args, testShardChunks)
else -> processJunitXml(testSuite, args, testShardChunks)
}
matrices.validateMatrices(args.ignoreFailedTests)
}
Expand Down
1 change: 1 addition & 0 deletions test_runner/src/test/kotlin/ftl/fixtures/flank.ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ flank:
num-test-runs: 1
run-timeout: 60m
output-style: single
full-junit-result: false
1 change: 1 addition & 0 deletions test_runner/src/test/kotlin/ftl/fixtures/flank.local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ flank:
num-test-runs: 1
run-timeout: 60m
output-style: single
full-junit-result: false
29 changes: 27 additions & 2 deletions test_runner/src/test/kotlin/ftl/reports/utils/ReportManagerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,31 @@ class ReportManagerTest {
verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) }
}

@Test
fun `uploadJunitXml should be called when legacy junit disabled`() {
val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default())
val mockArgs = prepareMockAndroidArgs()
every { mockArgs.useLegacyJUnitResult } returns false
every { mockArgs.project } returns "projecId"

val junitTestResult = ReportManager.processXmlFromFile(matrix, mockArgs, ::parseOneSuiteXml)
ReportManager.generate(matrix, mockArgs, emptyList())
verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) }
}

@Test
fun `uploadJunitXml should be called when full junit enabled`() {
val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default())
val mockArgs = prepareMockAndroidArgs()
every { mockArgs.useLegacyJUnitResult } returns false
every { mockArgs.fullJUnitResult } returns true
every { mockArgs.project } returns "projecId"

val junitTestResult = ReportManager.processXmlFromFile(matrix, mockArgs, ::parseOneSuiteXml)
ReportManager.generate(matrix, mockArgs, emptyList())
verify { GcStorage.uploadJunitXml(junitTestResult!!, mockArgs) }
}

@Test
fun `uploadResults should be called`() {
val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default())
Expand All @@ -106,7 +131,7 @@ class ReportManagerTest {
}

@Test
fun `uploadResults should't be called when disable-results-upload set`() {
fun `uploadResults shouldn't be called when disable-results-upload set`() {
val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default())
val mockArgs = prepareMockAndroidArgs()
every { mockArgs.disableResultsUpload } returns true
Expand All @@ -125,7 +150,7 @@ class ReportManagerTest {
}

@Test
fun `uploadResults with FullJUnit should't be called`() {
fun `uploadResults without FullJUnit shouldn't be called`() {
val matrix = matrixPathToObj("./src/test/kotlin/ftl/fixtures/success_result", AndroidArgs.default())
val mockArgs = prepareMockAndroidArgs()
mockkObject(GcStorage) {
Expand Down

0 comments on commit cfedb49

Please sign in to comment.