通过eclipse中的Java代码调用IBM RFT Script

时间:2015-01-21 13:01:50

标签: java rft

  

我从Java程序调用IBM RFT脚本,RFT部分正在运行   很好,但我想从Java程序中调用RFT脚本。

public class CallRFT 
{

    public static void main(String[] args)
    {
        String rftplaybackArgs[] = new String[]{"-datastore", "C:/Users/aksrivastav/Workspace_Rational/Project1", "-playback", "CROI_TestCases_SearchCompanyByName"};



        try
        {
        Thread.sleep(100);

        }
        catch (Exception e)
        {}

        System.out.println("I got .. + " + rftplaybackArgs.toString());
        // TODO Auto-generated method stub

        com.rational.test.ft.rational_ft.main(rftplaybackArgs);




    }



}
  

执行程序后我收到此错误脚本播放失败:   CRFCN0379E:加载脚本类失败   [CROI_TestCases_SearchCompanyByName]   [抛出java.lang.ClassNotFoundException:   CROI_TestCases_SearchCompanyByName]

1 个答案:

答案 0 :(得分:0)

您可以尝试按以下方式运行:

class MyRunnable implements Runnable{

public void run() 
{
    System.out.println("Executing script ");

    String[] cmdarray = {"\"c:\\Program Files (x86)\\Java\\jre7\\bin\\java.exe\"","-jar", "\"C:\\Program Files (x86)\\IBM\\SDP\\FunctionalTester\\bin\\rational_ft.jar\"","-datastore","C:\\RFTWorkspaces\\InhouseProject\\ProjectOne","-playback","Inhouse"};
    try {
        Runtime.getRuntime().exec(cmdarray);
    } catch (IOException e)
    {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }

}

}