查看完整版本: 如果将RFT的script提出来单独运行

baozouxx 2007-11-7 20:49

如果将RFT的script提出来单独运行

用了一段RFT,做了几个测试脚本(工程),现在想将他们都集到一个swing的界面中,想实现从一个界面(通过点击各个按钮)分别去调用各个测试工程。
不知道能实现吗?RFT的script会不会离开Funtional Tester就不能运行了?
谢谢!!

eagleyes125 2007-11-8 14:17

就我本人所用的经验,RFT的scripts离开RFT是不能运行的。

但你说的那个想法是完全可以实现的,你每调一个工程,其实只是工程名的不同罢了,你可以先实现每个工程的命令行执行,然后再在swing界面里把工程名参数化一下,就可以实现你的调用了。

baozouxx 2007-11-8 17:04

谢谢你的回复..
再请问,应该将每个RFT以什么样的格式导出,让swing调用呢?

5am 2007-11-13 16:12

command line?

bellcliff 2007-11-19 17:49

RFT帮助文档中有关于如何使用命令行的详细介绍

但是,script的命令行执行同样必须在安装了RFT的pc上

lovetest6 2007-11-20 15:38

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
页: [1]
查看完整版本: 如果将RFT的script提出来单独运行