Funittest is a framework for rapidly writing functional tests for web sites.
Funittest makes it possible to write high level functional tests and use case scenarios. Tests and scenarios make use of Logical Functional Model methods, which contain all possible user actions grouped by functionality. Low-level information about how to manipulate elements in the HTML page are kept in a Physical Object Model.
Funittest is built around Selenium Remote Control, which directly talks to the browser, and controls it like a normal user would.
Before we get started, you need to set up SeleniumRC. Otherwise Funittest can't run functional tests in a browser, but will run in dry mode, which simply echoes the commands it receives without doing any real work.
You need to have Funittest installed. Just make it available in your Python module path.
Funittest is used to run functional tests against a web site. The following chapter will demonstrate how to run the tests from a Python interpreter.
Use case scenarios are the basic building blocks of your user-centric functional tests.
Logical Functional Models contain all the actions a user can perform in a site grouped by by application features. Logical Functional Models in Funittest.
Physical Object Models are aware of the actual HTML code in the browser and can locate elements and do all kings of actions like filling in forms or calling JavaScript functions.
If you want to get a quick introduction to Funittest that shows the use of Logical Functional Models, follow this short Crunchy tutorial:
Writing functional tests can be done before writing the actual code of the application. If a new Logical Functional Model is needed, the programmer only needs to define stub methods that can be implemented once the code is being written.
The Braidy Tester has written some very interesting articles on the subject of Logical Functional Models:
The Logical Functional Model hides implementation details in a Physical Object Model that is concerned with interacting with the user interface. Different Logical Functional Models can share a common library of user interface methods.
You should print out and start to familiarize yourself with the Selenium: Selenium Core 0.8.2 Reference and the Module selenium :: Class selenium API documentation.
Funittest supports the concept of loosely coupled comprehensive verification. Verification is done before and after the call to a Logical Functional Model method. Expected state can be compared to actual state, and verification can take place all of the time, not just in an isolated functional test case.
Funittest gets example data from so called data providers, which define a data structure for example data and also contain the data itself. There is currently no generation of test data, test data is just moved around in a simple dictionary. This simplicity is wanted for the moment, and proposals of a different implementation are welcome.
Implementation of Execution Behavior is rudimentary in Funittest, meaning that different implementations of a method are chosen by random from a list of possible methods implementing the execution behavior. If you have an idea about how to get this done elegantly using Python decorators, let me know. Some Braidy Tester articles on Execution Behaviors:
There are two application areas for Funittest.
Funittest is very friendly to the programmer in that it allows the execution of functional tests in three modes