How to use output value from keyword in a test case?

How about concatenate the Integers that you made into a String and then return the String back to your program.

As an example,

@Keyword
def String randomSSN() {
	Random rand = new Random();
	// Generate random SSN.
	int ssn1ssn = rand.nextInt(600)+100;
	int ssn2ssn = rand.nextInt(89)+10;
	int ssn3ssn = rand.nextInt(8999)+1000;
	// return random SSN
	return "${ssn1ssn.toString()}-${ssn2ssn.toString()}-${ssn3ssn.toString()}";
}

And then, like @Dave_Evers has:
Test case:

def SSN = CustomKeywords.'App.appFunctions.randomSSN'();
System.out.println(SSN);
1 Like