사용자 도구

사이트 도구


java:junit:contiperf

문서의 이전 판입니다!


ContiPerf

Test Code

public class UserSerializerTest {
 
    @Rule
    public ContiPerfRule i = new ContiPerfRule();
 
    @Test
    @PerfTest(invocations = 200, threads = 2) // 2개 쓰레드에서 200번(각 100번)호출
    @Required(max = 1200, average = 250) // 테스트 통과조건
    public void shouldSerializeRandomUser() throws JAXBException {
 
        // ...
    }
}

@PerfTest 옵션들

  • invocations : 테스트의 총 호출 횟수
  • threads : 쓰레드 갯수
  • rampup : 최초에는 1개 쓰레드로 시작해 rampup 시간(ms)가 지날 때 마다 쓰레드 한개씩 증가시켜 최종 threads갯수까지 증가시킨다.
  • duration : 전체 쓰레드갯수가 꽉찬 상태로 테스트를 진행할 시간(ms). invocations과 함께 안사용하는것이 맞을 듯.
  • warmup : 지정된 시간(ms)가 지난 후 부터 성능 측정을 하라는 의미. 보통은 rampup시간이 다지나 쓰레드가 꽉차는 시간((rampup -1) * threads)을 지정한다. 그러면 rampup 시간을 제외한 Full Thread로 작동한 시간에 대해서만 측정한다.

임시 작동 중단

  • 시스템 프라퍼티 contiperf.active=false지정.
  • Maven
    mvn test -DargLine="-Dcontiperf.active=false"

테스트 코드 작동구조

First the @Before method is called. Then the test method is invoked 1,000 times subsequently and finally the @After method(s). ContiPerf 2 supports this behaviour for all JUnit 4 versions since version 4.7.
  • @Before 메소드 호출
  • @Test 메소드 지정된 횟수대로 호출
  • @After 메소드 호출
java/junit/contiperf.1448536895.txt.gz · 마지막으로 수정됨: 2015/11/26 19:51 저자 kwon37xi