--- Gabor Szabo <[EMAIL PROTECTED]> wrote:

> I wonder if it would be possible to take the existing .*Unit
> libraries
> of Java and .Net and
> create some wrapper around them (or a replacement) so people with
> existing tests
> written in those testing system would start producing TAP results.

In theory, this shouldn't be too hard.  In practice, there are issues. 
I'm going to write a bit of negative stuff here, but that's not to say
that we can't or shouldn't do this because I think this is a great
idea.  It's just that the testing worlds involved have different views
on how things work and as we all know, these views are often
"religious" in nature.

First, it's my understanding that these tools often don't have 'output'
in the sense we might appreciate it.  Instead, you see the green/red
bar in the GUIs (1) and know if your tests passed or failed.

If you want output, such as the XML which ant (2) produces (3), they
have ways of allowing you to attach listeners (similar to the
TAP::Parser callbacks) which can read success/failure and do anything
they want with results.  A friend is going to send me info on the ant
hooks which allow this.

That raises the next problem.  Conceptually, they view tests as quite a
bit different.  They count 3 tests here, but we would count 6:

 import junit.framework.*;
 public class BinStringTest extends TestCase {
   private BinString binString;

   protected void setUp() { 
      binString = new BinString();
   }

   public void testSumFunction() {  // test 1
      int expected = 0;
      assertEquals(expected, binString.sum(""));
      expected = 100;
      assertEquals(expected, binString.sum("d"));
      expected = 265;
      assertEquals(expected, binString.sum("Add"));
   }

   public void testBinariseFunction() { // test 2
      String expected = "101";
      assertEquals(expected, binString.binarise(5));
      expected = "11111100";
      assertEquals(expected, binString.binarise(252));
   }

   public void testTotalConversion() {  // test 3
     String expected = "1000001";
     assertEquals(expected, binString.convert("A"));
   }
 }      

We can get around that with nested TAP, but that means it's a precursor
to this conversion.

There are other issues (a conceptual bailout on failure, for example),
but these are the major ones.

Cheers,
Ovid

1.  JUnit GUI screenshot:

  http://tejasconsulting.com/images/junit.png

2.  http://ant.apache.org/

3.  A simple TAP to ant XML (mislabeled as JUnit XML) converter relying
on Test::Harness::Straps:

  http://tinyurl.com/ytw93l

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to