Best Practices ============== Naming Conventions ------------------ ATS Naming Conventions ~~~~~~~~~~~~~~~~~~~~~~ Testerman adapts the `TTCN-3 naming conventions `__ to its context: +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | **Language element** | **Naming convention** | **Prefix** | **Example** | **Comments** | +=========================================================+====================================+==============+========================================================+================================================================================================================================================================================================================================================+ | message template | mixedCase | ``m_`` | ``m_sipInvite`` | These templates are both usable as sending and receiving templates. This naming convention applies to both templates functions and templates constants. | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | message template with wildcard or matching expression | mixedCase | ``mw_`` | ``mw_sipInviteResponse`` | These templates are (typically) only valid as receiving templates, as wilcards and maching mechanisms may prevent from valuating them when sending them. This naming convention applies to both templates functions and templates constants. | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | port | mixedCase | (none) | ``ssh``, ``rtp01``, ``sipSignalling`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | port name | mixedCase | (none) | ``system['iscInterface']``, ``mtc['sipSignalling']`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | test component | mixedCase | (none) | ``endpoint01``, ``hlrSimulator`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | function | mixedCase | ``f_`` | ``f_executeCommand`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | timer | mixedCase | ``t_`` | ``t_watchogTimer`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ATS parameter | upper case, \_ as word separator | ``PX_`` | ``PX_HOST_IP_PORT`` | The QTesterman client enforces this name convention when defining new ATS parameters. | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | test case (class name) | upper case, \_ as word separator | ``TC_`` | ``TC_ORACLE_CONNECTION_001`` | The class name is also used as a test case identifier in log reporters | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | behaviour (class name) | CamelCase | (none) | ``SipEndpoint``, ``HlrSimulator`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | constant | mixedCase | ``c_`` | ``c_suaAspActive = 0x04`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | parameters (test case, behaviour, functions, ...) | mixedCase | (none) | ``controlPort``, ``autoConnectSctp`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | preamble (class name) | upper case, \_ as word separator | ``PRE_`` | ``PRE_VOICEMAIL_INITIALIZATION`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | postamble (class name) | upper case, \_ as word separator | ``POST_`` | ``POST_VOICEMAIL_CLEANUP`` | | +---------------------------------------------------------+------------------------------------+--------------+--------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ This naming convention is suggested to make a difference between what belongs to the userland (user-written) and what is part of the Testerman API availablt to the user, which uses a ``lower_case`` convention. Paths and Filenames ~~~~~~~~~~~~~~~~~~~ Some rules on filenames: - Use ascii characters and lower case only for ATS and Campaign filenames, and ``_`` as a word separator: ``my_sample.ats``, ``unconditional_call_forward.ats``, ``class5_services.campaign``, ... - Use ascii characters and CamelCase (with initial and acronyms considered as a word) for module filenames: ``SipMessages.py``, ``DiameterServerBehaviours.py``, ... - Use lower case only for directory names, and ``_`` as a word separator. In particular, do NOT use a dot (``.``) in a directory name. This would prevent modules from being imported correctly. Additionally, the following repository structure is advised: - ``/`` : no files in the repository root - ``/samples/``: contains samples (either Testerman's provided, or provided by your teams - in this case creating subdirectories in it could be a good idea) - ``/sandbox/``: a place where users can play and save their test documents, without working in a test project context yet (feasibility tests, demo, troubleshooting, ...) - ``/modules/``: user created or site-related shared modules, available to all (SIP endpoint behaviours, convenience functions according to your organization's use of Testerman, ...) - ``/...``: any other directory, according to your organization, projects, teams, etc. Mapping this subtree to a subtree in an external test system could be a good idea, too. Reusability ----------- This section suggests several best practices to maximize the reusability of the objects you design. Testcases ~~~~~~~~~ ... Behaviours ~~~~~~~~~~ ... Templates ~~~~~~~~~ ... Functions ~~~~~~~~~ ... Simple Functions ^^^^^^^^^^^^^^^^ ... Functions Involving Ports ^^^^^^^^^^^^^^^^^^^^^^^^^ ... ATS --- Control Part ~~~~~~~~~~~~ ... ATS Parameters (Variables) ~~~~~~~~~~~~~~~~~~~~~~~~~~ ... Module ------ ... .. raw:: mediawiki {{TracNotice|{{PAGENAME}}}}