2.7. Using the Command-Line Interface

All of QMTest's functionality is available from the command-line, as well as in the graphical user interface. When you invoke qmtest on the command line, you specify a command argument, which tells the program which action to perform. Some commands require additional options and arguments, which you place after the command. There are a few options that apply to all commands; to use these options place them before the command name. For example, in the command:


    > qmtest -D . run -f full exec1
   
the -D . option is a general qmtest option, run is the QMTest command, the -f full applies to the run command, and exec1 is an argument to the run command. This command tests QMTest to run the exec1 test from the test database in tdb, and to use the full format when displaying the results.

To see a list of available commands, and general options to qmtest, invoke it with the --help (or -h) option. To see a description of each command, and additional options specific to that command, invoke qmtest command --help.

By this point, you have modified the test database using the GUI and have fixed the failing test. Recreate the original database now by removing and recreating the tdb directory. On a UNIX system use these commands:


     > cd ..
     > rm -rf tdb
     > cp -r /usr/local/share/qm/tutorial/test/tdb tdb
     > cd tdb
    
On a Windows system, use these commands instead:

     > cd ..
     > rmdir /s tdb
     > xcopy c:\Python23\qm\tutorial\test\tdb tdb\ /s
     > cd tdb
    

The command for running tests is qmtest run. Assuming you made a copy of the example test database as described in the previous section, execute the following command to run all the tests in the database:


> qmtest run
   

QMTest runs the tests, and prints a summary of the test run:


--- TEST RESULTS -------------------------------------------------------------

  exec0                                         : PASS    

  exec1                                         : FAIL    
    Expression evaluates to false.

    ExecTest.expr:
      x + x == 5

    ExecTest.value:
      0

    qmtest.target:
      local

  exec2                                         : PASS    

--- TESTS THAT DID NOT PASS --------------------------------------------------

  exec1                                         : FAIL    
    Expression evaluates to false.


--- STATISTICS ---------------------------------------------------------------

       3        tests total
       1 ( 33%) tests FAIL
       2 ( 67%) tests PASS

QMTest shows you the result of the tests as they execute. Then, there is a summary description containing statistics similar to those shown in the graphical user interface. Finally, QMTest lists the tests that did not pass, along with the cause of the failure.