Add verbosity to texttestresult

Bug #1153837 reported by Leo Arias
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
testtools
Incomplete
Wishlist
Unassigned

Bug Description

The texttestresult doesn't print dots or test names, as the unittest one does.
It would be nice to add this, with a verbosity argument to decide what to print. Most of the things can just be copied from unittest.

Is there a reason not to do it?

I need it right now, so I inherited from testtools texttestresults and added the prints. I'll add some tests and make an MP to see if you like it.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 1153837] [NEW] Add verbosity to texttestresult

On 12 March 2013 12:43, Leo Arias <email address hidden> wrote:
> Public bug reported:
>
> The texttestresult doesn't print dots or test names, as the unittest one does.
> It would be nice to add this, with a verbosity argument to decide what to print. Most of the things can just be copied from unittest.
>
> Is there a reason not to do it?

Well, those things are generally useless in large projects: they
aren't parallel execution friendly, and they don't tell you about
single hung tests in a usable fashion.

> I need it right now, so I inherited from testtools texttestresults and
> added the prints. I'll add some tests and make an MP to see if you like

I think jml and I would both rather like to delete our custom result
object, if we can make the glue code make it entirely redundant.

What are you doing that you want to extend the testtools
TextTestResult rather than e.g. the unittest one?

-Rob

--
Robert Collins <email address hidden>
Distinguished Technologist
HP Cloud Services

Revision history for this message
Leo Arias (elopio) wrote :

Hi Robert,

I'm writing acceptance tests for a website with selenium. Thus, the tests are slow, and we need more verbosity from the runner so you don't think they are stuck. We print a summary of the actions being executed to sys.out. I started with unittest texttestresult, and it prints the test name and the test result (ok, fail, error...) just as I want. The problem is that the results summary is printed by unittest's texttestrunner, and I'm not using it because I'm using testtools mutitestresult as I also need an XML output.

So, I found that testtools texttestresult prints the results summary and all the failures. That's better. But it doesn't print the names.

The problem seems to be that the responsibilities of a results handler are inconsistent between unittest and testtools. For me, testtools is doing the right thing, and it seemed like easier to extend the testtools one to print the names.

Maybe my scenario is not common and I just need my own runner tailored just for this case. I have it working fine at the moment, I just wanted to check if I should send you my patced texttestresult.

thanks for the answer.
pura vida.

Revision history for this message
Robert Collins (lifeless) wrote : Re: [Bug 1153837] Re: Add verbosity to texttestresult

On 13 March 2013 04:15, Leo Arias <email address hidden> wrote:
> Hi Robert,
>
> I'm writing acceptance tests for a website with selenium. Thus, the
> tests are slow, and we need more verbosity from the runner so you don't

Fair enough - the StreamResult work is intended to make doing this
systematically a reasonable, easy thing - I can well imagine the
default result objects for testtools and testrepository calling out
slow tests.

> think they are stuck. We print a summary of the actions being executed
> to sys.out. I started with unittest texttestresult, and it prints the
> test name and the test result (ok, fail, error...) just as I want. The
> problem is that the results summary is printed by unittest's
> texttestrunner, and I'm not using it because I'm using testtools
> mutitestresult as I also need an XML output.
>
> So, I found that testtools texttestresult prints the results summary and
> all the failures. That's better. But it doesn't print the names.
>
> The problem seems to be that the responsibilities of a results handler
> are inconsistent between unittest and testtools. For me, testtools is
> doing the right thing, and it seemed like easier to extend the testtools
> one to print the names.

One thing you could do:
MultiTestResult(unittest.TestResult(...), junitxml.JUnitXMLResult(..))

- oh I see, you *don't want* the end of run summary? I thought we
printed that from testtools.TextTestResult.stopTestRun() - and in fact
we do. Perhaps I misread, and you meant that unittest.TextTestResult
*does not print* the end of run summary, because the TestProgram /
TestRunner in unittest does that.

Either way, I can see why you'd want to tweak testtools.TestResult :
better compat with the rest of the testtools ecosystem. Sad (for us)
that we're in that position, but it is what it is.

> Maybe my scenario is not common and I just need my own runner tailored
> just for this case. I have it working fine at the moment, I just wanted
> to check if I should send you my patced texttestresult.

Yes please. Thanks for helping me understand.

-Rob

Revision history for this message
Jonathan Lange (jml) wrote :

Hi Leo,

Sorry for leaving this dormant for so long.

Have you sent us this patch? Have we merged it?

Thanks,
jml

Changed in testtools:
status: New → Incomplete
importance: Undecided → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.