Hi,

First, allow me to say that MbUnit is a great tool, and I find its
extra features incredibly useful over some of the existing tools.

There is one feature that I would like to see added, which would make
my testing code and testing process simpler.
It is called a "SoftFail" (at least that was the chosen for it by
someone). Unfotunatelly I cannot point you at an alternative
implementation in JUnit, pyUnit, or other open-source testing
framework and politely ask someone to port it. I've seen it used as in
an in-house extension to a testing framework.

An Assert.SoftFail(...) behaves similarly to Assert.Fail(), except
that the first occurrence of SoftFail does not cause the testing
framework to abort the rest of the method. Instead, the testing
continues where it left off until the end of the test is reached. All
of the errors are accumulated then and presented to the user. The
advantage of the SoftFail over Fail is that it potentially exposes
more errors during a single test run. That can reduce the number of
necessary iterations in the "run tests -> find failures -> fix bugs ->
run tests ..." cycle before all test failures are fixed.

Here is a particular scenario I run into where using SoftFail would be
nice:

I have 100+ files in a directory created by software version 2.3. In
the next release 2.3 becomes 2.4, and some of the file formats change.
In 2.4 can import the files stored in 2.3 format, convert them to a
new format, and save them back to the file. I am testing this
importing functionality. The pseudo-code is like this:

[Test]
public void TestLoadOldFormat() {
  TwoFourObjModel tfom;
  foreach (ttf in twoThreeFiles) {
    tfom = Importer.LoadOldFormat(ttf);
    #region Test Validity
    ...
    some tests
    ...
    if (tfom.XXX != CONST) {
      Assert.Fail("Failed to load ...");
    }
    ...
    some tests
    ...
    #endregion
    Exporter.SaveNewFormat(tfom, fileName);
  }
}

I would really like to be able to write asserts as such:

if (tfom.XXX != CONST) {
  Assert.SoftFail("Failed to load ...");
  continue; // Skip just one file and try the next one
}

If SoftFail() is to be implemented, then probably some change to the
xml format and MbUnit's object model will need to be made, because a
single testing case could raise 10 exceptions, all of which could be
of a different type.

I am not sure how you would implement this, perhaps create a separate
failure for each occurrence of a SoftFail, as in
TestLoadOldFormat_000, TestLoadOldFormat_001, ...

Hopefully I am not the only one who finds this useful.
Regards,

- Leonid


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"MbUnit.User" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/MbUnitUser?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to