더 많은 제어 특성 추가

Functional Tester에서는 액세스 및 특성 검증에 사용할 일련의 제어 특성을 제공합니다. getProperties()getProperty() API를 확장하여 더 많은 제어 특성을 추가할 수 있습니다.
표 1에 나열되어 있는 프록시 메소드를 확장할 수 있습니다.
표 1. 확장 가능한 프록시 메소드
Java .Net
java.util.Hashtable getProperties() System.Collections.Hashtable GetProperties()
Object getProperty(String propertyName) object GetProperty(string propertyName)
다음 샘플에서는 새 특성 ToolTipText를 추가합니다. 동일한 방법으로 추가하고 싶은 만큼 특성을 추가할 수 있습니다.

다음 샘플은 Java™에서 새 특성을 추가하는 방법을 보여줍니다.

import com.rational.test.ft.domain.*;

public class someProxy extends baseProxy
{
 .
 .
 public java.util.Hashtable getProperties()
 {
    java.util.Hashtable properties = super.getProperties();
    try
    {
	properties.put("toolTipText", getTooltipText());
    }
    catch (Throwable e)
    {
    } // in the odd case we can't get the artifical properties, just ignore them.
    return properties; 
 }
 .
 .
 .
 public Object getProperty(String propertyName)
 {
    if (propertyName.equals("toolTipText"))
	return getTooltipText();
    return super.getProperty(propertyName);
 } 
}

다음 샘플은 .Net에서 새 특성을 추가하는 방법을 보여줍니다.

using Rational.Test.Ft.Domain;

public class AnyProxy:BaseProxy
{
     .
     .
     .
    public override System.Collections.Hashtable GetProperties()
    {
        System.Collections.Hashtable propertyTable = base.GetProperties(); 
        
         if( !propertyTable.Contains("ToolTipText"))
         {
	object text = GetToolTipText();
	if (text != null)
	  propertyTable.Add("ToolTipText", text );
         }
         return propertyTable;
    }
    .
    .
    .
   public override object GetProperty(string propertyName)
   {
       object propertyValue = null ;
       if (propertyName == "ToolTipText" )
       {
         propertyValue = GetToolTipText();
       }	
       else 
       {
         propertyValue = base.GetProperty(propertyName) ;
       }
       return propertyValue ;
   }
이 프록시 코드를 정상적으로 개발하여 배치하고 나면 새 특성 ToolTipText이 제어에 추가됩니다. 제어에서 getProperty("toolTipText") API를 실행하여 이를 확인할 수 있습니다.

피드백