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

Process junit xml even when full junit is not enabled #935

Merged
merged 2 commits into from
Aug 8, 2020
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 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