[TIP] PyBehave ?!?

Michał Kwiatkowski constant.beta at gmail.com
Thu Mar 15 09:55:09 PDT 2007

On 3/15/07, Kumar McMillan <kumar.mcmillan at gmail.com> wrote:
> Given a user of the financial group
> When logged in
> Ensure user can view invoices
> then you could write a test like so:
> import unittest
> class TestUserOfTheFinancialGroup(unittest.TestCase):
>     def test_when_logged_in_user_can_view_invoices(self):
>         pass
> and get from nosetests:
> $ nosetests --with-spec
> User of the financial group
> - when logged in user can view invoices

Just another idea. Raphael mentioned tests syntax for common use for
developers and end-users. Neat thing would be making a script which
given the specification on input would generate tests template to fill
in by developer with code. Kumar's example above is a good
presentation of this - simply reverse the order of spec and code. ;)
With this in place end-users could be not merely consumers of
specifications but contributors as well. It's questionable if the spec
itself is not too vague - developer given a spec would probably need
additional information to prepare a good test case. In a way or
another I think this is idea worth thinking about.


More information about the testing-in-python mailing list