Developer Testing

Introduction

Developers are certainly encouraged to take advantage of automated testing that is described elsewhere. However, sometimes it is necessary to be able to run tests within the developer's development environment. Currently, we have a few different flavors of tests:

  • C++ Unit Tests
  • Python Unit Tests
  • Python Regression Tests

The C++ unit tests test functionality in the lower-level C++ code. The Python unit tests are shorter running tests which have limited scope. The Python Regression Tests test a large swath of CASA functionality.

Currently, the C++ unit tests use the Google testing framework, the Python unit tests use the Python Nose testing framework, and the Python regression tests use a framework produced in house. We plan to slowly migrate the Python regression tests into the Nose testing framework. So going forward all Python tests should be developed within the Nose testing framework while the C++ tests will continue to rely on the Google testing framework.

Running C++ Unit Tests

to be done

 

Running Python Unit Tests

import runUnitTest

###run a given unit test suite

runUnitTest.main(['test_importasdm'])

###run a specific unit test in a given suite

runUnitTest.main(['test_ia_pad[test_history]'])

 

Running Python Regression Tests

to be done

 

How Tests Are Run by Bamboo

 Test are run in the automated testing environment using CASA command line options. The '-c' CASA command line flag can be used to either evaluate a Python expression or run a Python script in the CASA context. The Python regression scripts are run like:

casa --nologger --log2term -c runRegressionTest.py fits-import-export

while the Python Unit Tests are run like:

casa --nologger --log2term  -c runUnitTest.py test_importasdm

where "test_importasdm" is the name of a set of unit tests to run, or:

casa --nologger --log2term  -c runUnitTest.py test_ia_pad[test_history]

where "test_ia_pad" is the name of the set of unit tests and "test_history" is one test from the set.