°Ù¶È¿Õ¼ä | °Ù¶ÈÊ×Ò³ 
 
ÎÄÕÂÁбí
 
ÄúÕýÔڲ鿴 "¿ª·¢¹¤¾ß" ·ÖÀàϵÄÎÄÕÂ

2008-11-27 16:56

l If you are running your JUnit 4 tests with a JUnit 3.x runner, write a suite() method that uses the JUnit4TestAdapter class to create a suite containing all of your test methods:

Àà±ð£º¿ª·¢¹¤¾ß | ÆÀÂÛ(1) | ä¯ÀÀ()
 
2008-11-27 14:19

JUnit Cookbook

Kent Beck, Erich Gamma

Simple Test Case

When you need to test something, here is what you do:

  1. Annotate a method with @org.junit.Test
  2. When you want to check a value, import org.junit.Assert.* statically, call assertTrue() and pass a boolean that is true if the test succeeds
For example:
Àà±ð£º¿ª·¢¹¤¾ß | ÆÀÂÛ(0) | ä¯ÀÀ()
 
     
 
 
ÎÄÕ·ÖÀà
 
 
 
 
 
Jbi(8)
 
 
 
Jta(1)
 
 
 
     
 
ÎÄÕ´浵
 
 
 
 
 
 
 
 
 
 
     
 
×îÐÂÎÄÕÂÆÀÂÛ
   
 
     


©2009 Baidu