Helpers for creating functional tests in Django, with a unified API for WebTest and Selenium tests.
Project description
Helpers for creating high-level functional tests in Django, with a unified API for WebTest and Selenium tests.
Documentation
The full documentation is at https://django-functest.readthedocs.org.
Installation
pip install django-functest
See also the dependencies documentation for important compatibility information.
Features
A simplified API for writing functional tests in Django (tests that check the behaviour of entire views, or sets of views, e.g. a checkout process).
A unified API that abstracts over both WebTest and Selenium - write two tests at once!
Many of the gotchas and difficulties of using WebTest and Selenium ironed out for you.
Well tested - as well as its own test suite, which is run against Firefox and Chrome, it is also used by Wolf & Badger for tests covering many business critical functionalities.
Typical usage
In your tests.py:
from django.test import LiveServerTestCase, TestCase
from django_functest import FuncWebTestMixin, FuncSeleniumMixin, FuncBaseMixin
class ContactTestBase(FuncBaseMixin):
# Abstract class, doesn't inherit from TestCase
def test_contact_form(self):
self.get_url('contact_form')
self.fill({'#id_name': 'Joe',
'#id_message': 'Hello'})
self.submit('input[type=submit]')
self.assertTextPresent("Thanks for your message")
class ContactWebTest(ContactTestBase, FuncWebTestMixin, TestCase):
pass
class ContactSeleniumTest(ContactTestBase, FuncSeleniumMixin, LiveServerTestCase):
pass
In this way, you can write a single test with a high-level API, and run it in two ways - using a fast, WSGI-based method which emulates typical HTTP usage of a browser, and using a full browser that actually executes Javascript (if present) etc.
Under the hood, the WSGI-based method uses and builds upon WebTest and django-webtest.
django-functest provides its functionality as mixins, so that you can have your own base class for tests.
Contributing and tests
See CONTRIBUTING.rst for information about running the test suite and contributing to django-functest.
Paid support
Some of the maintainers are able to provide support on a paid basis for this Open Source project. This includes the following kinds of things:
Paying for bug fixes or new features (with the understanding that these changes will become freely available as part of the project and are not ‘owned’ by the person who paid for them).
Debugging or other support for integrating django-functest into your project.
Writing a test suite for you from scratch using django-functest.
If you are interested in these, you can contact the following developers:
Luke Plant - long time Django expert and contributor - info and status.
Credits
This library was written originally by spookylukey, further improved by developers at Wolf & Badger, and released with the kind permission of that company.
Tools used in rendering this package:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_functest-1.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76b38df12de563512a5cb29adc2488bf762f3580e662479b95504e4bfce7d5a9 |
|
MD5 | 98363c99743b9d17496cced64171b8d3 |
|
BLAKE2b-256 | bfaa102bd4a422af77b01b568839d5f4d4a08177aef0d3b4be444fa0178ad198 |