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

Documentation: JUNIT output setup defined #181

Open
rapolas-oag opened this issue Jul 24, 2024 · 6 comments
Open

Documentation: JUNIT output setup defined #181

rapolas-oag opened this issue Jul 24, 2024 · 6 comments
Assignees

Comments

@rapolas-oag
Copy link

rapolas-oag commented Jul 24, 2024

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

@rapolas-oag rapolas-oag changed the title Documentation: JUNIT output Documentation: JUNIT output setup defined Jul 24, 2024
@rapolas-oag
Copy link
Author

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.

@AJIOB
Copy link
Contributor

AJIOB commented Jul 24, 2024

The shellcheck itselfs waits script_name as a $1 argument or -- for skipping it. --output-junit-xml=<file> is a usual argument.

@wiki5
Copy link

wiki5 commented Aug 28, 2024

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?

@AJIOB
Copy link
Contributor

AJIOB commented Aug 29, 2024

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}"

@wiki5
Copy link

wiki5 commented Aug 30, 2024

Thank you let me try this out.

@AJIOB
Copy link
Contributor

AJIOB commented Oct 22, 2024

Looks like it was fixed by #184, isn't it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants