开发者

What's the best tool to support Behavior Driven Development in Python? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Questions asking us to re开发者_如何转开发commend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

Cucumber seems to be the go-to tool for BDD in Ruby, and through rubypython it could test Python code as well, but it's experimental. There are some Python tools out there like Pyccuracy and Freshen, but they seem to be in an early stage. What is the best tool to use for Python projects?


Have a look at lettuce. It strives to be the analogue to Cucumber in the Python world. It's quite early in its development, though.


Some interesting libraries I have come across for Python testing: factory_boy(https://factoryboy.readthedocs.org/en/latest/), which is like Ruby's FactoryGirl gem. And there is a fairly new testing framework for python called Sure(http://falcao.it/sure/intro.html) which is based on Ruby's RSpec. I started out with Python but now work for a Ruby based company. I've found Ruby's testing libraries to be really fantastic to use, especially RSpec. Sure looks pretty similar to RSpec and could be worth a look.


Well, I'm biased but I prefer pyspecs:


from pyspecs import spec, given, when, then, the


class simple_addition(spec):
    @given
    def two_numbers(self):
        self.first = 2
        self.second = 3

    @when
    def we_add_them(self):
        self.result = add(self.first, self.second)

    @then
    def the_sum_should_equal_5(self):
        the(self.result).should.equal(5)


def add(a, b):
    return a + b

Note: as the author of pyspecs I would welcome any feedback/collaboration...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