Citrix 테스트에 사용자 정의 코드 사용

사용자 정의 Java™ 코드를 작성하여 IBM® Rational® Performance Tester의 기능을 확장할 수 있습니다.

시작하기 전에

사용자 정의 코드를 작성하려면 Java 프로그래밍 및 Rational Performance Tester API의 사용에 대한 지식이 있어야 합니다. 자세한 정보는 사용자 정의 코드로 테스트 실행을 참조하십시오.

이 태스크 정보

테스트 동기화에 사용자 정의 코드를 사용하려면 다음을 수행하십시오.

프로시저

  1. 테스트 네비게이터에서 테스트 요소 위치를 선택하여 사용자 정의 코드를 삽입하십시오.
  2. 삽입 > 사용자 정의 코드를 클릭하십시오. 사용자 정의 테스트 요소가 테스트에 작성됩니다.
  3. 테스트 요소 세부사항 페이지에서 코드 생성을 클릭하여 Rational Performance Tester API를 기반으로 하는 Java 클래스를 작성하십시오. 코드 보기를 클릭하여 기존 클래스를 편집할 수 있습니다.
  4. Java 편집기에서 Citrix 테스트에 대한 import 문을 추가하십시오. import com.ibm.rational.test.lt.execution.citrix.customcode.*;
  5. 기능이 작성되도록 지정하려면 exec 메소드를 완료하십시오.
  6. Java 클래스를 저장하고 닫으십시오.

다음 예제는 동기점의 결과를 평가하기 위한 시작점으로 사용할 수 있는 사용자 정의 코드 클래스입니다. 이 템플리트를 사용하여 이미지 동기화 및 창 이벤트 동기화가 사용자의 테스트에 실용적이지 않은 경우 동기화를 수행하는 클래스를 작성할 수 있습니다.

import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;
import org.eclipse.hyades.test.common.event.VerdictEvent;
import com.ibm.rational.test.lt.execution.citrix.customcode.CitrixCustomCodeImpl2;
import com.ibm.rational.test.lt.execution.citrix.customcode.ICitrixCustomCode2;

public String exec(ITestExecutionServices tes, String[] args) {
	ICitrixCustomCode2 thisCode = new CitrixCustomCodeImpl2(tes);

	// to get the last VP status
	int verdict = thisCode.getLastVerificationPointVerdict();
	if (verdict != VerdictEvent.VERDICT_PASS) {
	
		// this example reports a message but must be adapted to your specific needs
		tes.getTestLogManager().reportMessage("last VP status: " + thisCode.verdictEventToString(verdict));

	}
	return null;
}

다음 예제는 디버깅을 목적으로 재생을 하는 동안 화면 캡처를 레코딩할 수 있는 방법을 보여줍니다. 화면 캡처가 테스트 로그에 레코딩되어 이 화면 캡처를 Citrix 이미지 동기화 보기에서 볼 수 있습니다.

import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices; 
import com.ibm.rational.test.lt.execution.citrix.customcode.*;

public String exec(ITestExecutionServices tes, String[] args) { 
	
	ICitrixCustomCode2 thisCode = new CitrixCustomCodeImpl2(tes); 
	
	// To capture and log the full screen: 
	thisCode.logFullScreenCapture(); 
	
	// To capture and log a part of the screen: 
	// thisCode.logPartialScreenCapture(x, y, width, height); 
	
	// To capture and log a part of the screen to a file: 
	// thisCode.savePartialScreenCapture(filename, x, y, width, height); 
	
	return null; 
}

다음에 수행할 작업

사용자 정의 코드 테스트를 작성하면 평소처럼 테스트를 실행할 수 있습니다. 테스트를 디버깅해야 하는 경우 모니터링 패널을 사용하여 중단점을 삽입하거나 실행 중 Citrix 환경과 상호작용할 수 있습니다.

피드백