TeamCity can be configured to invoke your test suite upon commit.
The following steps will help us prep are TeamCity to run our test suite when the code changes are committed:
git
installed, as mentioned earlier in this chapter.gturnquist$ mkdir /tmp/recipe49
gturnquist$ git init /tmp/recipe49 Initialized empty Git repository in /private/tmp/recipe49/.git/
gturnquist$ cp cart.py /tmp/recipe49/ gturnquist$ cd /tmp/recipe49/ gturnquist$ git add cart.py gturnquist$ git commit -m "Added shopping cart application to setup this recipe." [master (root-commit) 057d936] Added shopping cart application to setup this recipe. 1 files changed, 35 insertions(+), 0 deletions(-) create mode 100644 cart.py
These steps will show us how to create a TeamCity job that polls version control to detect a change and then run a test suite.
/tmp/recipe49
as the Fetch URL.. /Users/gturnquist/ptc/bin/activate nosetests tests.py
You must replace this with the command to activate your own virtualenv and invoke nosetests.
gturnquist$ cp tests.py /tmp/recipe49/ gturnquist$ cd /tmp/recipe49/ gturnquist$ git add tests.py gturnquist$ git commit -m "Adding tests." [master 4c3c418] Adding tests. 1 files changed, 20 insertions(+), 0 deletions(-) create mode 100644 tests.py
In this recipe, we configured TeamCity to do a job for us tied to a specific trigger. The trigger is: whenever a check in is done to the software baseline. We had to take several steps to configure this, but it demonstrates the flexible power TeamCity offers.
We also installed the teamcity-nose plugin, which gave us more details on the results.
TeamCity calls our nose testing job a build job. That is because running tests isn't the only thing TeamCity is used for. Instead, it's geared to build packages, deploy to sites, and any other action we may want it to do anytime a commit happens. This is why CI servers are sometimes called build servers.
But if we start with simple jobs like testing the baseline, we are well on our way to discovering the other useful features TeamCity has to offer.
3.139.97.53