-
Notifications
You must be signed in to change notification settings - Fork 6
Home
What is Chorus?
Chorus is a Behaviour Driven Development tool written in Java. Just like the well-known Cucumber project, it supports tests written in the 'Plain English' Gherkin language. Chorus works well for component testing, but has an extra set of features to assist with the testing of distributed components (true integration testing, where tests have to span multiple components).
Why not use Cucumber, Cuke4Duke, JCucumber, JBehave or (insert your framework here)?
Chorus brings several unique features to the party:
- Built in support for distributed test steps (allow your BDD test steps to span multiple components)
- Built in support for process control (start or stop processes as part of your test)
- Supports several language extensions to the basic Gherkin syntax
The language extensions include:
- 'Configurations' - run the same test more than once with your components in different configurations
- 'Step-Macro' - Group common steps together for reuse within a Scenario
Chorus is a pure-java solution with zero third party dependencies, which is easy to integrate with java projects.
How do I use Chorus?
First write tests in plain English (as .feature files according to the standard Gherkin syntax). You then run the Chorus
interpreter and point it at the root directory where your feature files are located, and the interpreter will find all
your test features and try to execute them. To make the tests pass, you need supply some java classes which implement
the logic to run the test steps in your feature files. These classes are called 'Handler' classes in Chorus' parlance,
and they are marked with the @Handler
annotation.
The Handler classes implement methods which are annotated with the @Step
annotation. Each @Step
annotation contains
a regular expression. Each time the interpreter encounters a plain English test step in a feature file, it attempts to match
the step text against the regular expressions defined for the @Step methods. If it a match is found, then the annotated
method will be executed.
How does distributed testing work in Chorus?
Chorus provides several features which make it much easier to test components in a distributed architecture. In fact, this is where the name Chorus comes from - the ability for multiple components to participate in a test feature 'in chorus'.
Before you can test all these components, of course they have to be running. So you can either use Chorus' process control features to start the processes you want to test, or you can test components which are already running in a dedicated integration testing environment.
Whichever approach you choose, these processes will need to be set up to export @Handler classes, so that the Chorus interpreter can connect up and remotely discover the @Step methods they export at runtime. (Chorus provides classes to allow you to easily export handlers using JMX). You can then write features which contain steps which will be executed by these remote handlers. When the interpreter is run, it will connect to the remote components and attempt to match your plain English test steps against the @Step methods they export, and if it finds a match it will remotely execute the step logic.