Decorators aren't limited to a single decoration. For example, in Java™ I/O, it is possible to decorate a FileInputStream
with an InputStreamReader
with a BufferedReader
(just remember this: BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream("infilename"), "UTF8"))
).
Decoration can happen on multiple levels, and so it is with JUnitPerf's TimedTest
s and LoadTest
s. When these two classes decorate each other, it leads to some compelling test scenarios, such as one where a load is placed on a business case and a time threshold is also applied. Or we could just combine the previous two test scenarios as follows:
- Place a load on the
testCreate()
method. - Specify that every thread must finish within the time threshold.
Listing 4 shows what happens when I apply the above specifications by decorating a normal Test
with a LoadTest
, which is decorated by a TimedTest
:
Listing 4. A decorated load and timed test
public static Test suite() { int users = 10; Timer timer = new ConstantTimer(100); long maxElapsedTime = 2000; return new TimedTest(new LoadTest( new WidgetDAOImplTest("testCreate"), users, timer), maxElapsedTime); } |
As you see, the testCreate()
method is run 10 times (each thread launching 100 milliseconds apart), and each thread must complete within two seconds or the entire test scenario will fail.
출처 : Tong - exospace님의 JAVA통
==
위와 같은 방식으로, 기존 JUnit Test case를 Thread수, Thread당 수행 시간, 허용가능 응답시간으로 나눠서 테스트가 가능함.
대신 리포팅 기능이 약한데.
Japex는 리포팅 기능이 매우 강력한 반면, 허용 가능 응답시간이 없는것이 단점.
'ALM > Test Automation' 카테고리의 다른 글
Cobertura를 이용한 커버러지 테스트시 주의할 사항 (1) | 2008.01.17 |
---|---|
Cactus 테스트시 주의 할점 (0) | 2008.01.17 |
단위 테스트 1회 (JUnit) (1) | 2007.11.23 |
Test Coverage 분석툴 (0) | 2007.11.08 |
Cactus 실행용 ANT 스크립트 (0) | 2007.09.13 |