Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Increase test coverage to 80% #119

Open
Tracked by #89
zz-jason opened this issue Aug 21, 2024 · 0 comments
Open
Tracked by #89

Increase test coverage to 80% #119

zz-jason opened this issue Aug 21, 2024 · 0 comments
Labels
good first issue Good for newcomers

Comments

@zz-jason
Copy link
Owner

Background

Currently, the overall test coverage of LeanStore is very low. Increasing unit test coverage is essential for detecting bugs early, improving code quality, and providing confidence when making changes. It also serves as documentation, showing how the code is intended to work, and makes the codebase easier to maintain and refactor. Overall, comprehensive unit tests ensure robust, reliable, and maintainable software.

How to generate coverage report in HTML

Mainly, you can follow the build and test steps in the CI workflow to install necessary tools

# generate compile database wich cmake preset
cmake --preset debug_tsan

# build
cmake --build build/debug_tsan -j `nproc`

# run unit tests, generate coverage raw data
TSAN_OPTIONS="suppressions=$(pwd)/tests/tsan.supp" ctest --test-dir build/debug_tsan --output-on-failure -j 2

# generate coverage report in HTML format
gcovr -v -r . --html-details --output=coverage.html --exclude 'build/*' --exclude 'tests/*' --exclude 'benchmarks/*' --verbose

# start a simple HTTP server to view the HTML report.
# then you can view the coverage report in your browser at
# http://localhost:8000/coverage.xml
python3 -m http.server -d .

Methods to improve test coverage

  1. add unit tests in the tests directory, there are lots of test examples
  2. remove unused dead code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant