Skip to content

Commit

Permalink
Fix missing junit report in legacy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
adamfilipow92 authored and mergify-bot committed Apr 19, 2021
1 parent bff021a commit 0229017
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 1 deletion.
92 changes: 92 additions & 0 deletions integration_tests/src/test/kotlin/integration/LegacyResultIT.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package integration

import FlankCommand
import com.google.common.truth.Truth
import org.junit.Test
import run
import utils.CONFIGS_PATH
import utils.FLANK_JAR_PATH
import utils.androidRunCommands
import utils.asOutputReport
import utils.assertCostMatches
import utils.assertExitCode
import utils.assertTestCountMatches
import utils.findTestDirectoryFromOutput
import utils.firstTestSuiteOverview
import utils.iosRunCommands
import utils.json
import utils.removeUnicode
import utils.toJUnitXmlFile
import utils.toOutputReportFile

class LegacyResultIT {
private val name = this::class.java.simpleName

@Test
fun androidLegacyJUnitResultTest() {
val result = FlankCommand(
flankPath = FLANK_JAR_PATH,
ymlPath = "$CONFIGS_PATH/flank_android_single_legacy.yml",
params = androidRunCommands
).run(
workingDirectory = "./",
testSuite = name
)

assertExitCode(result, 0)

val resOutput = result.output.removeUnicode()
val resultDirectory = resOutput.findTestDirectoryFromOutput()
Truth.assertThat(resultDirectory.toJUnitXmlFile().exists()).isTrue()

val outputReport = resultDirectory.toOutputReportFile().json().asOutputReport()

Truth.assertThat(outputReport.error).isEmpty()
Truth.assertThat(outputReport.cost).isNotNull()

outputReport.assertCostMatches()

Truth.assertThat(outputReport.testResults.count()).isEqualTo(1)
Truth.assertThat(outputReport.weblinks.count()).isEqualTo(1)

val testSuiteOverview = outputReport.firstTestSuiteOverview

testSuiteOverview.assertTestCountMatches(
total = 2,
skipped = 1
)
}

@Test
fun iosLegacyJUnitResultTest() {
val result = FlankCommand(
flankPath = FLANK_JAR_PATH,
ymlPath = "$CONFIGS_PATH/flank_ios_single_legacy.yml",
params = iosRunCommands
).run(
workingDirectory = "./",
testSuite = name
)

assertExitCode(result, 0)

val resOutput = result.output.removeUnicode()
val resultDirectory = resOutput.findTestDirectoryFromOutput()
Truth.assertThat(resultDirectory.toJUnitXmlFile().exists()).isTrue()

val outputReport = resultDirectory.toOutputReportFile().json().asOutputReport()

Truth.assertThat(outputReport.error).isEmpty()
Truth.assertThat(outputReport.cost).isNotNull()

Truth.assertThat(outputReport.testResults.count()).isEqualTo(1)
Truth.assertThat(outputReport.weblinks.count()).isEqualTo(1)

val testSuiteOverview = outputReport.firstTestSuiteOverview

testSuiteOverview.assertTestCountMatches(
total = 17,
skipped = 0
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
gcloud:
app: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app-debug.apk
test: ../test_runner/src/test/kotlin/ftl/fixtures/tmp/apk/app-single-success-debug-androidTest.apk

flank:
disable-sharding: true
output-report: json
legacy-junit-result: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
gcloud:
test: "../test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExample.zip"
xctestrun-file: "../test_runner/src/test/kotlin/ftl/fixtures/tmp/ios/EarlGreyExample/EarlGreyExampleSwiftTests.xctestrun"

flank:
output-report: json
legacy-junit-result: true
2 changes: 1 addition & 1 deletion test_runner/src/main/kotlin/ftl/run/NewTestRun.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ suspend fun IArgs.newTestRun() = withTimeoutOrNull(parsedTimeout) {
}

val duration = measureTime {
ReportManager.generate(matrixMap, args, testShardChunks, ignoredTests)
cancelTestsOnTimeout(args.project, matrixMap.map) { fetchArtifacts(matrixMap, args) }
ReportManager.generate(matrixMap, args, testShardChunks, ignoredTests)

matrixMap.printMatricesWebLinks(project)
outputReport.log(matrixMap)
Expand Down

0 comments on commit 0229017

Please sign in to comment.