51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3089|回复: 3
打印 上一主题 下一主题

[转]将RFT的script提出来单独运行

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-12-14 23:14:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
在一个论坛中无意看到的,觉得不错,转到这里来与大家分享下

Generally speaking you would need to create a new JVM that starts with the same options as we start RFT normally.
So you need to pass the startup.jar that you will find in the installation location.

Question to ask is what exactly is meant by starting RFT engine?
Maybe you can figure out something from this:
It is meant to call an RFT script from another RFT project.

<<<---

public void testMain(Object[] args) throws IOException, InterruptedException
{
//Give the relevant details
String workspace = "C:\\Documents and Settings\\Administrator\\IBM\\rationalsdp7.0\\Workspace\\";
String project = "Project2";
String script = "Script2";
Object parameters = "\"param 1\" \"param 2\""; //Declare this only if parameters need to be passed
Process process;
File file = new File(workspace +File.separatorChar+ project + File.separatorChar + script.replace('.',File.separatorChar) + ".java");
if (!file.exists())
{
System.out.println("Can't find " + script + " in " + project);
System.exit(0);
}
script = script + " ";

String command = "\""+System.getenv("IBM_RATIONAL_RFT_ECLIPSE_DIR")+ File.separatorChar +
"jdk" + File.separatorChar + "bin" + File.separatorChar + "java\"" + " -jar "+ "\"" +
System.getenv("IBM_RATIONAL_RFT_INSTALL_DIR") + File.separatorChar + "rational_ft.jar\""
+ " -playback " + script + parameters + " -datastore \"" + workspace + project + "\"";
process = Runtime.getRuntime().exec(command);
process.waitFor();
}

The customer needs to append this code his script wherever he needs to use callScript() to invoke a script that is not in the current project.
The customer Overwirtes the String workspace with his current workspace as well as project & Script with the concerned project or script that he wants to run.
The parameters should be enterered carefully. each parameter to be passed should be enclosed within quotes like
\"Parameter 1\"
If there is no parameter to be passed then the object parameter may be left blank.


PLEASE SEE THAT "PROJECT->BUILD AUTOMATICALLY" IS CHECKED BEFORE TRYING THIS WORKAROUND.
This method does not invoke scripts that are not in the current workspace
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-12-17 10:35:10 | 只看该作者
确切的说,这应该不是“把脚本提出来单独运行”,而只是在一个RFT项目中运行的另一个RFT项目的脚本。
我一直希望能将脚本编译成单独的可执行包,一个最基本的要求就是在没有安装RFT的机器上也能运行RFT的测试脚本,但是一直没有实验成功
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2009-12-17 13:30:05 | 只看该作者

回复 2# 的帖子

照你说的功能来做,企不是自己再做一个Rational Function Test工具啦.....

想法很值的提倡,但这可能会是一个非常曲折而漫长的过程,哈哈哈

[ 本帖最后由 centurystone 于 2009-12-17 13:31 编辑 ]
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2009-12-24 16:20:44 | 只看该作者

回复 2# 的帖子

以前我也梦想可以这样做,但是后来以失败告终,最后想想,QTP不也不行嘛,为何一定要让RFT也行呢。

其实相关调用到的Jar包是可以一个一个找出来的的,只不过运行RFT时的Agent就没有办法做了。
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-22 01:20 , Processed in 0.074317 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表