보고서에 사용자 정의 카운터 추가

사용자 정의 코드를 사용하여 성능 보고서에 사용자 정의 카운터를 추가할 수 있습니다. 테스트 실행 후 사용자 정의 카운터의 결과는 기본 Performance Test 카운터가 집계되는 방법과 동일한 방법으로 자동 집계됩니다(예: 바이트 카운터와 페이지 카운터). 사용자 정의 카운터의 집계는 모든 에이전트 컴퓨터에서 결합됩니다.
참고: 사용자 정의 카운터를 Run, Pages 또는 다른 루트 요소 아래 배치하지 않은 경우에는 실행 통계 카운터 추가/제거 창에 사용자 정의 카운터에 대한 정보가 포함되지 않습니다.

다음 코드를 사용하여 사용자 정의 카운터를 추가할 수 있습니다. 테스트를 실행한 후 결과에서 보고서로 사용자 정의 카운터를 끌어서 놓거나 추가/제거 마법사를 사용하여 보고서에 사용자 정의 카운터를 표시할 수 있습니다.

package CustomCounter;

import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;

/**
 * @author unknown
 */
public class Class implements
		com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {

	/**
	 * Instances of this will be created using the no-arg constructor.
	 */
	public Class() {
	}

	/**
	 * For javadoc of ICustomCode2 and ITestExecutionServices interfaces, select 'Help Contents' in the
	 * Help menu and select 'Extending Rational Performance Tester functionality' -> 'Extending test execution with custom code'
	 */
	public String exec(ITestExecutionServices tes, String[] args) {tes.getStatisticsManager().getStatTree().getDistribution(new String[]{"Custom Counter","MyTest","MyValue"})
		.submitDataPoint(Double.valueOf(Math.random()*100.).longValue());

		return null;
	}

}

피드백