This document provides an overview of the testing architecture for SLIM CLI. It encompasses continuous testing concepts such as testing across the software development lifecycle and automated test execution.
The below list of test categories is included in our testing setup. Further details are provided below.
- Static Code Analysis: checks code for syntax, style, vulnerabilities, and bugs
- Unit Tests: tests functions or components to verify that they perform as intended
- Integration Tests: tests interactions between different components of the system
- Security Tests: identifies potential security vulnerabilities
- Build Tests: checks if the code builds into binaries or packages successfully
- Location:
/.github/workflows/linting.yml
- Purpose: Ensure code quality, consistency, and detect potential issues early.
- Running Tests:
- Manually:
- Install required linters:
pip install flake8 pylint
- Run linters:
flake8 slim_cli.py
andpylint slim_cli.py
- View results in the terminal output
- Install required linters:
- Automatically:
- Frequency:
- On every pull request to the main branch
- On every push to the main branch
- Results Location: GitHub Actions tab in the repository
- Frequency:
- Manually:
- Contributing:
- Framework Used: flake8 and pylint
- Tips:
- Follow PEP 8 style guide
- Use consistent naming conventions
- Keep functions and methods short and focused
- Location:
/tests/unit/
- Purpose: Verify individual functions and methods work correctly in isolation.
- Running Tests:
- Manually:
- Navigate to the project root directory
- Run:
python -m unittest discover tests/unit
- View results in the terminal output
- Automatically:
- Frequency:
- On every pull request to the main branch
- On every push to the main branch
- Results Location: GitHub Actions tab in the repository
- Frequency:
- Manually:
- Contributing:
- Framework Used: unittest
- Tips:
- Test each function in
slim_cli.py
separately - Use mock objects to isolate units from external dependencies
- Test edge cases and error conditions
- Test each function in
- Location:
/tests/integration/
- Purpose: Ensure different components of SLIM CLI work together correctly.
- Running Tests:
- Manually:
- Navigate to the project root directory
- Run:
python -m unittest discover tests/integration
- View results in the terminal output
- Automatically:
- Frequency:
- On every pull request to the main branch
- Nightly builds
- Results Location: GitHub Actions tab in the repository
- Frequency:
- Manually:
- Contributing:
- Framework Used: unittest
- Tips:
- Test interactions between different functions and modules
- Create test repositories to simulate real-world scenarios
- Verify correct behavior of apply, deploy, and apply-deploy commands
- Location:
/.github/workflows/security.yml
- Purpose: Identify potential security vulnerabilities in the codebase and dependencies.
- Running Tests:
- Manually:
- Install security scanning tools:
pip install bandit safety
- Run scans:
bandit -r slim_cli.py
andsafety check
- View results in the terminal output
- Install security scanning tools:
- Automatically:
- Frequency:
- On every pull request to the main branch
- Weekly scans
- Results Location: GitHub Actions tab in the repository
- Frequency:
- Manually:
- Contributing:
- Framework Used: Bandit and Safety
- Tips:
- Regularly update dependencies to their latest secure versions
- Avoid using hard-coded credentials or sensitive information
- Be cautious when using external libraries and evaluate their security
- Location:
/.github/workflows/build.yml
- Purpose: Ensure the SLIM CLI can be built and packaged correctly.
- Running Tests:
- Manually:
- Navigate to the project root directory
- Run:
python setup.py sdist bdist_wheel
- Check if the distribution files are created in the
dist/
directory
- Automatically:
- Frequency:
- On every pull request to the main branch
- On every push to the main branch
- Results Location: GitHub Actions tab in the repository
- Frequency:
- Manually:
- Contributing:
- Framework Used: setuptools
- Tips:
- Keep
setup.py
up to date with new dependencies - Test the built package by installing it in a fresh virtual environment
- Verify that the CLI works correctly when installed as a package
- Keep