Search code examples
rft

Invoke RFT method from java class


We are building an excel based IBM RFT framework, for which we want to invoke RFT individual methods(not the test script that can be executed from command line) from an external java file.

Anyone has an insight on this?

Thanks in Advance.

-Sreenisha Sreenivasan


Solution

  • How about making RFT script as the driver script and reading the excel and executing the method..

    public void testMain(Object[] args) 
    {
    
        String method = getNextAction();
        TestObject target  = getNextTarget();   
        //Using RFT's method here, Own Implementation preferred
        FtReflection.invokeMethod(method, target);      
    }
    //Get the next object to perform action on
    TestObject getNextTarget()
    {
           //Here do the operation of finding the object that may be from map or obtained using  find() api of rft 
          return untitledNotepadwindow();
    }
    //Get the next action to be performed, this should actually return an
    //object that has a name to invoke , and arguments  to be passed.
    String getNextAction()
    {
        return "close";
    }