Ruby has this great abstraction layer on top of Selenium called Capybara, which you can use do functional/acceptance/integration testing. It also has another library called Cucumber which takes this a step further and lets you actually write tests in English.
Both libraries are built on top of Selenium, and can be used to test against any major browser, but because of their abstraction layers it's super easy to write tests using them (well, as easy as functional testing gets at least).
My question is: does Python have anything like that? I have found Pythonistas doing functional testing with various tools but ...
A) Splinter: doesn't use Selenium (and doesn't have an IE driver)
-EDIT- It appears Spliter now does use Selenium (see answers below).
B) Alfajor: hasn't been updated in over a year; looks dead
C) Selenium (raw): a lot of people seem to be using Selenium directly, but it seems like an abstraction layer could make it a lot easier to use
So, does anyone know of anything Capybara-like, or better yet Cucumber-like, for Python (it doesn't have to actually use Selenium, but it needs to support all major browsers)?
* EDIT *
For those that aren't familiar with Capybara, it basically just adds an API so that instead of the normal Selenium API you can do something like this:
When /I sign in/ do within("#session") do fill_in 'Login', :with => '[email protected]' fill_in 'Password', :with => 'password' end click_link 'Sign in' end
It's used by Cucumber, which let's you further abstract (almost to English):
Scenario Outline: Add two numbers Given I have entered <input_1> into the calculator And I have entered <input_2> into the calculator When I press <button> Then the result should be <output> on the screen Examples: | input_1 | input_2 | button | output | | 20 | 30 | add | 50 |
I would LOVE a Python Cucumber equivalent, but even just a Capybara equivalent would be helpful.
Cucumber supports 14 languages right now, including Python on the JVM also called Jython.
Capybara is a web-based test automation software that simulates scenarios for user stories and automates web application testing for behavior-driven software development. It is written in the Ruby programming language.
cucumber is a BDD tool that expresses testing scenarios in a business-readable, domain-specific language. capybara is an automated testing tool (often used) for ROR applications.
Capybara helps you test web applications by simulating how a real user would interact with your app. It is agnostic about the driver running your tests and comes with Rack::Test and Selenium support built in. WebKit is supported through an external gem.
You can test Python code using Cucumber - see the Cucumber wiki on github for more information.
If you want a pure Python solution, check out Lettuce. I've never used it, but there is a fairly useful looking blog entry about it and splinter here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With