7.16 Multiple usecases in a single script

You can define multiple usecases within a single script. This is useful to allow usecases to share common code, and each usecase can provide a single piece of functionality.

Each usecase requires its own usecase definition block which begins with a USECASE header. When defining usecases in the same script, they can share options and validation functions but the entry point to each usecase must be unique.
Multiple usecase blocks can be defined as a single multiline comment at the top of the script:

Example 7-14 Examples

USECASE
...
...
$Run$ mainMethod

USECASE
...
...
$Run$ entry2
...
def mainMethod(options):
    print "Running the first main method"
...

def entry2(script, param1):
    print "Running the second main method"
...
Multiple usecase blocks can be defined as separate blocks dispersed throughout the script:

Example 7-15 Examples

USECASE
...
...
$Run$ mainMethod
...
def mainMethod(options):
    print "Running the first main method"
...
USECASE
...
...
$Run$ entry2
...
def entry2(script, param1):
    print "Running the second main method"
...
There is no limit to how many usecases you can define in a single script.
Non-ConfidentialPDF file icon PDF versionARM DUI0446W
Copyright © 2010-2015 ARM. All rights reserved.