[ckan-dev] RFC: use oktest for ckan

Dominik Moritz domoritz at gmail.com
Tue Sep 18 20:48:53 UTC 2012


Hi CKAN devs,

I'm currently working on integration tests for CKAN. Before that I worked on the datastore and wrote quite a few tests. Testing takes a lot of time and the syntax and fixture injection is not simple. In my Summer of Code Projekt and other project at university, I used Oktest and would like to show you the advantages.

List of Features/ Advantages:

* Full backwards compatible, you don't have to use it.
* Easy to install and setup (pip install oktest, import, done)
* Works with the current testing environment
* Shorter syntax and easier to read syntax
* Better errors with diffs[1]
* Tests for expected errors
* Simple type checking and file path checking
* Test decorator for better naming of tests (I actually wrote better test names after I started using oktest)
* MIT License
* The name Oktest sounds like Okfn. We could tell people its actually the "open knowledge test" ;-)

If that sounds mouthwatering wait until you see the syntax. It's quite nice [2]
You want to see some code. No problem. Here is a rest api wrapper test [3] and a simple pylons app test [4] that I've written with Oktest.

Cheers,
Dominik

[1]
AssertionError: 'foo' == 'bar' : failed.
--- expected
+++ actual
@@ -1 +1 @@
-bar
+foo

instead of:

AssertionError

[2] http://www.kuwata-lab.com/oktest/oktest-py_users-guide.html
[3] https://github.com/domoritz/popit-python/blob/master/test.py
[4] https://github.com/domoritz/Professors/blob/master/profs/tests.py



More information about the ckan-dev mailing list