run applies Template Method A subclass can selectively override these methods

Run applies template method a subclass can

This preview shows page 9 - 15 out of 15 pages.

TestCase.run() applies Template Method A subclass can selectively override these methods; if it overrides only runTest , for example, there will be no special setUp or tearDown behaviour. 9
Image of page 9
TestCase: runTest() A given test case class may implement many different methods, each defining a single test case. –Each test case has a descriptive name like testAdd or testRemove. –The test cases don’t conform to a simple command interface. Our next problem is make all the test cases look the same from the point of view of the invoker of the test. 10
Image of page 10
Adapter pattern springs to mind. Adapter has the following intent "Convert the interface of a class into another interface clients expect". Adapter 11
Image of page 11
. . 12
Image of page 12
public interface Test { public abstract void run(); } Figure 3: TestSuite applies Composite 13
Image of page 13
public class TestSuite implements Test { private Vector fTests= new Vector(); public void run() { for (Enumeration e=fTests.elements();e.hasMoreElements(); ) { Test test = (Test)e.nextElement(); test.run(result); } } public voidaddTest(Test test) { fTests.addElement(test); } } 14
Image of page 14
15 Figure 4: JUnit Patterns Summary 4. Summary
Image of page 15

You've reached the end of your free preview.

Want to read all 15 pages?

  • Fall '15
  • OLIVIADAS
  • Design pattern, developer, Software design patterns, public void, Project Automation

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture