I have been developing software using Test Driven Development (TDD) for over three years now. I usually use traditional xUnit style testing frameworks (NUnit, JUnit, jsUnit, FlexUnit, cppUnit, etc) because they are the most accessible frameworks out there.
In reality, though, my TDD style has evolved into more of a Behavior Driven Development (BDD) style. I specify how my software behaves opposed to writing tests against the inputs/outputs of a given function. Although this can be a bit awkward with the xUnit style of testing, it can be done ANDI have done so successfully for quite some time.
While I am doing this, I always think to the times when I develop in Ruby. When in Ruby, I don’t use the standard xUnit tool. Instead, I use RSpec. RSpec allows me to organize my tests (specifications) more organically and within context. The result is a more expressive, better organized test suite more suited for BDD-style development.
Using Jasmine-Flex is simple:
- Create a new Flex project (Flash or Air)
- Download JasmineFlex.swc and put it in your libs folder.
- Put the TrivialFlexReporterView in your application and set autoExecute to true.
- Add your specs using the script tag
- Run the app.
Here is a step-by-step example:
1. Create a new Flex project (Flash or Air)
2. Download JasmineFlex.swc and put it in your libs folder
3. Put the TrivialFlexReporterView in your application and set autoExecute to true.
4. Add your specs using the script tag
5. Run the app
You are up and running
Now that you have a Jasmine testing environment up and running, you continue to use Jasmine to write specs, watch them fail, and make them pass. Add as many spec suites as you need using the script tag (step 3). Before you know it, you will have a rich suite of executable specifications!
Need more information?
- See the documentation on the Jasmine-Flex site.
- Take a look at an example project.
- See the specs for the Jasmine project (Jasmine was built using Jasmine!).
- Check out The RSpec Book. Most of the concepts apply directly to Jasmine.