Previous Next        Current Page: NeXtMidas Training / Primitives / Test Macros / Layout of a Test Macro
Start Here   
Background   
Common Midas Concepts   
Getting Started - Part 1   
Getting Started - Part 2   
Working with Files   
Option Trees   
Macros - Part 1 (Basics)   
Macros - Part 2 (Graphics)   
NetBeans - Part 1 (Setup)   
NetBeans - Part 2 (GUIs)   
NetBeans - Part 3 (Profiler)   
Eclipse - Part 1 (Setup)   
Eclipse - Part 2 (GUIs)   
Primitives   
   + Overview   
   + Open, Process, Close   
   + Building   
   + The NeXtMidas API   
   + Lab 1   
   + Special Variables   
   + Lab 2   
   + Lab 3*   
   + Files in a Primitive   
   + Lab 4   
   + Lab 5*   
   - Test Macros   
      - Introduction to Test Macros   
      - Lamest Reasons for not Testing   
      - Creating a Test Macro   
      - Test Strategy   
      - Layout of a Test Macro   
   + Lab 6   
   + Real Time Controls   
   + Lab 7   
   + Working with Messages   
   + Lab 8   
   + Primitive Restarts   
   + Introduction to DSP   
   + Lab 9   
Applets & WebStart   
Maps & Imagery   
X-Midas Interoperability   
RMIF & Remoting   
Installing NeXtMidas   
Support & Maintenance   
File Handlers   


  • Typical layout (non-interactive tests):
    ! Tests for the FOO command
    !
    startmacro
      ! Run any non-interactive tests
      call basicTest
      call specialTest
    endmacro
    
    procedure basicTest
      ! tests here
    return
    
    procedure specialTest
      ! tests here
    return
  • Typical layout (with interactive tests):
    (Parts that differ from a non-interactive test macro, shown in blue.)
    ! Tests for the FOO command
    !
    startmacro
      switch INTERACTIVE interAct GET DEF=TRUE SDEF=TRUE
    
      ! Run any non-interactive tests
      call basicTest
      call specialTest
    
      if interAct then
        ! Run any interactive tests
        pipe on
          panel/setup/controls=gc
    
          gcontrol text   idtext "Instructions"      "TBD" 24 7 /title
          gcontrol button test   "TestA,TestB,TestC" none       /nc=3
    
          gcontrol menu   main "Exit with Status = " "PASS,FAIL" /tleft
          set gc.main.itemColors {PASS=GREEN,FAIL=RED}
        pipe off
      endif
    endmacro
    
    procedure processMessage m:msg
      if msg.name eqs "MAIN" then
        assert/text="^reg.main.name: User indicated tests" msg.data eqss "PASS"
        pipe stop
      elseif msg.name eqs "TEST" then
        if msg.data eqs "TESTA" then
          call testA
        elseif msg.data eqs "TESTB" then
          call testB
        elseif msg.data eqs "TESTC" then
          call testC
        endif
      endif
    return
    
    ! test procedures go here.