Contribute component tests
This guide outlines how to structure and implement tests for application components to ensure consistency and adequate coverage.
File naming
-
The test file should follow the same directory structure as the component being tested, but should be placed in the corresponding unit tests folder.
For example, if the file path for the component is
src/lfx/src/lfx/components/data/, then the test file should be located atsrc/backend/tests/unit/components/data. -
The test file name should use snake case and follow the pattern
test_<file_name>.py.For example, if the file to be tested is
FileComponent.py, then the test file should be namedtest_file_component.py.
File structure
- Each test file should group tests into classes by component. There should be no standalone test functions in the file— only test methods within classes.
- Class names should follow the pattern
Test<ClassName>. For example, if the component being tested isFileComponent, then the test class should be namedTestFileComponent.