7.17 Multiple use cases in a single script

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

Each use case requires its own use case definition block which begins with a USECASE header. When defining use cases in the same script, they can share options and validation functions but the entry point to each use case must be unique.

Multiple use case blocks can be defined as a single multiline comment at the top of the script:

Example 7-15 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 use case blocks can be defined as separate blocks dispersed throughout the script:

Example 7-16 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 use cases you can define in a single script.

Non-ConfidentialPDF file icon PDF versionARM DUI0446Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.