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

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