Skip to content

Naming conventions

alessandrofg edited this page Sep 22, 2013 · 2 revisions

Where to place the tests?

As described in the "Running tests" section, there are three categories for the tests: framework, plugin and testing_framework. These categories correspond to folders with the same names in the test_cases directory.

  • Framework: in this directory there are tests related to the OWTF framework components, such as DB, config, etc.
  • Plugin: in this directory there are tests for the OWTF plugins (web, net, aux). Each test type is in its own module. For example, there is a separated module for web tests, net tests, etc.
  • Testing_framework: in this directory there are tests for the features of the testing framework itself. Tests for doubles, test cases, servers, etc. are in this folder.

Modules and class names

The module names are normally the name of the tested module with the "_tests.py" suffix. The class names are the same as the module names, but in CamelCase format. For example, for the config module, we will name the test module as "config_tests.py" and the test class will be ConfigTests.

Test/Method names

The test names begin with the prefix "test_", adding the description of the test, replacing the spaces by the underscore symbol (_). For example, this could be the name of a test: test_that_this_feature_works. If we have to write a test for a plugin, the name should be: test_ + plugin_name + _plugin_type. For example: test_Spiders_Robots_and_Crawlers_passive. In general, try to write method names that describe clearly its purpose.

Clone this wiki locally