Follow Us

Follow Us on Facebook Follow Us on Twitter

Customizing the Test Suites on the Rimay Call Generator

It’s easy — almost trivial — to create a custom test suite on the RCG.

An RCG test suite is simply a python script that calls “main()” on a ScriptRunner object. Here’s a short example suite that will run two tests:

#!/usr/bin/python

from rcg.test_runner import ScriptRunner
import a_calls_b

TESTS = [
    a_calls_b.a_calls_b,
    a_calls_b.ab_mesh,
    ]

if __name__ == '__main__':
    main()

Let’s break that down for readers less familiar with python:

The first line tells the OS we want to run this program using the python interpreter:
#!/usr/bin/python

The next two lines tells python that we want to use two existing modules, both of which in this case come from the RCG libraries. The first line here makes the ScriptRunner class available, and the second line lets us use the “a_calls_b” module, which contains several test scripts related to two-party calls.

from rcg.test_runner import ScriptRunner
import a_calls_b

Then we create a list of two test scripts from the a_calls_b module, which we store in a variable called TESTS. We prefer to format the code this way so that it is easy to temporarily comment out one or more of the tests in a suite (with a # character at the beginning of the line) if we want to quickly change the suite definition for a test run.

TESTS = [
    a_calls_b.a_calls_b,
    a_calls_b.ab_mesh,
    ]

Then we create a ScriptRunner object using that list of test scripts. The ScriptRunner will run those tests when we call it (see below).

main = ScriptRunner(TESTS)
main.title = 'My Suite'

Finally, this checks the built-in python variable “__name__” to see if this file is being run as a standalone program. If it is, we run the ScriptRunner — the ScriptRunner class defines a special method that allows ScriptRunner objects to be “called” as if they were functions. By including the check to see if the file is run as a standalone program, we allow for the case where this suite is imported by a larger suite. Defining suites in this way allows us to build up collections of test suites hierarchically in a way that makes sense for a particular application. If you look at a_calls_b.py, you will see that it is a suite defined using the same basic template provided here.

if __name__ == '__main__':
    main()

Related posts:

  1. Tunable Call Script Delays on the Rimay Call Generator
  2. How to Get More Complete Test Coverage
  3. Use a Call Generator for Robustness Testing
  4. The Secret to Managing the Voice Test Matrix Explosion
  5. Quick Fix for CID Test Failure

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>