0
votes

Tool: IBM Mobilefirst TestWorkbench 8.6.0.1
OS: Windows 7

Have an app which displays 3 text boxes, two to input numbers and a third displays the sum of numbers
Record a test. (Enter number in each of the two text box; the result is displayed in the third test box)

While playback, is it possible to store the numbers in variables, add them and cross-verify with result that the app displays ?

The above would help us to verify transactions in banking applications

2
Shouldn't that verification be done in the bank's backend rather than in the app?Idan Adar
Yeah, that's right. Not generalizing my question for just a bank app. But in general, is it possible to capture data on screens and store them in variables and do operations on them ?Design Trodd
Currently being tested. There will hopefully be an answer in the coming hours.Idan Adar

2 Answers

0
votes

yes, it is possible

  • First, create a variable in your script (open 'Text Resources' node, right click on 'Test Variables' and choose 'Add' menu
  • Then, in the mobile data view, right-click on the element that contain the number, and choose 'Create a variable assignment from Text' and assign the value to the variable you have just created before
  • Do the same for the second variable
  • Then at the point of the script where you want to do the sum, just add a custom code splitting first the script (menu 'Split Mobile or Web UI actions..') and insert a custom code (menu 'Insert > Custom Code' on the 'In application' node that you have just created)
  • Add the 2 variables as parameters of the custom code and implement the sum

You can find custom code examples here http://www-01.ibm.com/support/knowledgecenter/SSBLQQ_8.7.0/com.ibm.rational.test.lt.common.doc/topics/textndteswcc.html?cp=SSBLQQ_8.7.0%2F0-6-11-0&lang=en

Dominique

0
votes

Find below Custon Code i have used for doing the operation i mentioned in the question(Edited a bit)

In "Custom Code Details" Add arguments. args[0] in code refers to the first argument added in "Custom Code Details".

package customcode;
import org.eclipse.hyades.test.common.event.VerdictEvent;
import com.ibm.rational.test.lt.kernel.services.ITestExecutionServices;

/**
 * @author unknown
 */
public class Class implements
        com.ibm.rational.test.lt.kernel.custom.ICustomCode2 {

    /**
     * Instances of this will be created using the no-arg constructor.
     */
    public Class() {
    }

    /**
     * For javadoc of ICustomCode2 and ITestExecutionServices interfaces, select 'Help Contents' in the
     * Help menu and select 'Extending Rational Performance Tester functionality' -> 'Extending test execution with custom code'
     */
    public String exec(ITestExecutionServices tes, String[] args) {

        String L4_InitBalance = args[1];
        String L1_InitBalance = args[0];

        String L4_FinalBalance = args[3];
        String L1_FinalBalance = args[2];



        if((L4_InitBalance == L4_FinalBalanc)&&(L1_InitBalance == L1_FinalBalance))
            tes.getTestLogManager().reportVerificationPoint("SFT PASSED",VerdictEvent.VERDICT_PASS,"SFT has PASSED");
        else
            tes.getTestLogManager().reportVerificationPoint("SFT FAILED",VerdictEvent.VERDICT_FAIL,"SFT has FAILED");

        return null;
    }

}