-
Notifications
You must be signed in to change notification settings - Fork 34
Conventions and good practices
- Add new parameters to the RESTest configuration file
- Write unit test cases for every new functionality
- Document your code responsibly
- Use SonarLint to avoid bugs, vulnerabilities and bad smells
Whenever you develop a new functionality that requires some parameter to be configured by the user, include that parameter in the RESTest configuration file.
To add a new parameter, you must include a new static
field that will be set in the setEvaluationParameters(String evalPropertiesFilePath)
method of the IterativeExample
class. You must use the readExperimentProperty(String evalPropertiesFilePath, String parameterName)
to obtain the value of the parameter from the properties file. For example, here's how RESTest gets the value of the oaispecpath
parameter:
OAISpecPath = readExperimentProperty(evalPropertiesFilePath, "oaispecpath");
These tests should be placed under src/test/java
folder. Every test class must have the same package name as the the Java class you are testing, and the same class name with the Test
suffix.
- Clarify the purpose of the methods/classes you implement.
- Create structure and readable code that does not require many inline comments.
- Use Javadoc for hard-to-understand or important methods/classes:
/**
* Description of your method.
*
* @param demoParam Description of the parameter
* @return What the method returns
*/
public String demoMethod(Integer demoParam) {...}
RESTest uses SonarCloud to evaluate the quality and the security of the code. If you want to check the quality of your code before actually committing it, we recommend you to use SonarLint. It is an IDE extension which evaluates your code quality and security in real time, adding warnings in the flaws found. You can use it in Eclipse, IntelliJ IDEA, Visual Studio and VS Code.