多个数据池在RFT脚本 [英] More than one datapool to a script in RFT
问题描述
有什么办法,我们可以添加两个数据池到一个脚本?或者换句话说,我们怎样才能从两个不同的数据池输入到一个脚本中。
Is there any way can we add two datapools to a single script? Or in other words how can we get inputs from two different datapools to a single script.
先谢谢了。
推荐答案
是的,你可以手动加载和管理任何数量的数据池。
Yes, you can manually load and manage any number of datapools.
/**
* Creates a IDatapoolIterator pointing the first record
* @param datastore default project path
* @param dataPoolPath relative path in the project
* @return IDatapoolIterator pointing the first record
*/
public static IDatapoolIterator getDataPoolIterator(String datastore, String dataPoolPath)
{
java.io.File dpFile = new java.io.File(datastore, dataPoolPath+".rftdp");
DatapoolScriptSupport dss = new DatapoolScriptSupport();
IDatapool dp = (IDatapool) dss.dpFactory().load(dpFile, true);
IDatapoolIterator dpIter = dss.dpFactory().open(dp, null);
dpIter.dpInitialize(dp);
dpIter.dpReset();
return dpIter;
}
然后在code
then in your code
myDatapool = getDataPoolIterator((String)getOption(IOptionName.DATASTORE), "relative/path/intheproject");
您可以通过
myDatapool.dpString("Variable");
使用取决于你所需要的变量类型的正确方法。使用
Use the correct method depending the type of the variable you need. Using
myDatapool.dpNext();
您将提前在池下一个记录。
希望这会有所帮助。
进一步的信息在这里:<一href=\"http://publib.boulder.ibm.com/infocenter/rfthelp/v7r0m0/index.jsp?topic=/com.rational.test.ft.api.help/ApiReference/com/rational/test/ft/rational_ft.html\"相对=nofollow> IBM帮助系统:数据池
you will advance to the next record in the datapool. Hope this will help. Further informations here: IBM Help System: Datapool
这篇关于多个数据池在RFT脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!