[TIP] testing the creation of infrastructure

Joseph Heck heckj at mac.com
Sat Aug 27 14:33:59 PDT 2011


I'm hoping someone might have a quick little answer for this quandry - 

I'm doing a lot of building infrastructure work right now, and I'm trying to create tests that I can run repeatedly from Jenkins (or name your CI server here). The nature of the tests is that they take a while - including long periods of waiting, and sometimes completely asynchronous calls in the midst of the process where you don't get an event or call back (i.e. need to poll to check status).

I'd ideally like to use the Unittest module, just because I'm very familiar with the assertions and structures for writing tests, but I'm finding that I need a test running that does the tests sequentially, and ideally in a predictable order so that I don't have single def testSomething(): methods that are truly monstrous.

I know this is the antithesis to getting tests to run faster - what I'm looking to codify are long running tests that I can use for regression and acceptance criteria.

I started down the road of using Lettuce (http://lettuce.it/) with some reasonable success - it's fundamentally sequential in it's invocations, but I do get a bit stymied on how to create BDD style written tests - and it lacks the unittest asserts that I'd really like to use under the covers. (It does give JUnit style XML output, which is darned handy for the reporting in the CI server though)

Any suggestions from others who have attempted to tackle this kind of testing scenario?

-joe



More information about the testing-in-python mailing list