JUnit v 3 7 Introduction Design Test Case

  • Slides: 19
Download presentation
JUnit v 3. 7 Introduction

JUnit v 3. 7 Introduction

Design – Test. Case II n Command Pattern

Design – Test. Case II n Command Pattern

Design – Test. Case IV n Template Method Pattern public void run() { set.

Design – Test. Case IV n Template Method Pattern public void run() { set. Up(); run. Test(); tear. Down(); }

Design – Test. Result III n Collecting Parameter Pattern public void run( Test. Result

Design – Test. Result III n Collecting Parameter Pattern public void run( Test. Result result ) { result. start. Test( this ); set. Up(); run. Test(); tear. Down(); }

Design – Test. Result IV n Collecting Parameter Pattern

Design – Test. Result IV n Collecting Parameter Pattern

Design – Test. Result V n Some Methods of Test. Result public synchronized void

Design – Test. Result V n Some Methods of Test. Result public synchronized void add. Error( Test test, Throwable t ) { f. Errors. add. Element( new Test. Failure(test, t) ); } public synchronized void add. Failure( Test test, Throwable t ) { f. Failures. add. Element( new Test. Failure(test, t) ); }

Design – Test. Case VI Pluggable Selector n Reflection 을 이용해 어떤 메소 드를

Design – Test. Case VI Pluggable Selector n Reflection 을 이용해 어떤 메소 드를 테스트할 지를 결정한다. n void run. Test() throws Throwable { Method run. Method = get. Class(). getmethods(f. Name, new Class[0]); run. Method. invoke(this, new Class[0]); }

Design – Test. Case VII n Adapter Pattern n Test. Case 를 확장하여 run.

Design – Test. Case VII n Adapter Pattern n Test. Case 를 확장하여 run. Test() 메소드를 오버라이딩 하여 같은 목적을 달성한다.

Design – Test. Case VIII

Design – Test. Case VIII

Design – Test. Suite II n Composite Pattern n 기본 개념 l l l

Design – Test. Suite II n Composite Pattern n 기본 개념 l l l Component: 외부에서 다루고자 하는 객체의 인터페이스 Composite: 스스로 Component이면서 다른 여러 Component를 포함 Leaf: Component이나 다른 Component를 포함하지는 않음

Design – Test. Suite III n Composite Pattern

Design – Test. Suite III n Composite Pattern