내용으로 건너뛰기
권남
사용자 도구
로그인
사이트 도구
검색
도구
문서 보기
이전 판
역링크
최근 바뀜
미디어 관리자
사이트맵
로그인
>
최근 바뀜
미디어 관리자
사이트맵
추적:
java:junit:contiperf
이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요.
====== ContiPerf ====== * [[http://databene.org/contiperf|ContiPerf 2]] 성능 테스트 * [[http://mvnrepository.com/artifact/org.databene/contiperf|ContiPerf Maven Repository]] * [[http://blog.javabenchmark.org/2013/03/continuous-performance-and-junit-with.html|Java Benchmark: Continuous Performance and JUnit with ContiPerf]] ===== Test Code ===== <code java> public class UserSerializerTest { @Rule public ContiPerfRule contiPerfRule = new ContiPerfRule(); @Test @PerfTest(invocations = 200, threads = 2) // 2개 쓰레드에서 200번(각 100번)호출 @Required(max = 1200, average = 250) // 테스트 통과조건 public void shouldSerializeRandomUser() throws JAXBException { // ... } } </code> ===== 테스트 코드 작동구조 ===== > 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'' 지정된 횟수(''invocations'') 혹은 시간(''duration/rampup'')대로 호출 * ''@After'' 테스트 메소드당 한 번만 호출 예를들어 테스트 메소드가 ''test1()'', ''test2()'' 두 개이고, ''invocations=1000''이라면 다음과 같이 실행된다. <code> constructor() before() test1() * 1000 회 수행 after() constructor() before() test2() * 1000 회 수행 after() </code> ===== @PerfTest 옵션들 ===== * ''invocations'' : 테스트의 총 호출 횟수 * ''threads'' : 쓰레드 갯수 * ''rampup'' : 최초에는 1개 쓰레드로 시작해 rampup 시간(ms)가 지날 때 마다 쓰레드 한개씩 증가시켜 최종 ''threads''갯수까지 증가시킨다. * ''duration'' : 전체 쓰레드갯수가 꽉찬 상태로 테스트를 진행할 시간(ms). ''invocations''과 함께 안사용하는것이 맞을 듯. * ''warmup'' : 지정된 시간(ms)가 지난 후 부터 성능 측정을 하라는 의미. 보통은 ''rampup''시간이 다지나 쓰레드가 꽉차는 시간(''(rampup -1) * threads'')을 지정한다. 그러면 rampup 시간을 제외한 Full Thread로 작동한 시간에 대해서만 측정한다. * ''timer'' : 테스트 호출 사이사이마다 사용자 인터랙션 하듯이 잠시간의 중지시간 주기<code java> timer = RandomTimer.class, timerParams = { 30, 80 } // ConstantTimer, RandomTimer, CumulatedTimer </code> ===== @Required : 테스트 성공 조건 기술 ===== * ''@Required(throughput = 20)'' : Requires to have at least 20 test executions per second * ''@Required(average = 50)'' Requires an average execution time of not more than 50 milliseconds * ''@Required(median = 45)'' : Requires that 50% of all executions do not take longer than 45 milliseconds * ''@Required(max = 2000)'' : Requires that no invocation takes more than 2000 milliseconds (2 seconds) * ''@Required(totalTime = 5000)'' : Requires that the sum of all execution times is not more than 5000 milliseconds (5 seconds) * ''@Required(percentile90 = 3000)'' : Requires that 90% of all executions do not take longer than 3000 milliseconds * ''@Required(percentile95 = 5000)'' : Requires that 95% of all executions do not take longer than 5000 milliseconds * ''@Required(percentile99 = 10000)'' : Requires that 99% of all executions do not take longer than 10000 milliseconds * ''@Required(percentiles = "66:200,96:500")'' : Requires that 66% of all executions do not take longer than 200 milliseconds and 96% of all executions do not take longer than 500 milliseconds ===== 임시 작동 중단 ===== * 시스템 프라퍼티 ''contiperf.active=false''지정. * Maven <code sh> mvn test -DargLine="-Dcontiperf.active=false" </code> ===== Bug ===== <code> java.lang.NoSuchFieldException: fNext </code> JUnit 최신 버전과 안 맞아서 생기는 오류. JUnit 버전을 다운그레이드(4.11 이하) 할 것.
java/junit/contiperf.txt
· 마지막으로 수정됨: 2016/04/22 08:26 저자
kwon37xi
문서 도구
문서 보기
이전 판
역링크
맨 위로