I have just joined a team working on an existing Java web app. I have been tasked with creating an automated integration test suite that should run when developers commit to our continuous integration server (TeamCity), which automatically deploys to our staging server – so really the tests will be run against our staging web app server.
I have read a lot of stuff about automated integration testing with frameworks like Watir, Selenium and RWebSpec. I have created tests in all of these and while I prefer Watir, I am open to anything.
The thing that hasn’t become clear to me is how to create an entire test suite for an application, and how to have that suite execute in it’s entirety upon execution of some script. I can happily create individual tests of varying complexity, but there is a gap in my knowledge about how to tie everything together into something useful.
Does anyone have any advice on how to create a full test suite and have it execute automatically?
Thanks!
Typically you are going to use Rake to automate the test execution. Assuming you are using Test::Unit for your testing you would setup your Rakefile With the following contents:
This configures all test suite files under your project “test” folder by default. You can then run them with the command below:
and it will then execute all your test suites for your entire project. You can tell it to run a specific test by using the following syntax:
Since you are using TeamCity you can then create a build and use the Rake runner to execute your test suites. TeamCity will pull all of the test information (output, stack traces, etc.) into the UI just like it does with JUnit. It is a very good integration.
For reference, your test suites would look something like this:
This way you can sequence your test cases within each test suite as desired.