Skip to content

Naming Conventions

ChernenkoVitaliy edited this page Dec 5, 2024 · 5 revisions

Naming Convention for Test Methods

When naming test methods, we follow a specific convention to ensure clarity and consistency. The convention is based on the idea of describing the feature or functionality being tested.

Format: featureTestScenario

feature: A brief description of the feature or functionality being tested, such as "Is Adult", "Withdraw Money", "Admit Student", etc.

TestScenario: A phrase that describes the specific scenario or condition under which the test is being performed, such as "If Age is Less Than 18", "When Account is Invalid", "If Mandatory Fields are Missing", etc.

Examples:

Example methods:
boolean isAdult(int age) {...}
boolean withdrawMoney(BigInteger amount, Account account) {...}
Student admitStudent(Student student) {...}

isNotAnAdultIfAgeLessThan18: This test method checks that the isAdult method returns false when the age is less than 18.
failToWithdrawMoneyIfAccountIsInvalid: This test method checks that the withdrawMoney method fails or returns an error when the account is invalid.
studentIsNotAdmittedIfMandatoryFieldsAreMissing: This test method checks that the admitStudent method returns an error or does not admit the student when mandatory fields are missing.

This convention helps to create clear and concise test method names that accurately describe the feature being tested and the specific scenario or condition under which the test is being performed. It also makes it easier to understand the purpose of each test method and ensures consistency across the test suite.

Git branches naming

Prefixes
 	- bug
	- doc       - to add some documentation 
	- feature
	- test
	- migration - for sql scripts

 - Example ->  bug/234/fix-something
                |   |            |
            prefix  issue       message