Using the Command Line Interface

You can execute Test Scenarios from the command line. The command line syntax is as follows:

MxVGUI [/n][/s][/l][/m][/mxserve ServerNameOrIPAddress:PortNumber] [/r][prjfile | scnlogfile | RegressionScript] [[scnfile]
  [/sdp scndatafile_path] |[testfile [ …]]]

The options are:

/additionalmxserve  - This switch uses the same syntax as /mxserve, described below. Servers added by this command are prepended to list of servers in the User Settings file. The file is not modified.

 

/AllowMultipleInstances - Allows multiple instances of MxVDev to run at the same time. The switch is case sensitive. It is not possible to run more than one instance of an MxVMC or more than one Simulink model using this option.

CLI-multiple

/n - No graphical interface will be displayed.

/s - Aborts execution of the current Scenario on detection of a failure.

/l - Causes a detailed Scenario log file to be generated.  It will have the same name as the Scenario, but the file extension will be .mxlog.

/m - Causes a command file to be generated.  It will have the same name as the Scenario, but the file extension will be .mxcmd.

/mxform mxformpath - Overrides the .mxform (Harness) file that is specified in the project file or regression script.

/mxserve - This switch must be immediately followed by a comma-separated list of servers in this format: ServerNameOrIPAddress:PortNumber For example:
 
/mxserve Server1:4321,server2:77,srv3:9876
    or
/mxserve "Server1:4321, server2:77, srv3:9876" (quotation marks are required if the list includes spaces)
 
Servers added by this command replace the list of servers read from the User Settings file. The server list is used to find the token host. The User Settings file is not modified.

/r - Run a Scenario or a TestCase

/? - Display help for this Command Line Interface.

/sdp scndatafile_path - The location of the data file for the scnfile (Scenario). MxVDev will only search this location for the external data files used in the TestCases of this Scenario.

/nr - Tells MxVDev to not display the Regression Report upon completion, this overrides the mxreg file options

/rep prjfile [scenarioFolder [pageOrientation color openReportDir]] - Causes a Test Specification Report to be generated. The report can be viewed by clicking on projectDirectory\Test Specification\Report.TestSpecification.xml. If the PDF convert option is used, the converted PDF file can be find in folder projectDirectory\Test Specification\PDF\.

/pdf RegressionReportFolder [destinationFolder pageOrientation color openReportDir] - Convert an existing XML Regression Report which is in the RegressionReportFolder to a PDF file

/t mxtagpath - Loads the specified mxtags file.

Arguments:

mxformpath - The name and path of a Harness (.mxform) file.

mxtagpath - The name and path of a tags (.mxtags) file.

prjfile - Project file (.mxp) name. If a project file and SUT file are not given and /n is not specified, you will have to select a project file to open before doing any MxVDev testing. Otherwise no action is taken.

scnfile - The name of a Scenario (.mxs) file.

testfile - The name of a TestCase (.mxc) file.

scnlogfile - The name of a Scenario log file. Since scnlogfile contains project and Scenario information and loading this file is just for view, there is no need to provide the prj and scn file. If mixed prj, scnlog and scn, tc files are provided, or more than one scnlog file is specified, or /n (no GUI) is specified, no action will be taken.

RegressionScript - The name of a regression script (.mxreg) file.

RegressionReportFolder - The name of an existing regression report folder.

destinationFolder - The name of converted PDF report folder. Default is RegressionReportFolder\PDF\

scenarioFolder - The name of the ScenariosAndTestcases folder for generating Specification Report. Default is the default ScenariosAndTestcases folder in project.

pageOrientation - report PDF page orientation: landscape or portrait. Default is landscape.

color - report PDF color option: color or grayscale. Default is color.

openReportDir - Option to open PDF report directory after conversion: true or false. Default is true.

You can also launch the MxVDev graphical user interface from the command line, and preload TestCases or Scenarios. The syntax is as follows, however note that mixing Scenario and TestCase files is not allowed:

MxVGUI [prjfile] [[scnfile]|[testfile [ …]]]

Notes:

Run the command in the bin subfolder of the installation folder. If you are using a file (such as a .mxreg or .mxp file) as a command argument, include the full path. For example:

CLI

You can use the %MxVDefaultPath% environment variable to set the path, for example:
 
CLI-variable

Enclose a path or filename in double quotes if they contain spaces, for example:
"C:\Project Directory\MXV.mxp" or "%MxVDefaultPath%"\bin\MxVGUI

Do not use "\" or "\\" at the end of a folder name when enclosing the folder in double quotes, for example:
"C:\Scenario Folder" not "C:\Scenario Folder\\"

When running a RegressionScript (.mxreg), there is no need to provide the project file or any other files, for example: MxVGUI "C:\Test Directory\regression.mxreg"

When using "scnlogfile",  there is no need to provide the project file and the scenario file since the scenario log file contains this information. If mixed project files, scenario files, and test case files are provided, no action is taken.

Only one scenario log file is allowed.

When using /r, "prjfile" must be immediately after '/r', and must be followed by one file name to be run. The file name can be a "scnfile" or "testfile". Only one file is allowed.

CLI-R

When using /rep, "prjfile" must be followed by "scenarioFolder" and 3 PDF options.  

When using PDF options in /rep, "scenarioFolder" must be before any PDF options. If all 3 arguments are not present, arguments will be ignored and all defaults will be used.

When using /pdf, "RegressionReportFolder" must be followed by 4 other options. If all 4 arguments are not present, arguments will be ignored and all defaults will be used.

MxVConsole

The mxvconsole command also runs MxVDev, however there are two important differences:

Control is not returned to the command prompt until after MxVDev finishes execution. This is useful when the test is started with a tool such as Jenkins.

No pop-ups or other GUI elements are displayed.

Mxvconsole uses the same switches and arguments as MxVGUI. For example:

"C:\Program Files (x86)\MicroMax\MxSuite 3.40.1.40253\bin\mxvconsole" C:\Users\Documents\MxSuiteSamples\TurnDoorSample\Regression\Regression.mxreg

Return Codes

The currently defined use cases where MxVDev can return a code other than zero are:

Regression Test Return Codes

0 - Success (regression test ran to completion)

1 - Failure (regression test was unable to run for any reason)

2 - Canceled (regression test began running but was interrupted, usually by user)

Single Scenario Return Codes

0 - Pass (Scenario ran and all test cases were evaluated as passing)

1 - Fail (Scenario ran and one or more test cases were evaluated as failing)

2 - Run Time Error (a run-time error occurred during execution of the Scenario, usually caused by an error in VMC code)

3 - Not Complete (Scenario execution was aborted, or some of the test cases were unable to be run)

4 - Skipped (the Scenario contained no runnable test cases, or was set to run forever)

5 - Not Run (Scenario was not run at all, usually due to project setup error)

6 - Missing (usually occurs when a Scenario that is part of a regression test is missing)

Single TestCase Return Codes

Same as single Scenario, since a default Scenario is created for the test case.

 

All other uses of the command line interface should return zero, regardless of the actual outcome.

Related Topics:

MxDiff - Command Line Interface

MxSuite Files and Folders