Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Testing workflows in Django

I really love testing and building unit tests, but I find it quite annoying having to build tests for a website's workflow.

e.g.

Register -> Check email -> Activate account -> Login

or

Login -> Edit details -> Submit and view profile


manual testing = loads of time + tireing

even when using app such as Selenium, going though each iteration and then having to check emails etc...


Is there some way of performing an array of tests in a more efficient way?

How do you guys do it? :)

like image 376
RadiantHex Avatar asked Sep 07 '10 10:09

RadiantHex


People also ask

How is testing done in Django?

The preferred way to write tests in Django is using the unittest module built-in to the Python standard library. This is covered in detail in the Writing and running tests document. You can also use any other Python test framework; Django provides an API and tools for that kind of integration.

Is Django used for testing?

Django provides a test framework with a small hierarchy of classes that build on the Python standard unittest library. Despite the name, this test framework is suitable for both unit and integration tests. The Django framework adds API methods and tools to help test web and Django-specific behavior.

How do you write unit test cases in Django?

Writing tests Django's unit tests use a Python standard library module: unittest . This module defines tests using a class-based approach. When you run your tests, the default behavior of the test utility is to find all the test cases (that is, subclasses of unittest.

What is Django nose?

django-nose provides all the goodness of nose in your Django tests, like: Testing just your apps by default, not all the standard ones that happen to be in INSTALLED_APPS. Running the tests in one or more specific modules (or apps, or classes, or folders, or just running a specific test)


1 Answers

I write "functional unit" tests for individual views using Django's test framework. I have found that integration tests are best done using something like Robot Framework. In one of my projects I came up with a minimal, custom implementation of Ward Cunningham's FIT mechanism.

like image 94
Manoj Govindan Avatar answered Sep 19 '22 12:09

Manoj Govindan