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

fix: Fix missing junit report in legacy mode #1807

Merged
merged 2 commits into from
Apr 19, 2021
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
95 changes: 95 additions & 0 deletions integration_tests/src/test/kotlin/integration/LegacyResultIT.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
package integration

import FlankCommand
import com.google.common.truth.Truth.assertThat
import flank.common.isWindows
import org.junit.Assume.assumeFalse
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 {
piotradamczyk5 marked this conversation as resolved.
Show resolved Hide resolved
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()
assertThat(resultDirectory.toJUnitXmlFile().exists()).isTrue()

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

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

outputReport.assertCostMatches()

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

val testSuiteOverview = outputReport.firstTestSuiteOverview

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

@Test
fun iosLegacyJUnitResultTest() {
assumeFalse(isWindows)
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()
assertThat(resultDirectory.toJUnitXmlFile().exists()).isTrue()

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

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

assertThat(outputReport.testResults.count()).isEqualTo(1)
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