Writing a test script

You can write a shell script that starts RunTest and provides the necessary options. In your script, type the appropriate RunTest commands. The following example shows a test script that includes several RunTest examples:

      // Copyright (C) 1995 Taligent, Inc. All rights reserved.
      echo "------------------------------------------------------------------------"
      echo " This shell script specifies how to run the unit test."
      echo " Typically this consists of a set of RunTest invocations."
      echo "------------------------------------------------------------------------"
      
      echo "------------------------------------------------------------------------"
      echo "Usage: RunTest -t TSampleObjectSimpleTest SampleObjectTestLib"
      echo "This is a sample test that simply prints a message to the console"
      echo "RunTest -t TSampleObjectSimpleTest SampleObjectTestLib"
      RunTest -t TSampleObjectSimpleTest SampleObjectTestLib
      
      echo "------------------------------------------------------------------------"
      echo "Usage: RunTest -t TSampleObjectBaseTest SampleObjectTestLib"
      echo "This is a sample test that runs the streaming, copying, etc. tests and" 
      echo " prints a message to the console"
      echo "RunTest -t TSampleObjectBaseTest SampleObjectTestLib"
      RunTest -t TSampleObjectBaseTest SampleObjectTestLib
      
      echo "------------------------------------------------------------------------"
      echo "Usage: RunTest -t TSampleObjectStringTest SampleObjectTestLib -o [<text>]"
      echo "This is a sample test that parses an optional text command line"
      echo "argument.  Arguments specified after the -o option are passed "
      echo "to the TTest subclass."  
      echo "------------------------------------------------------------------------"
      echo "RunTest -t TSampleObjectStringTest SampleObjectTestLib -o Hello"
      RunTest -t TSampleObjectStringTest SampleObjectTestLib -o \"Hello\"
      
      echo "------------------------------------------------------------------------"
      echo " Invoke test with integer argument 333."
      echo "------------------------------------------------------------------------"
      echo "RunTest -t TSampleObjectLengthTest SampleObjectTestLib -o -n 333"
      RunTest -t TSampleObjectLengthTest SampleObjectTestLib -o -n 333
      
      echo "------------------------------------------------------------------------"
      echo " Invoke test with text argument 'This is a test'.  Print"
      echo " out detailed output by specifying '-e d' which means print out any" 
      echo " output that is higher or equal to the 'detail' output tier."
      echo "------------------------------------------------------------------------"
      echo "RunTest -t TSampleObjectStringTest SampleObjectTestLib -e d -o This is a test"
      RunTest -t TSampleObjectStringTest SampleObjectTestLib -e d -o \"This is a test\"
      
      echo "------------------------------------------------------------------------"
      echo " Invoke test with integer argument 77 and run the test 10 times by"
      echo " specifying the -n option which means to run the test multiple times."
      echo " The -n option must appear before the -o option; otherwise it will be"
      echo " interpreted as an argument for TSampleObjectLengthTest instead of RunTest."
      echo " When the -n option is specified, Setup, Test, and Cleanup"
      echo " will be called multiple times."
      echo "------------------------------------------------------------------------"
      echo "RunTest -t TSampleObjectLengthTest SampleObjectTestLib  -n 10 -o -n 77"
      RunTest -t TSampleObjectLengthTest SampleObjectTestLib -n 10 -o -n 77

[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker