[PJUG Javamail] TestNG issues with JDK 1.4/Junit

Lyle T. Harris lyle.harris at gmail.com
Fri Jul 17 14:21:28 EDT 2009


Not sure if this will work but have you tried including
and excluding by method name?  If this works, you
wouldn't even need to edit your existing JUnit code.

<test name="Test1">
  <classes>
    <class name="example1.Test1">
      <methods>
        <include name=".*enabledTestMethod.*"/>
        <exclude name=".*brokenTestMethod.*"/>
      </methods>
     </class>
  </classes>
</test>



Bullard, Douglas wrote:
>
> 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>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Web Site - http://www.pjug.org/
> Javamail mailing list
> Javamail at pjug.org
> http://www.pjug.org/mailman/listinfo/javamail
>   

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


More information about the Javamail mailing list