JUnitFormatter

  • A ExUnit.Formatter implementation that generates a xml in the format understood by JUnit.

To acomplish this, there are some mappings that are not straight one to one. Therefore, here goes the mapping:

  • JUnit - ExUnit
  • Testsuites - :testsuite
  • Testsuite - %ExUnit.TestCase{}
  • failures = failures
  • skipped = skip
  • errors = invalid
  • time = (sum of all times)
  • Testcase - %ExUnit.Test
  • name = :case
  • test = :test
  • content (only if not successful)
  • skipped = {:state, {:skip, _}}
  • failed = {:state, {:failed, {_, reason, stacktrace}}}
  • reason = reason.message
  • contet = Exception.format_stacktrace(stacktrace)
  • error = {:invalid, module}

Currently it writes the results in an xml file in the project’s build_path.

Summary

Macros

xmlAttribute(args \\ [])
xmlAttribute(record, args)
xmlElement(args \\ [])
xmlElement(record, args)
xmlText(args \\ [])
xmlText(record, args)