The new Test Case Management (TCM) system is broken into two main parts:
- Back-end REST interface written in Java
- Front-end GUI interface written in Python and Django
We chose Behavior Driven Development (BDD) as the general approach to our automation. For REST endpoint tests, we chose a Python Framework called Lettuce. For UI automation, we will use Selenium in one fashion or another, ideally controlled by Lettuce as well.
- Automate as much functionality as possible and practical
- Automate in a way that it's easy to determine what each test case covers
- Python 2.6 or later
- Python packages
- Lettuce 0.1.15
- Numpy 1.2.1
- Jetty to run the MockServlet
I use a custom installation of Lettuce. The main version of Lettuce doesn't support HTML output yet. If you don't care about HTML output, you can just install the standard Lettuce with pip.
If you DO want the HTML output, I have a custom fork of Lettuce that provides this support. It is available here:
To install this package, check out the source code locally, then do the following:
$ cd lettuce $ python setup.py install
Next, install the required package numpy:
$ pip install numpy
Running the tests
There are two parts to the tests, currently:
- Mock Java Servlet
- Tests written in Lettuce
Both are checked into Github here:
The mock Servlet is written in Java, and is checked out with the tests. The source is checked in, but since this servlet is very simple and stable, I just checked in the latest .war file here to make it easier on you:
Copy this file to the /webapps of your servlet container. For example:
Then when you start or restart your servlet container, you'll be in business.
First: cd to the parent of the/features directory
$ cd tcm/tests/bdd
One last bit of configuration to check. The /features/Terrain.py file contains values that specify your host and port among other things. If you have different values than these defaults, you'll need to modify them:
world.hostname = "localhost" world.port = 8080
Finally, you're ready to run the tests. Here's how:
That will produce your standard text output to the command line. If you want to run and build an HTML file of the result, do this: Example
$ lettuce -v 5 > tcmout.html
Then load that file into the browser of your choice. However, if you don't use Firefox or Minefield, then you may experience the Helvetica Scenario, so please choose wisely.