- PyUnit . . . . 30 matches
=== TestCase ===
PyUnit에서는 TestCase는 unittest모듈의 TestCase 클래스로서 표현된다.testcase 클래스를 만들려면 unittest.TestCase를 상속받아서 만들면 된다.
=== 간단한 testcase 의 제작. 'failure', 'error' ===
class DefaultWidgetSizeTestCase(unittest.TestCase):
테스팅을 하기 위해 Python의 assert 구문을 사용한다. testcase가 실행될 때 assertion을 실행하면 AssertionError 가 일어나고, testing framework는 이 testcase를 'failure' 했다고 정의할 것이다. 'assert' 를 명시적으로 써놓지 않은 부분에서의 예외가 발생한 것들은 testing framework 에서는 'errors'로 간주한다.
testcase를 실행하는 방법은 후에 설명할 것이다. testcase 클래스를 생성하기 위해 우리는 생성자에 아무 인자 없이 호출해주면 된다.
testCase = DefaultWidgetSizeTestCase ()
만일 testcase가 많아지면 그들의 set-up 코드들도 중복될 것이다. 매번 Widget 클래스를 테스트하기 위해 클래스들마다 widget 인스턴스를 만드는 것은 명백한 중복이다.
class SimpleWidgetTestCase(unittest.TestCase):
class DefaultWidgetSizeTestCase(SimpleWidgetTestCase):
class WidgetResizeTestCase(SimpleWidgetTestCase):
class SimpleWidgetTestCase (unittest.TestCase):
=== 여러개의 test method를 포함한 TestCase classes ===
종종, 많은 작은 test case들이 같은 fixture를 사용하게 될 것이다. 이러한 경우, 우리는 DefaultWidgetSizeTestCase 같은 많은 작은 one-method class 안에 SimpleWidgetTestCase를 서브클래싱하게 된다. 이건 시간낭비이고,.. --a PyUnit는 더 단순한 메커니즘을 제공한다.
class WidgetTestCase (unittest.TestCase):
defaultSizeTestCase = WidgetTestCase ("testDefaultSize")
resizeTestCase = WidgetTestCase ("testResize")
=== TestSuite : testcase들의 집합체 ===
widgetTestSuite.addTest (WidgetTestCase ("testDefaultSize"))
widgetTestSuite.addTest (WidgetTestCase ("testResize"))
- CppUnit . . . . 22 matches
= UnitTest TestCase의 작성 =
Test Case 가 될 Class는 {{{~cpp CppUnit::TestCase }}} 를 상속받는다.
== ExampleTestCase.h ==
#ifndef CPP_UNIT_EXAMPLETESTCASE_H
#define CPP_UNIT_EXAMPLETESTCASE_H
#include <cppunit/TestCase.h>
class ExampleTestCase : public CppUnit::TestCase
CPPUNIT_TEST_SUITE( ExampleTestCase ); // TestSuite
CPPUNIT_TEST( testExample ); // TestCase 의 등록.
== ExampleTestCase.cpp ==
#include "ExampleTestCase.h"
CPPUNIT_TEST_SUITE_REGISTRATION( ExampleTestCase ); // TestSuite 를 등록하기. TestRunner::addTest 가 필요없다.
void ExampleTestCase::testExample () // 테스트 하려는 함수.
void ExampleTestCase::setUp () // fixture 관련 셋팅 코드.
void ExampleTestCase::tearDown () // fixture 관련 셋팅 코드.
#include <cppunit/TestCase.h>
class SimpleTestCase : public CppUnit::TestCase {
CPPUNIT_TEST_SUITE ( SimpleTestCase );
CPPUNIT_TEST_SUITE_REGISTRATION (SimpleTestCase);
=== 준비 - 2 TestCase 만들기를 위한 세팅 ===
- RandomWalk2/재동 . . . . 20 matches
class ReaderTestCase(unittest.TestCase):
class BoardTestCase(unittest.TestCase):
class MoveRoachTestCase(unittest.TestCase):
class AllCaseTestCase(unittest.TestCase):
class ReaderTestCase(unittest.TestCase):
class BoardTestCase(unittest.TestCase):
class MoveRoachTestCase(unittest.TestCase):
class ReaderTestCase(unittest.TestCase):
class BoardTestCase(unittest.TestCase):
class MoveRoachTestCase(unittest.TestCase):
- ScheduledWalk/석천 . . . . 11 matches
아직 Acceptance TestCase 를 거치지 않은 1차 완료 버전은 다음과 같습니다.
자. 이제 슬슬 ["RandomWalk2/TestCase"] 에 있는 ["AcceptanceTest"] 의 경우가 되는 예들을 하나하나 실행해봅니다.
["RandomWalk2/TestCase"] 에 대해서도 ok.
["RandomWalk2/TestCase2"] 의 Test1,2,3 에 대해서 ok. 오. 그럼 더이상의 테스트가 의미가 없을까요?
["RandomWalk2/TestCase"] 에서 멈췄다면 큰일날 뻔 했군요. 테스트는 자주 해줄수록 그 프로그램의 신용도를 높여줍니다. 일종의 Quality Assurance 라고 해야겠죠.
최종 테스트 (["RandomWalk2/TestCase"], ["RandomWalk2/TestCase2"]) 를 만족시키는 코드.
#include "ScheduledWalkTestCase.h"
==== ScheduledWalkTestCase.h ====
==== ScheduledWalkTestCase.cpp ====
#include "ScheduledWalkTestCase.h"
- VonNeumannAirport/1002 . . . . 10 matches
#include <cppunit/TestCase.h>
class TestOne : public CppUnit::TestCase {
class TestOne : public CppUnit::TestCase {
#include <cppunit/TestCase.h>
class TestOne : public CppUnit::TestCase {
#include <cppunit/TestCase.h>
class TestConfigurationBasic : public CppUnit::TestCase {
class TestConfigurationCityTwo : public CppUnit::TestCase {
class TestConfigurationCityThree : public CppUnit::TestCase {
class TestAirport : public CppUnit::TestCase {
- 오목/인수 . . . . 10 matches
==== OmokTestCase.java ====
import junit.framework.TestCase;
public class OmokTestCase extends TestCase {
public OmokTestCase(String arg) {
==== OmokUITestCase.java ====
import junit.framework.TestCase;
public class OmokUITestCase extends TestCase {
public OmokUITestCase(String arg) {
- ProjectEazy/Source . . . . 9 matches
class EazyWordTestCase(unittest.TestCase):
class EazyDicTestCase(unittest.TestCase):
class EazyParserTestCase(unittest.TestCase):
suite.addTest(unittest.makeSuite(EazyParserTestCase, 'test'))
suite.addTest(unittest.makeSuite(EazyWordTestCase, 'test'))
suite.addTest(unittest.makeSuite(EazyDicTestCase, 'test'))
- 미로찾기/상욱&인수 . . . . 9 matches
=== MazeTestCase ===
import junit.framework.TestCase;
public class MazeTestCase extends TestCase {
public MazeTestCase(String title) {
=== ComplexMazeTestCase ===
import junit.framework.TestCase;
public class ComplexMazeTestCase extends TestCase {
- TFP예제/Omok . . . . 8 matches
=== TestCaseBoard.py ===
class BoardTestCase (unittest.TestCase):
suite = unittest.makeSuite (BoardTestCase, "test")
=== TestCaseOmok.py ===
class OmokTestCase (unittest.TestCase):
suite = unittest.makeSuite (OmokTestCase, "test")
- TestDrivenDevelopmentByExample/xUnitExample . . . . 8 matches
class TestCase:
class WasRun(TestCase):
class TestCaseTest(TestCase):
TestCaseTest("testTemplateMethod").run()
TestCaseTest("testResult").run()
TestCaseTest("testFailedResult").run()
TestCaseTest("testFailedResultFormatting").run()
- 3N+1Problem/Leonardong . . . . 7 matches
class AOI3nPlus1ProblemTestCase(unittest.TestCase):
class AOI3nPlus1ProblemTestCase(unittest.TestCase):
class MyTestCase(unittest.TestCase):
timeTest = MyTestCase("testTime")
- GuiTestingWithMfc . . . . 7 matches
#include "GuiTestCase.h"
runner.addTest (GuiTestCase::suite());
#include <cppunit/TestCase.h>
class GuiTestCase : public CppUnit::TestCase {
CPPUNIT_TEST_SUITE(GuiTestCase);
runner.addTest (GuiTestCase::suite());
- JUnit/Ecliipse . . . . 7 matches
다음으로 자신이 테스트를 하고 싶은 메서드에 체크를 하고 Finish 하면 TestCase를 상속받는 새 클래스를 자동으로 생성하여 줍니다.
public class Ch03_01Test extends TestCase {
* @see TestCase#setUp()
* @see TestCase#tearDown()
public class Ch03_01Test extends TestCase {
* @see TestCase#setUp()
* @see TestCase#tearDown()
- MagicSquare/재동 . . . . 6 matches
class MagicSquareTestCase(unittest.TestCase):
class MagicSquareTestCase(unittest.TestCase):
class CounterTestCase(unittest.TestCase):
- JTDStudy/첫번째과제/상욱 . . . . 5 matches
import junit.framework.TestCase;
public class NumberBaseBallGameTest extends TestCase {
* 테스트 코드를 갖고 어떻게 해야하는지 잘 모르겠어요. import junit.framework.TestCase 구문이 있던데 이것은 어디서 가져와야 하나요? -_-;; - [문원명]
import junit.framework.TestCase;
public class JUnit38Test extends TestCase {
- ProjectPrometheus/Journey . . . . 5 matches
* TestCase 통과 위주 ZeroPageServer 에서 TestCase 돌려봄
* TestCase 만들어 둔것을 상속 받아서, 다시 다른 테스트를 수행 시키는 기법이 정말 흥미로웠다. 진짜 신기하다. 생각하면 할수록 신기하다.
* test {{{~cpp TestCase}}}
* 모든 {{{~cpp TestCase TestSuite}}} 는 독립적으로 실행할수 있다.
- TestCase . . . . 5 matches
TestCase란 만들고자 하는 대상이 잘 만들어졌다면 무사히 통과할 일련의 작업을 말한다. TestCase는 작성하고자하는 모듈의 내부 구현과 무관하게
XP에서 TestCase를 먼저 작성함으로서 프로그래머가 내부 구현에 신경쓰다가 정작 그 원하는 동작(예를 들어, 다른 모듈과의 인터페이스)을 놓칠 위험을 줄여준다. 왜냐하면, 프로그래머는 먼저 만든 TestCase를 통과하는 것을 첫번 목표로 삼을 수 있기 때문이다.
-> Xp 에서 프로그래머는 TestCase 를 통과하는 것을 목표를 삼는다. 그래서 구현이나 디자인에 신경쓰다 원하는 모듈을 오동작으로 이끄는 위험을 줄인다.
- 만년달력/인수 . . . . 5 matches
=== CalendarTestCase.java ===
import junit.framework.TestCase;
public class CalendarTestCaseTest extends TestCase {
public CalendarTestCaseTest(String arg) {
- CubicSpline/1002/test_NaCurves.py . . . . 4 matches
class TestGivenFunction(unittest.TestCase):
class TestLagrange(unittest.TestCase):
class TestPiecewiseLagrange(unittest.TestCase):
class TestSpline(unittest.TestCase):
- EightQueenProblem/강석천 . . . . 4 matches
=== BoardTestCase.py ===
class BoardTestCase (unittest.TestCase):
suite = unittest.makeSuite (BoardTestCase, "test")
- MineSweeper/Leonardong . . . . 4 matches
class MineSweeperTestCase(unittest.TestCase):
class MineGroundTestCase(unittest.TestCase):
- PrimaryArithmetic/1002 . . . . 4 matches
class PrimaryArithmeticTest(unittest.TestCase):
class PrimaryArithmeticTest(unittest.TestCase):
class PrimaryArithmeticTest(unittest.TestCase):
class PrimaryArithmeticTest(unittest.TestCase):
- PrimaryArithmetic/sun . . . . 4 matches
import junit.framework.TestCase;
public class NumberGeneratorTest extends TestCase {
import junit.framework.TestCase;
public class PrimaryArithmeticTest extends TestCase {
public void testCases() {
- TFP예제/WikiPageGather . . . . 4 matches
=== WikiPageGatherTestCase.py ===
class WikiPageGatherTestCase (unittest.TestCase):
suite = unittest.makeSuite (WikiPageGatherTestCase, "test")
- Vending Machine/dooly . . . . 4 matches
import junit.framework.TestCase;
public class PerchaseItemTest extends TestCase {
import junit.framework.TestCase;
public class RegistItemTest extends TestCase {
- 몸짱프로젝트/BinarySearchTree . . . . 4 matches
class BinartSearchTreeTestCase(unittest.TestCase):
class BinartSearchTreeTestCase(unittest.TestCase):
- 2002년도ACM문제샘플풀이/문제A . . . . 3 matches
int numberOfTestCase =0;
cin >> numberOfTestCase;
for ( int testCaseNum=0;testCaseNum<numberOfTestCase;testCaseNum++){
- ClassifyByAnagram/김재우 . . . . 3 matches
class AnagramTest( unittest.TestCase ):
import junit.framework.TestCase;
public class AnagramTest extends TestCase {
- FromDuskTillDawn/조현태 . . . . 3 matches
int numberOfTestCase = 0;
sscanf(readData, "%d", &numberOfTestCase);
for (register int i = 0; i < numberOfTestCase; ++i)
- TugOfWar/강희경 . . . . 3 matches
def InputTestCaseNumber():
n = input('TestCaseNumber: ')
testCaseNumber = InputTestCaseNumber()
for i in range(0, testCaseNumber):
- 3N+1Problem/황재선 . . . . 2 matches
class ThreeNPlusOneTest(unittest.TestCase):
class ThreeNPlusOneTest(unittest.TestCase):
- ClassifyByAnagram/Passion . . . . 2 matches
import junit.framework.TestCase;
public class AnagramTest extends TestCase {
- ClassifyByAnagram/박응주 . . . . 2 matches
class AnagramTestCase(unittest.TestCase):
- ClassifyByAnagram/재동 . . . . 2 matches
class AnagramTestCase(unittest.TestCase):
- Counting/황재선 . . . . 2 matches
import junit.framework.TestCase;
public class TestCounting extends TestCase {
- EightQueenProblem/Leonardong . . . . 2 matches
class EightQueenTestCase(unittest.TestCase):
- ErdosNumbers/황재선 . . . . 2 matches
for(int testCase = 0; testCase < scenario; testCase++) {
erdos.printErdosNumber(testCase, name);
import junit.framework.TestCase;
public class TestErdosNumbers extends TestCase {
- HowManyFibs?/황재선 . . . . 2 matches
import junit.framework.TestCase;
public class TestFibonacci extends TestCase {
- HowManyZerosAndDigits/임인택 . . . . 2 matches
import junit.framework.TestCase;
public class MyTest extends TestCase {
- JTDStudy/첫번째과제/장길 . . . . 2 matches
import junit.framework.TestCase;
public class testBaseball extends TestCase {
- JollyJumpers/Leonardong . . . . 2 matches
class JollyJumperTestCase(unittest.TestCase):
- JollyJumpers/신재동 . . . . 2 matches
import junit.framework.TestCase;
public class JollyJumperTest extends TestCase {
- JollyJumpers/임인택 . . . . 2 matches
import junit.framework.TestCase;
public class TestJJ extends TestCase {
- JollyJumpers/황재선 . . . . 2 matches
import junit.framework.TestCase;
public class TestJollyJumpers extends TestCase {
- LoadBalancingProblem/Leonardong . . . . 2 matches
class SuperComputerTestCase(unittest.TestCase):
- Memo . . . . 2 matches
class TestObserverPattern(unittest.TestCase):
class TestCompany(unittest.TestCase):
- MineSweeper/황재선 . . . . 2 matches
import junit.framework.TestCase;
public class TestMineSweeper extends TestCase {
- NUnit . . . . 2 matches
* 어떠한 클래스라도 즉시 Test를 붙일수 있다. (반면 JUnit 은 TestCase 를 상속받아야 하기 때문에, 기존 product소스가 이미 상속 상태라면 Test Fixture가 될수 없다. )
* Java 1.5 에 메타 테그가 추가되면 NUnit 방식의 TestCase 버전이 나올것 같다. 일단 이름의 자유로움과, 어떠한 클래스라도 Test가 될수 있다는 점이 좋왔다. 하지만, TestFixture 를 붙여주지 않고도, 목표한 클래스의 Test 들을 실행할 수 있는 방식이면 어떨까 생각해 본다. --NeoCoin
- NUnit/C++예제 . . . . 2 matches
// TestCase.h
namespace TestCase
- PrimaryArithmetic/Leonardong . . . . 2 matches
class TemplateTestCase(unittest.TestCase):
- ProjectPrometheus/AT_BookSearch . . . . 2 matches
class TestAdvancedSearch(unittest.TestCase):
class TestSimpleSearch(unittest.TestCase):
- ProjectPrometheus/AT_RecommendationPrototype . . . . 2 matches
class TestCustomer(unittest.TestCase):
class TestRecommendationSystem(unittest.TestCase):
- RandomWalk2 . . . . 2 matches
* ["RandomWalk2/TestCase"]
* ["RandomWalk2/TestCase2"]
- RandomWalk2/ExtremePair . . . . 2 matches
class ManTestCase(unittest.TestCase):
- ReverseAndAdd/신재동 . . . . 2 matches
class ReverseAndAdderTestCase(unittest.TestCase):
- ReverseAndAdd/황재선 . . . . 2 matches
class ReverseAndAddTestCase(unittest.TestCase):
for testcase in range(num):
- Self-describingSequence/황재선 . . . . 2 matches
import junit.framework.TestCase;
public class TestDescribingSequence extends TestCase {
- SeminarHowToProgramIt/Pipe/vendingmachine.py . . . . 2 matches
class TestVendingMachine(unittest.TestCase):
class TestVendingMachineVerification(unittest.TestCase):
- Slurpys/신재동 . . . . 2 matches
class SlurpysTestCase(unittest.TestCase):
- Slurpys/황재선 . . . . 2 matches
class SlurpysTestCase(unittest.TestCase):
- SpiralArray/Leonardong . . . . 2 matches
class SpiralArrayTest(unittest.TestCase):
class SpiralArrayTest(unittest.TestCase):
- TestDrivenDatabaseDevelopment . . . . 2 matches
import junit.framework.TestCase;
public class SpikeRepositoryTest extends TestCase {
- TheTrip/Leonardong . . . . 2 matches
class TheTripTestCase(unittest.TestCase):
- TriDiagonal/1002 . . . . 2 matches
class TestLuDecomposition(unittest.TestCase):
class TestTridiagonal(unittest.TestCase):
- UglyNumbers/황재선 . . . . 2 matches
class UglyNumbersTestCase(unittest.TestCase):
- WeightsAndMeasures/황재선 . . . . 2 matches
class WeightsAndMeasuresTestCase(unittest.TestCase):
- 몸짱프로젝트/CrossReference . . . . 2 matches
class CrossReferenceTestCase(unittest.TestCase):
- 몸짱프로젝트/InfixToPrefix . . . . 2 matches
class ExpressionConverterTestCase(unittest.TestCase):
- 실시간멀티플레이어게임프로젝트 . . . . 2 matches
class CalculatorTestCase(unittest.TestCase):
- 2002년도ACM문제샘플풀이/문제E . . . . 1 match
* {{{~cpp TestCase}}}를 살펴보다 보니, 열라 어이없는 규칙을 발견하고 맘.
- BabyStepsSafely . . . . 1 match
public class TestGeneratePrimes extends TestCase
- CubicSpline/1002/test_lu.py . . . . 1 match
class TestLuDecomposition(unittest.TestCase):
- CubicSpline/1002/test_tridiagonal.py . . . . 1 match
class TestTridiagonal(unittest.TestCase):
- EightQueenProblem/김형용 . . . . 1 match
class TestEightQueenProblem(unittest.TestCase):
- EightQueenProblemDiscussion . . . . 1 match
즉, 실제 Queen의 위치들을 정의하는 재귀호출 코드인데요. 이 부분에 대한 TestCase 는 최종적으로 얻어낸 판에 대해 올바른 Queen의 배열인지 확인하는 부분이 되어야 겠죠. 연습장에 계속 의사코드를 적어놓긴 했었는데, 적어놓고 맞을것이다라는 확신을 계속 못했죠. 확신을 위해서는 테스트코드로 뽑아낼 수 있어야 할텐데, 그때당시 이 부분에 대해서 테스트코드를 못만들었죠.
- ErdosNumbers/임인택 . . . . 1 match
class TestErdos(unittest.TestCase):
- GuiTestingWithWxPython . . . . 1 match
class TestFrame(unittest.TestCase):
- IpscLoadBalancing . . . . 1 match
class TestLoadBalancing(unittest.TestCase):
- JTDStudy/첫번째과제/정현 . . . . 1 match
public class BaseBallTest extends TestCase{
- LoadBalancingProblem/임인택 . . . . 1 match
public class TestLoadBalancing extends TestCase{
- Ones/1002 . . . . 1 match
class OnesTest(unittest.TestCase):
- PNGFileFormat/FormatUnitTestInPythonLanguage . . . . 1 match
class TestPngFormat(unittest.TestCase):
- PyIde/Exploration . . . . 1 match
unittest 모듈을 프린트하여 Code 분석을 했다. 이전에 cgi 로 test runner 돌아가게끔 만들때 구경을 해서 그런지 별로 어렵지 않았다. (조금 리팩토링이 필요해보기는 코드같긴 하지만.. JUnit 의 경우 Assert 가 따로 클래스로 빠져있는데 PyUnit 의 경우 TestCase 에 전부 implementation 되어서 덩치가 약간 더 크다. 뭐, 별 문제될 부분은 아니긴 하다.
- ReverseAndAdd/남상협 . . . . 1 match
class testPalindrome(unittest.TestCase):
- Slurpys/박응용 . . . . 1 match
class SlurpyTest(unittest.TestCase):
- SmallTalk/문법정리 . . . . 1 match
TempTestCase>>initialize
- SpiralArray/임인택 . . . . 1 match
class MyTest(unittest.TestCase):
- SummationOfFourPrimes/1002 . . . . 1 match
class PrimeNumberTest(unittest.TestCase):
- TestFirstProgramming . . . . 1 match
어떻게 보면 질답법과도 같다. 프로그래머는 일단 자신이 만들려고 하는 부분에 대해 질문을 내리고, TestCase를 먼저 만들어 냄으로서 의도를 표현한다. 이렇게 UnitTest Code를 먼저 만듬으로서 UnitTest FrameWork와 컴파일러에게 내가 본래 만들고자 하는 기능과 현재 만들어지고 있는 코드가 하는일이 일치하는지에 대해 어느정도 디버깅될 정보를 등록해놓는다. 이로서 컴파일러는 언어의 문법에러 검증뿐만 아니라 알고리즘 자체에 대한 디버깅기능을 어느정도 수행해주게 된다.
- TugOfWar/남상협 . . . . 1 match
class testTugOfWar(unittest.TestCase):
- VonNeumannAirport/Leonardong . . . . 1 match
class TestDistance(unittest.TestCase):
- ZP&COW세미나 . . . . 1 match
class AppleTest(unittest.TestCase):
- 만년달력/김정현 . . . . 1 match
public class TestCalendar extends TestCase{
- 최소정수의합/임인택 . . . . 1 match
class TestMinInt(unittest.TestCase):
Found 94 matching pages out of 7555 total pages (5000 pages are searched)
You can also click here to search title.