Skip to content

Commit

Permalink
Merge pull request #144 from yunks128/main
Browse files Browse the repository at this point in the history
Guide on Continuous Testing
  • Loading branch information
yunks128 authored Jun 26, 2024
2 parents 111e50f + 6b15a4f commit ff1afa8
Show file tree
Hide file tree
Showing 9 changed files with 1,169 additions and 119 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docusaurus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:
cache: yarn

- name: Install dependencies
run: yarn install --frozen-lockfile
run: |
yarn install --frozen-lockfile
npm install raw-loader --save-dev
- name: Build website
run: yarn build

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# example .pre-commit-config.yaml
fail_fast: true # Stops running hooks after the first failure

repos: # List of repositories containing pre-commit hooks

# Language-Agnostic Hooks
- repo: https://github.com/pre-commit/pre-commit-hooks # Repository URL
rev: v4.5.0 # Version or commit hash to use
hooks: # List of hooks to be executed
- id: trailing-whitespace # Removes trailing whitespace from files
- id: end-of-file-fixer # Ensures that files end with a newline character
- id: check-yaml # Lints YAML files for syntax errors
- id: check-xml # Lints XML files for syntax errors
- id: check-json # Checks JSON files for parsable syntax
- id: check-added-large-files # Checks for large files added to the repository
args:
- --maxkb=50000 # Specifies the maximum allowed file size in kilobytes

# Language-Specific Hooks: Python
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort # Sorts Python import statements
- id: black # Formats Python code using the Black formatter

# Language-Specific Hooks: Ruby
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
hooks:
- id: ruff # Runs Ruff, a Ruby static code analyzer

# General Security Checks
- repo: https://github.com/PyCQA/bandit
rev: "1.7.7"
hooks:
- id: bandit # Runs Bandit, a security linter for Python code
args:
- "--configfile=pyproject.toml" # Specifies a configuration file for Bandit
- "--severity-level=h"

# Language-Specific Hooks: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: "v0.39.0"
hooks:
- id: markdownlint # Lints Markdown files according to specified configuration
args: ["--config", ".markdownlintrc", "--ignore", "CHANGELOG.md"]

# Additional Hooks: Other Languages
- repo: https://github.com/pre-commit/pre-commit-hooks # Repository URL
rev: v4.5.0 # Version or commit hash to use
hooks: # List of hooks to be executed
- id: check-toml # Lints TOML files for syntax errors
663 changes: 661 additions & 2 deletions docs/guides/software-lifecycle/continuous-testing/README.md

Large diffs are not rendered by default.

135 changes: 135 additions & 0 deletions docs/guides/software-lifecycle/continuous-testing/TESTING-example.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
---
title: TESTING.md (Example)
sidebar_label: TESTING.md (Example)
---

# Jupiter3D Testing

## Introduction
This document provides an overview of the testing architecture for Jupiter3D. It encompasses continuous testing concepts such as testing across the software development lifecycle as well as automated execution of tests through automation.

---

## Testing Categories

The below list of test categories are included in our testing setup. Further details are provided below.

- [ ] Static Code Analysis
- [x] Unit Tests
- [x] Security Tests
- [ ] Build Tests
- [ ] Acceptance Tests
- [x] Integration Tests
- [x] Performance Tests
- [x] Usability Tests

### Unit Tests

#### Main Tests

