Topic
  • 3 replies
  • Latest Post - ‏2013-10-22T07:54:55Z by OttoDiesel
MightyM
MightyM
4 Posts

Pinned topic Use RFT from a Java Application

‏2013-10-21T07:23:08Z |

Good morning,

I've created a new Java Project and added a new Class to it called "Test" with following code:

 

importcom.rational.test.ft.object.interfaces.DomainTestObject;

importcom.rational.test.ft.script.RationalTestScript;

 

public classTest {

public static void main(String[] args) {

DomainTestObject[] domains = RationalTestScript.getDomains();

System.out.println("domains: " + domains.length);

}

}

 

But when i run the application (as a Java Application) i get following exception:

Exception in thread "main" com.rational.test.ft.sys.Transaction$NotInTransactionException

I also tried "com.rational.test.ft.sys.Transaction.begin();" at the beginning of the main method, but then I get another exception:

Exception in thread "main" java.lang.Error: only a client test context can begin a transaction

 

Can anybody help me?

FYI: If I run the exactly same code in a RFT project, I get no exception and the console successfully prints the length of the domain array.

Regards MightyM

Updated on 2013-10-21T07:24:11Z at 2013-10-21T07:24:11Z by MightyM
  • cagin.uludamar
    cagin.uludamar
    66 Posts

    Re: Use RFT from a Java Application

    ‏2013-10-21T11:50:41Z  

    Why are you trying to get domains from a Java app?

  • MightyM
    MightyM
    4 Posts

    Re: Use RFT from a Java Application

    ‏2013-10-21T12:16:50Z  

    Because I finally want to control RFT from JBehave and not reversed. So I thought I start trying to implment RFT in a simple Java Application. The getDomains command is just for trying out whether I can use RFT from a Java application.

    Regards

  • OttoDiesel
    OttoDiesel
    51 Posts

    Re: Use RFT from a Java Application

    ‏2013-10-22T07:54:55Z  

    I posted a possible solution a few minutes ago in this thread:

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000013981010&ps=25