EndSubroutine Command

Description:

This command defines the end of a discrete section of code which is bound by the SUBROUTINE and ENDSUBROUTINE commands.
Subroutines are called from the main code with a "CALL subroutine_name" command. They return control to the main code by use of the RETURN command or when the ENDSUBROUTINE is reached.
Subroutines share the same variable definitions as the main code.

Format:

Subroutine subroutineName(parameters)
    statements
Endsubroutine

Parameters:

subroutineName

The name of the subroutine. This must be a valid AgileLoad Dataname and must be unique within the Script

parameters

The subroutine parameters, a comma-separated list of defined variables.

Example:

string szFirstName;
string szLastName;
integer iID;

subroutine MySubroutine()
    log "in MySubroutine";
endsubroutine

subroutine LogNameAndId(szFirstName, szLastName, iID)
    log "Hello " + szFirstName + szLastName + ", your ID is: " + ToString(iID);
endsubroutine

BEGIN

Call MySubroutine();
Call LogNameAndId("John", "Smith", 12);

Output:

in MySubroutine
Hello John Smith, your ID is: 12





Go back to the Learning center:


Copyright © AgileLoad. All rights reserved.
Agile Load testing tool| Contact AgileLoad | Terms of Use | Sitemap