On Tue, Dec 29, 2009 at 12:17 AM, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
On Mon, Dec 28, 2009 at 11:19 PM, Adrian Kuhn <akuhn@iam.unibe.ch> wrote:
Mariano Martinez Peck <marianopeck@...> writes:
Assumptions are in the box!
If you expect your test case to fail unless a given condition is met, you can now use assumptions to declare that. Gofer the latest akuhn/SUnit to get assumptions.
For example, when your test case depends on the availability of a certain database you can write
testBlob self assumeThat: Database default = DatabaseWithBlobs. ...
if the assumption is true, the test case is run as a normal test case. If however the assumption is false, the test case is *not* run but still marked as passed. This is supposed to replace conditional #expectedFailures in the new SUnit.
Typically, assumptions are put at the begin of a test case. However, you can put assumptions anywhere. The running tests case is aborted as soon as the first failing assumption is reached.
PS regarding the naming: the message #assumeThat: has been preferred over a simple #assume: to make confusions with a simple #assert: less likely.
Thanks Adrian. All your improvments are really cool. The only thing that I am concerned is that if I change all my tests to this style, Squeak people won't be able to run the tests :( because that method won't be understood. Anyway, I will si what can I do.
Sorry I forgot to say that I just realized about that (because you asked me if it was ok and I said that yes).
Thank you very much for doing every day something better from SUnit!!!
--AA
_______________________________________________ Pharo-project mailing list Pharo-project@lists.gforge.inria.fr http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project