Jeté Best Practices

Home Overview
After working with the framework and building system tests, there are a few helpful patterns and practices that may help simplify system test creation and running.

Naming Conventions
Files, test cases, and other entities should be named in such a way as to make sense and be easily readable for test builders and maintainers.  

Test Cases
Test case names need to be readable both for test maintenance and junit report readability.  Descriptive names are often the best.  It is also important to establish a naming convention early as reports are alphabetically ordered and currently the only way of sorting the results.
Example: "class.method.failure.reason" is much better than "test1"

Bean Definition
As with test case names, be descriptive of actions, validators, entities within the configuration files for readability and maintainability.

Bean Referencing
If an action, validator, or entity is used only once within a configuration file, try to inline the bean definition.  This keeps all data where it's accessed, minimizing the need to sift through the system test configuration file searching for bean references.

Memory Management
When dealing with large system tests problems could arise if Spring contexts aren't closed or resources released.  When loading a context file, set the "removeContext" property to true, allowing the test framework to close the context and release the resources.  Another option is to use singletons (singleton = "true" in the bean definition).

System Test File Management
Keep system test files as directed as possible.  Basically focus the tests on a particular aspect of the system, isolate this test in a file, and put that file with related tests into a specific directory.  This will help maintenance in the long term.  
Example: "systemtest/login/roles/restricted_user_tests.xml" might be good for testing login roles for restricted user access

Jeté can also be very configurable with sub test definitions, allowing the SystemTest.xml to reference tests that reference yet other tests, allowing complex system test arrangement.  
Example: SystemTest.xml references a context file test case in the above "login" directory called login_tests.xml.  This test could be a collection of context file test cases referencing the actual tests, like "roles/restricted_user_tests.xml" and others, representing the entire login test suite.
hosted by SourceForge Logo