有关如何通过 TSS 使用数据池的信息,请参阅 API 文档。
要显示 TSS 文档:
要和 Functional Tester 一起使用 TestManager,请将以下导入语句添加到 Functional Tester 脚本:
import com.rational.test.tss.*;
要和 Functional Tester 一起使用 TestManager,数据池名称必须包含完整路径(数据池处要使用双反斜线)。 如果您使用 UNIX®,那么文件分隔符是正斜线。
关于 TestManager 集成的说明:Functional Tester 已与 Rational TestManager V7.0.2 集成。如果您具有 7.0.2 版本的 TestManager,那么将能够使用 Functional Tester 和 TestManager 的集成功能。
示例:
import resources.testOutHelper;
import com.rational.test.ft.*;
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.script.*;
import com.rational.test.ft.value.*;
import com.rational.test.ft.vp.*;
import com.rational.test.tss.*;
public class testOut extends testOutHelper
{
public void testMain (Object[] args)
{
boolean test;
String strval2;
try{
//create datapool object
TSSDatapool dp = new TSSDatapool();
//open datapool named testdpool
dp.open("testdpool");
//Fetch first row of data from datapool
test = dp.fetch();
//Loop 5 times through datapool for(int i = 0; i<5; i++)
{
//Get string value from custname column
DatapoolValue dpv = dp.value("custname");
strval2 = dpv.toString();
System.out.println("Name is " + strval2);
test = dp.fetch();
}
}
catch (Exception e) {
System.out.println("Exception occurred");
}
}
}
}