mobly icon indicating copy to clipboard operation
mobly copied to clipboard

Provide a way to pass in a summary_writer to a test

Open dthkao opened this issue 8 years ago • 2 comments

For example an API similar to xmlrunner in unittest here : https://github.com/xmlrunner/unittest-xml-reporting#usage

We could similarly do: import custom_summary_writer ... if name == 'main': test_runner.main(summary_writer=custom_summary_writer.Writer(option='foo'))

dthkao avatar Jul 12 '17 19:07 dthkao

what would option='foo' do?

xpconanfan avatar Jul 12 '17 19:07 xpconanfan

There are actually better ways to achieve customizeable output formats. Here's an example.

If the test case simply emits synchronous signals, as defined here: https://github.com/kdart/pycopia3/blob/master/QA/pycopia/QA/signals.py and used here: https://github.com/kdart/pycopia3/blob/master/QA/pycopia/QA/core.py#L273 Then any output module can be a subscriber to the signal stream, as defined here: https://github.com/kdart/pycopia3/blob/master/QA/pycopia/reports/init.py And implemented here: https://github.com/kdart/pycopia3/blob/master/QA/pycopia/reports/default.py Which provides a more user-friendly output to the console that contains color and line drawing characters. Other output modules can be written (not included there) that, say, write HTML, or YAML, or to a database, or other storage.

In other words, the pub-sub pattern.

kdart avatar Jul 25 '17 17:07 kdart

Obsolete

xpconanfan avatar Jan 24 '23 18:01 xpconanfan