E D R , A S I H C RSS

Test Suite Examples

여러 UnitTestFramework에서 TestSuite를 사용하는 예제들

PyUnit

~cpp 
import unittest
from TestA import *
from TestB import *

class AllTests(unittest.TestSuite):
	def suite(self):
		suit = TestSuite()
		suite.addTest(TestA())
		suite.addTest(TestB())
                return suit # 빼도 되더라..


# 사실 AllTests 자체를 완전히 빼버려도 됩니다. 그 이유는 from import *을 하기 때문입니다.

if __name__=='__main__':
	unittest.main(argv=('','-v'))

혹은

~cpp 
import unittest 
 
def suite(): 
    return unittest.defaultTestLoader.loadTestsFromNames( ('ThePackage.test_file1','ThePackage.subpack.test_file2')) 
 
if __name__=='__main__': 
    unittest.TextTestRunner(verbosity=2).run(suite()) 
 

JUnit


~cpp 
import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests {
	public static Test suite() {
		TestSuite suite = new TestSuite("Test for test");
		suite.addTestSuite(LoginTest.class);
		suite.addTestSuite(QueryObjectTest.class);
		return suite;
	}
}
 
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:11
Processing time 0.0180 sec