But i can't because exception will be raised before xunit_output.wrt_output method. To make an assertion i should make create another method that will be called by output_xml (and can be replaced) and then it should call wrt_output. But then anyway i need to check that doc.toxml() do not raise an exception, and really i don't know how an assertion for it should be written.