[PJUG Javamail] TestNG issues with JDK 1.4/Junit

Bullard, Douglas Douglas.Bullard at nike.com
Thu Jul 16 18:35:22 EDT 2009


Hope someone can help us out on this...

 

We've got some old, old projects JDK 1.4 with tons of failing unit
tests.  The best thing to do would be to fix the broken unit tests, but
that's out of scope.

 

A possible partial solution would be to convert to TestNG - and tell it
to run in JUnit mode.  Problem is, when you do that, you can't mark
tests in groups and only run the "good" ones.

 

To make matters worse, we're using Spring (usually a good thing), and
have tests which extend Spring's base test classes.  Running those in
TestNG (not in JUnit mode, so we can turn off bad tests) fails.  The old
version of Spring is 2.0, and 2.5 added Spring functionality for TestNG
(and we can't upgrade on these projects).

 

Anybody know of a way to get TestNG to be able to run and ignore tests
in JUnit mode?

 

Here is a sample class. We want to run the first two tests (that pass)
and skip the last test (that is known to fail, hence the group) WITHOUT
adding testng tags to the tests that pass.

 

Anybody have any ideas?  We've posted to the TestNG forums, but we're
trying to figure this out before the weekend...

 

Thanks in advance...

 

 

Douglas Bullard

 

 

Here's a sample class

 

public class TestNG_Junit extends TestCase 
{ 
public void testtrue() 
{ 
assertTrue(true); 
} 
public void testDoubleFalse() 
{ 
assertFalse(false); 
} 
/** 
* @testng.test groups = "failed" 
*/ 
public void testfalse() 
{ 
assertTrue(false); 
} 
}

 

Here's the testng.xml file:

 

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Generated Suite">

  <test verbose="1" name="dummy tests" annotations="javadoc"

        junit="true">

    <groups>

      <run>

          <exclude name="failed"  />

      </run>

    </groups>

    <packages>

      <package name="*"/>

    </packages>

  </test>

</suite>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pjug.org/pipermail/javamail/attachments/20090716/c1d070f5/attachment.html 


More information about the Javamail mailing list