Examples of using Metadata

The following excerpts show examples of how you can use dynamic metadata in your test code.

Configuring command line arguments

The following example shows how you can apply a conditional command line argument to your test run, based on the type of compiled file used to create the test fixture file or executable. By moving the appropriate -report value to the MFU-GLOBAL-COMMANDLINE-ARG variable, the appropriate report will be generated.

...
entry MFU-GLOBAL-COMMANDLINE-PREFIX & "CMDOPT".

       $if ilgen set
         $if nojvmgen set
            move "-verbose -high-res-timer:true -report:nunit" to MFU-GLOBAL-COMMANDLINE-ARG
        $else
           move "-verbose -high-res-timer:true -report:junit" to MFU-GLOBAL-COMMANDLINE-ARG
        $end
       $else
           move "-verbose -high-res-timer:true -report:markdown" to MFU-GLOBAL-COMMANDLINE-ARG
       $end
        goback
...

Configuring global metadata

The following example is an excerpt that demonstrates metadata being applied to all test cases in the test run. In this example, all test cases in the file TestRunName will be assigned the trait of 'fulltest'.

...
entry MFU-GLOBAL-METADATA-PREFIX & "TestRunName".
	move "fulltest" to MFU-MD-TRAITS
	goback
...

Configuring specific test case metadata

The following example is an excerpt that demonstrates metadata that can be applied to an individual test case. In this example, a number of details are added to the test case 'TestCase1'.

...
entry MFU-TC-METADATA-SETUP-PREFIX & "TestCase1".
           move "This is an example of a dynamic description" to MFU-MD-TESTCASE-DESCRIPTION
           move 3000 to MFU-MD-TIMEOUT-IN-MS
           move "smoke" to MFU-MD-TRAITS
           set MFU-MD-SKIP-TESTCASE to false
           move MFU-MD-TESTCASE-PRIORITY-LOW to MFU-MD-TESTCASE-PRIORITY
           goback.
...