Modify the generated scripts to support access by multiple users.
Therefore, you must modify the generated code using LoadRunner parameterization techniques. Usually, this means changing constant strings into variable references or other expressions.
In addition to the LoadRunner API documentation, see the API documentation for the SAP Mobile Platform LoadRunner extension, which is installed in SMP_HOME\Servers\LoadRunnerAPI\docs\api.
For example, consider this generated Action method:
public int Action() { lr.debug_message(lr.MSG_CLASS_BRIEF_LOG, "Action1"); key_Customer_create_address = "A"; key_Customer_create_city = "C"; key_Customer_create_company_name = "Sybase"; key_Customer_create_fname = "F"; key_Customer_create_id = "10001"; key_Customer_create_lname = "L"; key_Customer_create_phone = "1234567890"; key_Customer_create_state = "S"; key_Customer_create_zip = "12345"; tx = "Action1_Customercreate_Online_Request"; lr.start_transaction(tx); try { SAP.Mobile.LoadRunner.HwcMessage m1 = hwc.OnlineRequest ( hwc.Screen("Customercreate"), hwc.Action("Online_Request"), hwc.Values ( hwc.Value("Customer_create_id_paramKey", hwc.NUMBER, _ key_Customer_create_id), hwc.Value("Customer_create_fname_paramKey", hwc.STRING, _ key_Customer_create_fname), hwc.Value("Customer_create_lname_paramKey", hwc.STRING, _ key_Customer_create_lname), hwc.Value("Customer_create_address_paramKey", hwc.STRING, _ key_Customer_create_address), hwc.Value("Customer_create_city_paramKey", hwc.STRING, _ key_Customer_create_city), hwc.Value("Customer_create_state_paramKey", hwc.STRING, _ key_Customer_create_state), hwc.Value("Customer_create_zip_paramKey", hwc.STRING, _ key_Customer_create_zip), hwc.Value("Customer_create_phone_paramKey", hwc.STRING, _ key_Customer_create_phone), hwc.Value("Customer_create_company_name_paramKey", _ hwc.STRING, key_Customer_create_company_name), hwc.Value("ErrorLogs", hwc.LIST) ) ); hwc.ExpectScreen(m1, "Customercreate"); lr.end_transaction(tx, lr.PASS); } catch (System.Exception _ex_1) { lr.error_message(_ex_1.ToString()); lr.end_transaction(tx, lr.FAIL); } return 0; }
To avoid creating the same name for all customers, you might change the "Sybase" constant to an expression. For example:
key_Customer_create_company_name = "Company" + Math.Abs(lr.vuser_id);