사용자 도구

사이트 도구


java:junit:contiperf

차이

문서의 선택한 두 판 사이의 차이를 보여줍니다.

차이 보기로 링크

양쪽 이전 판 이전 판
다음 판
이전 판
java:junit:contiperf [2015/11/23 13:53]
kwon37xi [Test Code]
java:junit:contiperf [2016/04/22 08:26] (현재)
kwon37xi [Bug]
줄 1: 줄 1:
 ====== ContiPerf ====== ====== ContiPerf ======
   * [[http://databene.org/contiperf|ContiPerf 2]] 성능 테스트   * [[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]]   * [[http://blog.javabenchmark.org/2013/03/continuous-performance-and-junit-with.html|Java Benchmark: Continuous Performance and JUnit with ContiPerf]]
  
줄 8: 줄 9:
    
     @Rule     @Rule
-    public ContiPerfRule = new ContiPerfRule();+    public ContiPerfRule contiPerfRule = new ContiPerfRule();
            
     @Test     @Test
줄 18: 줄 19:
     }     }
 } }
 +</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> </code>
  
 ===== @PerfTest 옵션들 ===== ===== @PerfTest 옵션들 =====
-  * ''invocations'' +  * ''invocations'' : 테스트의 총 호출 횟수 
-  * ''threads'' +  * ''threads'' : 쓰레드 갯수 
-  * ''warmup''+  * ''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 
  
-===== 테스트 코드 작동구조 ===== +===== 임시 작동 중단 ===== 
-> First the @Before method is calledThen 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.+  * 시스템 프라퍼티 ''contiperf.active=false''지정. 
 +  * Maven <code sh> 
 +mvn test -DargLine="-Dcontiperf.active=false" 
 +</code>
  
-  * ''@Before'' 메소드 호출 +===== Bug ===== 
-  * ''@Test'' 메소드 지정된 횟수대로 호출 +<code> 
-  * ''@After'' 메소드 호출+java.lang.NoSuchFieldException: fNext 
 +</code> 
 +JUnit 최신 버전과 안 맞아서 생기는 오류. JUnit 버전을 다운그레이(4.11 이하) 할 것.
  
java/junit/contiperf.1448256181.txt.gz · 마지막으로 수정됨: 2015/11/23 13:53 저자 kwon37xi