- Location: `./tests/test_main.py`
- Purpose: To test our main script's functions and methods.
- Running Tests:
- Manually:
1. Navigate to the project root directory in the command line.
2. Execute `pytest ./tests/test_main.py`.
3. View Results: Results will appear in the command-line output or can be formatted into a report using the `pytest-html` plugin.
- Automatically:
- Frequency:
- Triggered by code changes and commits to the `src/my_package/main.py` file on GitHub.
- Runs during nightly builds with other unit tests.
- Results Location: [GitHub Actions Unit Test Results](https://github.com/myorg/myrepo/actions/workflows/unit-tests.yml)
- Contributing:
- Framework Used: [PyTest](https://docs.pytest.org/en/8.2.x/)
- Tips:
- Test every non-trivial function or method in your code
- Test conditions including malformed arguments and null conditions

#### Models

- Location: `./tests/test_model_*.py`
- Purpose: To test our 3D model rendering code for integrity and functionality
- Run Tests:
- Manually:
1. Navigate to the project root directory in the command line.
2. Execute `pytest ./tests/test_model_*.py`.
3. View Results: Results will appear in the command-line output or can be formatted into a report using the `pytest-html` plugin.
- Automatically:
- Frequency:
- Triggered by code changes and commits to the `src/my_package/test_model_*.py` file on GitHub.
- Runs during nightly builds with other unit tests.
- Location: [GitHub Actions Unit Test Results](https://github.com/myorg/myrepo/actions/workflows/unit-tests.yml)
- Contributing:
- Framework: [PyTest](https://docs.pytest.org/en/8.2.x/)
- Tips:
- Test each model for edge cases like anti-meridian lines or poles

### Security Tests

#### Dependabot
- Purpose: Ensure our software dependencies are being scanned for vulnerabilities using Dependabot
- Running Tests:
- Automatically:
- Frequency: Daily
- Results Location: Security tab on repository's GitHub website

### Integration Tests

#### Web App API
- Location: `[./tests/integration/web]`
- Purpose: Ensure Web UI software interacts smoothly with other software.
- Running Tests:
- Manually:
1. Install and configure Selenium WebDriver for your target browsers.
2. Run `python ./tests/integration/web/test_suite.py`
3. Review the test execution logs and screenshots captured during the test run.
- Automatically:
- Frequency:
- Nightly builds
- Results Location: [GitHub Actions Integration Test Results](https://github.com/myorg/myrepo/actions/workflows/integration-tests.yml)
- Contributing:
- Framework Used: Selenium
- Tips:
- Test the interaction between software components and external APIs

### Performance Tests

#### Chaos Testing
- Location: `./tests/performance/chaos`
- Purpose: Ensure the software is robustly designed to scale and handle expected failures.
- Running Tests:
- Manually:
1. Navigate to `./tests/performance/chaos`.
2. Execute the relevant test scripts for stress / chaos testing.
3. View results in the output logs or generated reports.
- Automatically:
- Frequency:
- Triggered by significant changes.
- Quarterly stress tests.
- Results Location: test deployment machine
- Contributing:
- Framework Used: Chaos Monkey
- Tips:
- Consider testing both typical and peak usage scenarios.
- Ensure that performance tests represent real-world conditions as closely as possible.
- Validate resource utilization thresholds to identify bottlenecks proactively.

### User Interface (UI) Tests

#### UI User Experience
- Location: `./tests/ui`
- Purpose: Ensure that the software meets users' needs and expectations through robust UI design.
- Running Tests:
- Manually:
1. Navigate to `./tests/ui`.
2. Execute the relevant UI test scripts.
3. View results in the output logs or generated UI testing reports.
- Automatically:
- Frequency:
- Prior to major updates and releases.
- Quarterly user experience reviews.
- Results Location: [GitHub Actions UI Test Results](https://github.com/myorg/myrepo/actions/workflows/ui-tests.yml)
- Contributing:
- Framework Used: Selenium
- Tips:
- Ensure your tests validate compliance with [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/TR/WCAG21/).
60 changes: 60 additions & 0 deletions docs/guides/software-lifecycle/continuous-testing/TESTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
title: TESTING.md Template
sidebar_label: TESTING.md Template
---

```markdown
# [INSERT PROJECT NAME HERE] Testing

## Introduction
This document provides an overview of the testing architecture for [INSERT PROJECT NAME HERE]. It encompasses continuous testing concepts such as testing across the software development lifecycle as well as automated execution of tests through automation.

---

## Testing Categories

The below list of test categories are included in our testing setup. Further details are provided below.

<!-- ADD / MODIFY BELOW CATEGORIES TO AS NEEDED -->
- [ ] **Static Code Analysis:** checks code for syntax, style, vulnerabilities, and bugs
- [ ] **Unit Tests:** tests functions or components to verify that they perform as intended
- [ ] **Security Tests:** identifies potential security vulnerabilities
- [ ] **Build Tests:** checks if the code builds into binaries or packages successfully
- [ ] **Acceptance Tests:** validates against end-user & stakeholder requirements

<!-- CHOOSE MORE FROM THE BELOW LIST OR CREATE YOUR OWN
- [ ] **Integration Tests**
- [ ] **System Tests**
- [ ] **Performance Tests**
- [ ] **Security Tests**
- [ ] **Usability Tests**
- [ ] **Regression Tests**
- [ ] **Smoke Tests**
-->

<!-- REPEAT THIS SECTION AS NEEDED FOR ABOVE CATEGORIES -->
### [INSERT TESTING CATEGORY HERE] Tests

<!-- ADD SUB-BLOCKS AS NEEDED FOR MULTIPLE TEST FILES OR GROUPS WITHIN SAME CATEGORY ABOVE -->
<!-- #### [INSERT SUB-CATEGORY NAME IF MORE THAN ONE SUB-BLOCK] -->
- Location: `[INSERT RELATIVE PATH TO SUB-FOLDER / FILE / FILE PATTERN HERE]`
- Purpose: [INSERT A 1-SENTENCE PURPOSE STATEMENT FOR TEST HERE]
- Running Tests:
- Manually:
1. [INSERT STEP 1]
2. [INSERT STEP 2]
3. [INSERT WHERE TO VIEW RESULTS]
- Automatically:
- Frequency:
- [INSERT TRIGGER OF WHAT KICKS OFF YOUR TESTS, E.G. CODE CHANGES, COMMITS, ETC.]
- [INSERT TIMING OF WHEN YOUR TESTS KICK OFF, E.G. NIGHTLY, EVERY WEEK, ETC.]
- Results Location: `[INSERT PATH OR LOCATION WHERE RESULTS WILL RESIDE]`
- Contributing:
- Framework Used: [INSERT YOUR TESTING FRAMEWORK OF CHOICE]
- Tips:
- [INSERT TIPS ON CONTRIBUTING TESTS HERE]
<!-- e.g.
- Test every non-trivial function or method in your code
- Test conditions including malformed arguments and null conditions
>
```
Loading

0 comments on commit ff1afa8

Please sign in to comment.