Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
.. image:: https://travis-ci.org/kyrus/python-junit-xml.png?branch=master
A Python module for creating JUnit XML test result documents that can be read by tools such as Jenkins or Bamboo. If you are ever working with test tool or test suite written in Python and want to take advantage of Jenkins' or Bamboo's pretty graphs and test reporting capabilities, this module will let you generate the XML test reports.
As there is no definitive Jenkins JUnit XSD that I could find, the XML documents created by this module support a schema based on Google searches and the Jenkins JUnit XML reader source code. File a bug if something doesn't work like you expect it to. For Bamboo situation is the same.
Install using pip or easy_install:
::
pip install junit-xml
or
easy_install junit-xml
You can also clone the Git repository from Github and install it manually:
::
git clone https://github.com/kyrus/python-junit-xml.git
python setup.py install
Create a test suite, add a test case, and print it to the screen:
.. code-block:: python
from junit_xml import TestSuite, TestCase
test_cases = [TestCase('Test1', 'some.class.name', 123.345, 'I am stdout!', 'I am stderr!')]
ts = TestSuite("my test suite", test_cases)
# pretty printing is on by default but can be disabled using prettyprint=False
print(TestSuite.to_xml_string([ts]))
Produces the following output
.. code-block:: xml
<?xml version="1.0" ?>
<testsuites>
<testsuite errors="0" failures="0" name="my test suite" tests="1">
<testcase classname="some.class.name" name="Test1" time="123.345000">
<system-out>
I am stdout!
</system-out>
<system-err>
I am stderr!
</system-err>
</testcase>
</testsuite>
</testsuites>
Writing XML to a file:
.. code-block:: python
# you can also write the XML to a file and not pretty print it
with open('output.xml', 'w') as f:
TestSuite.to_file(f, [ts], prettyprint=False)
See the docs and unit tests for more examples.
NOTE: Unicode characters identified as "illegal or discouraged" are automatically stripped from the XML string or file.
::
# activate your virtualenv
pip install tox
tox
FAQs
Creates JUnit XML test result documents that can be read by tools such as Jenkins
We found that junit-xml demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.