[Pharo-project] Any alternative to HDTestReport?

Schwab,Wilhelm K bschwab at anest.ufl.edu
Sun May 22 16:10:43 CEST 2011


Lukas, Stefan,

SUnit might not be designed to be extensible, but does it have a choice? :)  One thing that I have added for a long time is this:

TestCase class>>prod:aSymbol
	( self selector:aSymbol ) runCase.

There are probably even better ways to do the same thing, but the idea has always been (thinking in GUI terms for the moment) that test runners are great for getting a summary of which tests pass and which ones fail.  Once I decide to use a specific test to reproduce a defect I want to fix, there is probably already a #prod: message in a comment, something like this:

testFromGizmoWithAlarms
	"5-11 - First alarm data"

		| in out results monitorData |

	"
		GizmoTests prod:#testFromGizmoWithAlarms.
	"

	"5-11 - early alarm messages, maybe"
	in := #[ ... ] readStreamORDataServer.

	out := Array writeStream.
	[ in atEnd ] whileFalse:[
		out nextPut:( GizmoMessage readFromEncodedStream:in ).
	].

	self should:[ in atEnd ].

	results := out contents.
	results first data.

FWIW, far too many of these methods have breakpoints in them, so maybe I need a "global" switch to control the halts or a #prodAndDebug: method that will halt on a message send that #prod: ignores.

It is true that OB will do pretty much the same thing from the IDE (control-t - very cool).

The attached illustrates some more elaborate tricks that I have used.  Note that the interesting stuff is Dolphin-specific and, as-is, probably won't work in Pharo.  My point is mostly that with a few well chosen loose methods, SUnit can do things it was never intended to do, such as

		SomeTestCase runTestsReferecing:#asMonitorData.

		SomeTestCase runTestsReferecing:#realizeTabLineFor:.

or even

          SomeTestCase runNonGraphicalTests.
          SomeTestCase runGraphicalTests.

Bill


________________________________________
From: pharo-project-bounces at lists.gforge.inria.fr [pharo-project-bounces at lists.gforge.inria.fr] On Behalf Of Lukas Renggli [renggli at gmail.com]
Sent: Sunday, May 22, 2011 7:32 AM
To: Pharo-project at lists.gforge.inria.fr
Subject: Re: [Pharo-project] Any alternative to HDTestReport?

> Is there any alternative available to HDTestReport to be able to run headless tests, or actually run the SUnit tests in a non-morphic image?

Not that I know of.

> I found the HDTestReport via Lukas github repo, I think, and in the Pharo Core regression testing image.
> Is any of them ever going to be part of the standard SUnit?

I don't think that HDTestReport is useful (something more generic
would maybe). SUnit is not designed to be extensible and HDTestReport
is merely a hack to be able to execute SUnit tests and create a JUnit
compatible XML output so that Hudson can create nice graphs.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

-------------- next part --------------
A non-text attachment was scrubbed...
Name: TestCase class-*dolphincompatibility-idioms.st
Type: application/octet-stream
Size: 3504 bytes
Desc: TestCase class-*dolphincompatibility-idioms.st
URL: <http://lists.gforge.inria.fr/pipermail/pharo-project/attachments/20110522/31878f20/attachment.obj>


More information about the Pharo-project mailing list