Open rapolas-oag opened 1 month ago
Found the way to get output file:
./shunit2/shunit2 -- --output-junit-xml=/output/junit.xml
Having -- --
is not intuitive, I managed to get this only by looking into tests.
The shellcheck itselfs waits script_name
as a $1
argument or --
for skipping it. --output-junit-xml=<file>
is a usual argument.
when I tried to use following in my test script, ones executed it gives an error. The inclusion of junit to generate report file:
main() { . ../../shunit2/shunit2/shunit2 --output-junit-xml=junit.xml }
Output : shunit2:FATAL unable to read from --output-junit-xml=junit.xml
I tried using below as well as mentioned in the comments here.
main() { . ../../shunit2/shunit2/shunit2 -- --output-junit-xml=junit.xml }
Output: $ ./test_extract_delta.sh --output-junit-xml=junit.xml ../../shunit2/shunit2/shunit2: line 1057: eval: --: invalid option eval: usage: eval [arg ...] ASSERT:unknown failure encountered running a test
Ran 1 test.
FAILED (failures=1)
Can someone please guide me on how to generate Junit similar test reports for the unit tests I have written using shunit2?
Hi @wiki5
I'm running the latest master
revision with the following code:
env \
XUNIT_LAUNCHER="${REPO_ROOT}/external/shunit2/shunit2" \
"./helloWorldTest.sh" \
-- \
"--output-junit-xml=mysuit.xml" \
"--suite-name=myprefix::mysuit" \
The helloWorldTest.sh
file contains:
#!/bin/sh
testUnitFrameworkWorks() {
assertEquals 1 1
}
# Launch tests
. "${XUNIT_LAUNCHER}"
Thank you let me try this out.
It seems that JUnit report support was released with the last merge, however there is no documentation how to use and setup. I would appreciate the readme.md update.
PR #176 @williamdes / @AJIOB