Skip to content

TypeError: string indices must be integers, when using parameter --junit-xml

Quick Information

I got the following issue (log file attached):

  File "XXX/venv/lib/python3.8/site-packages/badges_gitlab/badges_test.py", line 65, in create_badges_test
    total_tests += int(testsuite['@tests'])
TypeError: string indices must be integers

when I try to generate the badges for test results (gitlab CI/CD config attached) using "badges-gitlab --junit-xml build/test-results/test/TESTS-TestSuites.xml"

TESTS-TestSuites.xml

badges-gitlab.log

.gitlab-ci.yml

What Happened?

I checked the XML file and it looks ok. I think there is an issue with the code. Please, can you verify it.

Expected result

Test result badges generated.

Steps to reproduce

badges-gitlab --junit-xml build/test-results/test/TESTS-TestSuites.xml

Screenshots

No screenhots. I attached XML and log files. I changed some strings in them because I am using badges-gitlab in a private reprository.

Priority/Severity

  • Medium (anything that negatively affects the user experience)

First of all, thanks and congratulations for this project. Second, I can help with the code (with the appropiate MR, of couser) if needed. I do not need it inmediatly, but I will like to generate and use the tests badges in my repo at some point. Finally, just let me know if you need something else.