How to use number variable in test case

I need to use integer variable in test case. How should I call?

I declared local variable ‘acc_num’ with default value type ‘Number’ and default value as ‘10000’.

I used this for calling variable->
Mobile.setText(findTestObject(‘account_number’), acc_num, 0)

But this is displaying error->
Test Cases/JoinHaggle FAILED because (of) groovy.lang.MissingMethodException: No signature of method: static is applicable for argument types: (java.lang.String, java.lang.Integer, java.lang.Integer) values: [account_number, 10000, 1]
Possible solutions: setText(com.kms.katalon.core.testobject.TestObject, java.lang.String, int), setText(com.kms.katalon.core.testobject.TestObject, java.lang.String, int, com.kms.katalon.core.model.FailureHandling), getText(com.kms.katalon.core.testobject.TestObject, int), getText(com.kms.katalon.core.testobject.TestObject, int, com.kms.katalon.core.model.FailureHandling)

Test Cases/

setText takes expects a string as third parameter.
Try this:
Mobile.setText(findTestObject(‘account_number’), toString(acc_num), 0)

I want integer. Then what do I need to use?

Did you try it?

Mobile.setText(), as the name suggests, sets some text to your element (presumably some input field). Groovy’s toString() will convert your integer to string, but I think it will send ‘10000’ to your input field anyway. Try and see what happens.

It is giving error.
Can you tell any other method to set numbers in text field (other than setText)?


[Mobile] Send Keys

I will elaborate again what I need to do exactly.
I want to increment account number with each iteration of for loop.

Something like this->

int acc_no = 1000 // This is local variable
for (def i = 1; i < 10; i++) {
// set acc_no in text field account_number
// increment acc_no by 100 with each iteration of loop

How can I do this?

Please use String.valueOf(<your_variable>)


Thank you… It worked…

duyluong said:

Please use String.valueOf(<your_variable>)

It works for me…