{"id":24855,"library":"xunitparserx","title":"xunitparserx","description":"Read JUnit/XUnit/MSTest XML files and map them to Python objects. Current version 1.9.12, released irregularly.","status":"active","version":"1.9.12","language":"python","source_language":"en","source_url":"https://github.com/medlab/xunitparserx","tags":["xml","xunit","junit","test","parsing"],"install":[{"cmd":"pip install xunitparserx","lang":"bash","label":"pip install"}],"dependencies":[],"imports":[{"note":"","wrong":null,"symbol":"parse","correct":"from xunitparserx import parse"},{"note":"","wrong":null,"symbol":"TestSuite","correct":"from xunitparserx import TestSuite"}],"quickstart":{"code":"from xunitparserx import parse\n\n# Parse an XUnit XML file\nwith open('results.xml', 'r') as f:\n    suite, report = parse(f)\n\n# Access test suite info\nprint(f\"Tests: {suite.tests}, Failures: {suite.failures}, Errors: {suite.errors}\")\n\n# Iterate over test cases\nfor test in suite.test_cases():\n    print(f\"{test.classname}.{test.methodname}: {test.result}\")","lang":"python","description":"Basic usage: parse an XUnit XML file and iterate over test cases."},"warnings":[{"fix":"Always accept both: suite, report = parse(...). Check report for None if needed.","message":"The parse function returns a tuple (suite, report). The 'report' object may be None if not parsing a report-style XML.","severity":"gotcha","affected_versions":"all"},{"fix":"Validate XML against the schema before parsing. Use lxml or xml.etree for pre-validation.","message":"The library expects well-formed XML per JUnit/XUnit schema. Malformed or non-standard XML may cause parse errors or missing attributes.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'test.classname' and 'test.methodname' (they remain consistent).","message":"Older versions used methodnames like 'test.classname' and 'test.methodname'; these have been replaced by 'test.classname' and 'test.methodname' (same). Check if your version uses 'test.classname' or 'test.classname'.","severity":"deprecated","affected_versions":"<1.5.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'pip install xunitparserx'.","cause":"Package not installed or environment missing.","error":"ImportError: No module named xunitparserx"},{"fix":"Open the file first: with open('file.xml') as f: suite, report = parse(f)","cause":"Passing a file path string instead of a file object to parse().","error":"AttributeError: 'str' object has no attribute 'iterparse'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}