TestOptimal Tutorials

MScript Editor

MScript Editor

This tutorial will cover:

  • Edit Modes
  • Code Assist
  • Find / Replace
  • Collapse / Expand
  • Check Error
  • Code Complexity Metrics

MScript Editor - Edit Modes

When Model opens, Model MScript is displayed:

press down arrow for feature details

MScript Editor - Edit Modes

Three Levels of MScript Triggers:

  • Model - Select "Model" from the dropdown list
  • State - Click on a State in Model Editor
  • Transitions - Click on a Transition in Model Editor

For easy access, "Model" and "MBT Start" are included in dropdown lists for State/Transition.

press down arrow for feature details

MScript Editor - Edit Modes

Read Only Mode:

  • MScript Triggers from Sub-Models are READONLY

MScript Editor - Code Assist

Ctrl-Space / Cmd-Space:

  • On Blank Line - MScript Tag List
  • In MSript Tag Attribute - MScript Function List

press down arrow for feature details

MScript Editor - Code Assist

Ctrl-Space / Cmd-Space:

  • Special Cases:
    • In "op" Attribute - List of Operators
    • In "tags" Attribute - List of Requirement Tags

press down arrow for feature details

MScript Editor - Code Assist

Ctrl-R/Cmd-R - Requirement List / Requirement Details:

  • Requires ALM Plugin Enabled and Configured
  • Opens Requirement List
  • Shows Requirement Details - cursor in filled "tags"

press down arrow for feature details

MScript Editor - Code Assist

Ctrl-M / Cmd-M - Macro List:

  • Pre-Configured Macro List
  • Example Macro "dataset":
    <!--The following establishes the individual dataset ID's, each dataset may have 
    multiple data sheets, ... -->
    <dataset id="your data sheet name" autorewind="true" mode="replace" db="xlsJDBC">
    <!--The following directs TestOptimal to read from the specified data sheet-->
    <sql>select * from [your data sheet name with a suffix $ symbol]</sql>
    <!--The following terminates the dataset tag-->
    </dataset>
    <!--The following directs TestOptimal to load into the internal database from 
    the specified data sheet-->
    <action code="$loadFromDataSource('your data sheet name')"/>
    <!--The following directs TestOptimal to rewind the dataset in-order to start from row 
    zero (0) of the internal database from the specified data sheet at model start-up-->
    <action code="$rewindDataSet('your data sheet name')"/>

MScript Editor - Find / Replace

Ctrl-F / Cmd-F - Find / Replace:

  • Search Not Case Sensitive
  • Default Search for Exact Match
  • Regular Expression - "/regexpr/"
  • Replace Once
  • Replace All

press down arrow for feature details

MScript Editor - Find / Replace

ShortCut Keys:

  • Ctrl-G / Cmd-G - Find Next
  • Shift-Ctrl-G / Cmd-Cmd-G - Find Previous
  • Shift-Ctrl-F / Shift-Cmd-F - Replace Once
  • Shift-Ctrl-R / Shift-Cmd-R - Replace All

More Info at: MScript Editor ShortCut Keys

MScript Editor - Expand / Collapse

MScript Collapses & Expands like XML:

  • MScript Expanded When Open
  • Only Tags Containing Children Tags can be Collapsed
  • MScript can be Collapsed at Different Levels

press down arrow for feature details

MScript Editor - Expand / Collapse

How to Collapse & Expand:

  • Hover Mouse Over Left Gutter
  • Click on Dashed Line Toggles Expand/Collapse
  • Click on Collapsed Symbol also Expands
  • Collapse & Expand All with

MScript Editor - Syntax Check

Check MScript Syntax and Report Compiling Errors:

  • Click to Check MScript Syntax
  • MScript Errors Hilighted with Error Details:
  • Click on Error Message to clear the error

MScript Editor - Code Complexity

McCable Code Complexity Metrics:

  • Decision Criteria (DC):
    • Cyclometic Complexity
    • Counts # of Branches and Loops
  • Modified Decision Criteria (MDC):
    • Consider Complexity of Boolean Expression
    • Count "AND" and "OR" in Boolean Expression

press down arrow for feature details

MScript Editor - Code Complexity

MDC and DC are Calculated:

  • Each MScript Container Tag
  • Each MScript Trigger
  • Entire Model MScript

press down arrow for feature details

MScript Editor - Code Complexity

Manage Code Complexity:

  • Keep MDC / DC Small at Each MScript Trigger
  • Ideal MDC / DC 9-15 but Adjust Based on Your Situation
  • Aggregated MDC / DC Shows Model Complexity

THE END

Visit other tutorials Here

© TestOptimal LLC.