Can anyone recommend tools or articles that help me to learn how to TDD IronPython code?
IronPython has a good unit testing framework inherited from Python called PyUnit.
Writing unit tests using PyUnit is simple:
- import unittest class
- Create a class that inherits unittest.TestCase (test fixture)
- Write test methods using assertions methods
You can read more about it in the following links:
- I wrote a blog post on the subject - Getting started with IronPython – Part 3: unit testing. You can find relevant links at the bottom of the post.
- MetaDeveloper has a similar post - Unit Tests with Iron Python
- unittest.py documentation - very good resource along with code snippets
If you use unittest.py consider using nose as well, nose provides an alternate test discovery and running process for unittest. Should make writing and running unit tests easier.
The current version of IronPython (v2.0) doesn't seem to agree with nose. This may have been fixed in 2.6, but I haven't re-run my test to figure that out yet. So for now you're only option - unless someone has experimented with one of the other python testing frameworks - pyunit is you're only choice.
You may also want to check out mock, a mocking framework created by Michael Foord which pretty much guarantees that it's going to work just fine with IronPython. If I recall correctly, he even shows some examples in his book, IronPython in Action.
Finally, you should probably check out this link from the cheesecake project for several other tools that you might be interested in.