Tests specification

Standards for Handling Errors and Exceptional Situations

  1. HTTP Status Codes: The tests check the expected HTTP status codes for different scenarios, such as HTTP_200_OK, HTTP_201_CREATED, HTTP_202_ACCEPTED, HTTP_400_BAD_REQUEST, HTTP_401_UNAUTHORIZED, and HTTP_404_NOT_FOUND. This follows the standard conventions for RESTful APIs.

  2. Assertions: The unittest library is used for assertions, ensuring that the expected conditions are met during the tests.

  3. Error Messages: Some tests check for specific error messages or details in the response content, providing useful information for debugging.

Types of Tests

  1. Unit Tests: The tests cover individual components, such as the signup, login, logout, and project-related functionalities. Each test case focuses on a specific aspect of the application.

  2. Integration Tests: Some tests involve multiple components interacting with each other, such as authentication and authorization checks during login and logout.

  3. Functional Tests: The tests simulate the behavior of the application by interacting with its API endpoints, checking responses, and ensuring the correct execution of various functionalities.

Specification and Description of Test Types

SignUpViewTests: Tests the signup functionality with various scenarios, including valid data, invalid existing username, invalid existing email, no email, bad email, no username, no password, and no username and password.

LoginViewTests: Tests the login functionality with valid and invalid scenarios, including wrong password, non-existent username, no username, no password, and no username and password.

LogoutViewTests: Tests the logout functionality for authenticated and unauthenticated users, including cases with and without a token.

TestTokenViewTests: Tests the token test functionality for an authenticated user.

ListProjectsViewTests: Tests the listing of projects, including valid and empty scenarios.

ListModelsViewTest: Tests the listing of models for a specific project, including valid and empty scenarios.

ProjectCreateViewTests: Tests the creation of a project with valid and invalid scenarios, including unauthorized and missing data.

ModelCreateViewTests: Tests the creation of a model with valid and invalid scenarios, including empty project, bad architecture, no data, and unauthorized access.

UploadAnnotationViewTests: Tests the upload of annotations with valid and invalid scenarios, including unauthenticated access, invalid file types, and missing files.

ProjectDeleteViewTests: Tests the deletion of a project with valid and invalid scenarios, including non-existent projects.

ProjectEditViewTests: Tests the editing of a project with valid and invalid scenarios, including missing ID and incorrect fields.

ListScoresViewTest: Tests the listing of scores for a model.

MakePredictionsViewTest: Tests making predictions for a model with various scenarios.

TrainViewTests: Tests the training endpoint with unauthenticated access.

Test Scenarios

Each test case explores different scenarios, covering a wide range of inputs and conditions to ensure robustness and reliability of the application.

Test Quality Measures

Readability: The tests are well-organized, with clear setup, test execution, and assertion phases. Descriptive method and variable names enhance readability.

Coverage: The tests cover various aspects of user authentication, project, and model management, ensuring comprehensive test coverage.

Consistency: The naming conventions and structure of the tests are consistent, promoting maintainability.

Documentation: Inline comments provide additional context for specific test scenarios.