Troubleshooting
Problem
This technote explains how the callScript() method can return a value
Resolving The Problem
In IBM® Rational® XDE™ Tester, the callScript() method can return a value, but the testMain method of the called script must be edited so that it returns an object instead of void, ex. change
public void testMain (Object args[])
to
public java.lang.Object testMain (Object args[])
In addition, the called script must have a return statement, ex.
String planet = "World";
return planet;
The script using the callScript() method, i.e. the calling script, should be edited so that it accepts the return value, ex.
//Child is the name of the called script
String greeting_part_two = ((String) callScript("Child"));
Here is a very simple example illustrating these principles
Calling script, which is called Parent in this example:
public class Parent extends ParentHelper
{
- public void testMain (Object[] args)
{
- String greeting_part_one = "Hello";
String greeting_part_two = ((String) callScript("Child"));
System.out.println(greeting_part_one + " " + greeting_part_two);
Called script, which is called Child in this example:
public class Child extends ChildHelper
{
- public java.lang.Object testMain (Object[] args)
{
- String planet = "World";
return planet;
Please note that the callScript() method cannot return a value in IBM® Rational® RobotJ v. 2002.05.20 (the previous release of XDE Tester)
Was this topic helpful?
Document Information
More support for:
Rational XDE Tester
Software version:
2003, 2003.06.00, 2003.06.01, 2003.06.12, 2003.06.13
Operating system(s):
Windows
Document number:
335923
Modified date:
16 June 2018
UID
swg21157093