Open textnow-andriizubenko opened 2 years ago
Thanks for reporting the bug!
Thanks for reporting the bug!
I can send you junit xml and html report if needed
I can send you junit xml and html report if needed
That'd be helpful. You can send it to matt@bootstraponline.com
@bootstraponline After some investigation i found out that Html report gets broken when JSON that is being inserted into INJECT-DATA-HERE
has some single backslash double quotes \"
. This can be fixed by replacing \"
with \\\"
Json example that breaks HTML report
[
{
"label": "deviceName com.myApp.tests.SomeTest#exampleTest",
"items": [
{
"label": "Error in 'single quotes \"Double quotes\"'",
"url": "https://console.firebase.google.com/project/"
}
]
}
]
Working JSON
[
{
"label": "deviceName com.myApp.tests.SomeTest#exampleTest",
"items": [
{
"label": "Error in 'single quotes \\\"Double quotes\\\"'",
"url": "https://console.firebase.google.com/project/"
}
]
}
]
The problem seems to be happening with escaping double quotes in test results(\"
or \\"
). Example :
val someString = "Some error in Espresso test with stacktrace in 'single quotes \"Double quotes\"'"
// or
val someOtherString = "Some error in Espresso test with stacktrace in 'single quotes \\"Double quotes\\"'"
// or
val someOtherOtherString = "Some error in Espresso test with stacktrace in 'single quotes \\\"Double quotes\\\"'"
So the workaround would be to replace \"
with "
and remove remaining \
val originalString = "Some error in Espresso test with stacktrace in 'single quotes \\\"Double quotes\\\"'"
val newString = originalString.replace("\"", """)?.replace("\\", "")
Temp workaround that worked for me : https://github.com/Flank/flank/blob/3f509c26e3b4bac8be9f0fb214d08be4f479b314/test_runner/src/main/kotlin/ftl/reports/HtmlErrorReport.kt#L69
private fun List<JUnitTest.Case>.createItems(): List<HtmlErrorReport.Item> = map { testCase ->
HtmlErrorReport.Item(
label = testCase.stackTrace().split("\n").firstOrNull()?.replace("\"", """)?.replace("\\", "") ?: "",
url = testCase.webLink ?: ""
)
}
Describe the bug
I am running tests using Flank(v 21.09) in Firebase, some test runs would generate an empty html report but Junit report does have a failed tests.
To Reproduce
Expected behavior
Html report is generated properly for all failed tests
Details (please complete the following information):
No
21.09
Additional context
flank.yml