Tutorial - 16 : How to pass parameters from one script to another by CallScript Method
using IBM Rational Functional Teste...
*/
public void testMain (Object[] args)
{
callScript("TheCalled");
String[] dataToPass = new String[4];
dataToPass[0] = "t...
System.out.println( " arg["+i+"] = "+args[i]);
}
}
}

Tutorial by :
http://www.softwaretestinggenius.com
Upcoming SlideShare
Loading in...5
×

Tutorial - 16 : How to pass parameters from one script to another by CallScript Method using IBM RFT

2,664

Published on

How to pass parameters from one script to another by CallScript Method using IBM Rational Functional Tester - RFT

Published in: Technology, Business
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
2,664
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
111
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Tutorial - 16 : How to pass parameters from one script to another by CallScript Method using IBM RFT

  1. 1. Tutorial - 16 : How to pass parameters from one script to another by CallScript Method using IBM Rational Functional Tester - RFT This article presents a simple method of using the different signatures of the callScript method to pass data from one script to another using IBM RFT The example uses two different Functional Tester scripts: a) Script - 1: TheCaller, which calls another script and passes parameters b) Script - 2: TheCalled, which receives the parameters and prints them to System.out TheCaller script further uses three different versions of the callScript method: Version - 1: Without additional parameters: This is the default usage of the callScript method, which will execute the specified script. callScript("TheCalled"); Version - 2: With additional string array parameter: An array of strings is used to pass string parameters to the called script. String[] dataToPass = new String[4]; ... callScript("TheCalled",dataToPass); Version - 3: With additional object array parameter: An array of objects is used to pass different object type parameters to the called script. Object[] objdataToPass = new Object[4]; ... callScript("TheCalled",objdataToPass); The TheCaller script sample had been recorded as under: import resources TheCallerHelper; import com.rational.test.ft.*; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.object.interfaces.SAP.*; import com.rational.test.ft.object.interfaces.siebel.*; import com.rational.test.ft.script.*; import com.rational.test.ft.value.*; import com.rational.test.ft.vp.*; /** * Description : Functional Test Script * @author Administrator */ public class TheCaller extends TheCallerHelper { /** * Script Name : TheCaller * Generated : Feb 10, 2008 7:24:08 PM * Description : Functional Test Script * Original Host : WinNT Version 5.1 Build 2600 (S) * * @since 2008/02/10 * @author Administrator
  2. 2. */ public void testMain (Object[] args) { callScript("TheCalled"); String[] dataToPass = new String[4]; dataToPass[0] = "this"; dataToPass[1] = "is"; dataToPass[2] = "really"; dataToPass[3] = "cool"; callScript("TheCalled",dataToPass); Object[] objdataToPass = new Object[4]; objdataToPass[0] = new String("Thought the previous was cool?"); objdataToPass[1] = "Take this one!"; objdataToPass[2] = new Float(0.02); objdataToPass[3] = new Integer(4711); callScript("TheCalled",objdataToPass); } } The TheCalled script uses a simple loop to print the received parameters to System.out: import resources.TheCalledHelper; import com.rational.test.ft.*; import com.rational.test.ft.object.interfaces.*; import com.rational.test.ft.object.interfaces.SAP.*; import com.rational.test.ft.object.interfaces.siebel.*; import com.rational.test.ft.script.*; import com.rational.test.ft.value.*; import com.rational.test.ft.vp.*; /** * Description : Functional Tester Script * @author Administrator */ public class TheCalled extends TheCalledHelper { /** * Script Name : TheCalled * Generated : Feb 10, 2008 7:24:08 PM * Description : Functional Test Script * Original Host : WinNT Version 5.1 Build 2600 (S) * * @since 2008/02/10 * @author Administrator */ public void testMain (Object[] args) { if (args.length < 1) { System.out.println( "Expected at least 1 arg, however we got: "+args.length); return; } else { System.out.println( "Got: "+args.length+" args"); } for (int i = 0; i < args.length; ++i) {
  3. 3. System.out.println( " arg["+i+"] = "+args[i]); } } } Tutorial by : http://www.softwaretestinggenius.com

×