Skip to content

How to generate tests and testing files

macourtney edited this page Sep 13, 2010 · 3 revisions

Added for version: 0.4
Updated for version: 0.7

Model Test Files

To generate a model test for message use:

lein conjure generate model-test message

Generate will create a model test in test/unit/model called message_model_test.clj. Generate will also create a fixture for message.

To generate just a fixture for message use:

lein conjure generate fixture message

Generate will create a fixture file called ‘message.clj’ and put it in the test/fixture directory.

View Test Files

To generate a test for a view called ‘show’ with controller ‘message’ use:

lein conjure generate view-test message show

Generate will create a file called ‘show_view_test.clj’ in the directory test/unit/view/message directory.

Binding Test Files

To generate a test for a binding called ‘show’ with controller ‘message’ use:

lein conjure generate binding-test message show

Generate will create a file called ‘show_binding_test.clj’ in the directory test/unit/binding/message directory.

Controller Test Files

To generate a functional test for a controller named ‘message’ use:

lein conjure generate controller-test message

Generate will create a file called ‘message_controller_test.clj’ in the app/test/functional directory.

To generate a functional test for a controller named ‘message’ with actions ‘show’, ‘create’, and ‘edit’ use:

lein conjure generate controller-test message show create edit

Generate will create the test file as above, but also define tests for show create and edit in the test file.

Clone this wiki locally