
Learn how to integrate bashcov with a simple profile file, rank file, or ci workflows, create a badge for your project, and set or output coverage percentages.
Plan the course prerequisites and workflow from a Linux Ubuntu setup to creating a repository, writing unit tests, merging coverages, and applying a coverage badge.
Create the main bash script to drive code coverage, defining functions, printing messages with echo, and preparing for unit tests in the next lecture.
Add unit tests for the core script by sourcing the main script and calling function one and two, with test logs and permissions.
Install ruby on ubuntu with sudo apt-get install ruby, then grant write permissions to the RubyGems directory and install Bashcov version 1.8 following the readme.
Run the first coverage command to generate an HTML report for a single unit test, view the main script coverage, and compare percentages and line counts.
Learn how to run a merged coverage with Bashcov by combining unit test results into a single coverage report, and use filters to exclude specific files.
Use a one-line bash script to call all unit tests with a for loop, and measure coverage, achieving 87.5% script coverage and 0% for called tests.
Learn how to add and manage filters to exclude files and folders from code coverage, and verify updated results as you adjust the filters.
Exclude lines from coverage using nocov, mark lines with a nocov directive, and observe the coverage drop from 87.5% to 83.33% as those lines are skipped.
Learn how to export terminal logs during local tests using the nohup option to save output to a file, paving the way for cloud work and expanding code coverage integration.
Learn to create a GitLab CI YAML pipeline with stages and jobs, configure a build job using a docker image and environment variables, and push the image to a registry.
Add a main bash script for bashcov by creating a custom script directory, adding custom_script.sh with a bash shebang, defining test functions, and marking certain functions as excluded from coverage.
Add and organize unit tests in a Bashcov workflow by creating test directories and files, sourcing environment variables, and validating test outcomes in the pipeline.
Learn to run bashcov on unit tests by extending a base yaml template with a unit testing stage, referencing the registry image, and using artifacts to publish coverage results.
Explains configuring bashcov with simplecov, creating a custom script file, and enabling merged, tabbed coverage views for unit tests using environment variables.
Create and name a simplecov helper file, require simplecov, and define a module to merge json coverage results, format the array, and prepare the final coverage data for the pipeline.
Add a rakefile to merge ruby coverage reports using the simplecov helper, define a total coverage task, and extend the ci yaml with a third stage for bashcov integration.
Update the gitlab-ci.yml to add a third stage for total coverage, extend the base template, export artifacts from earlier jobs, and compute a unified total coverage of 83.33 percent.
Create a merge request and add a regex to extract the total coverage from the pipeline output. Configure settings to capture only the total coverage and verify it shows 84.21%.
Configure a live coverage badge at the top of your project by adding a badge, linking to the latest pipeline, and using environment variables to extract total coverage from artifacts.
Hi! I am a Software Engineer and I have carefully designed this course for you to get to know the aspects of Bashcov in a simple and pleasant manner.
Course is intended for anyone out there working with Bashcov or simply interested in this field. You frankly don't need much previous information to get started and learn what I am presenting here.
Course is intended for all levels.
Note:
=> Course treats both situations [Local coverage with Bashcov / Cloud (Gitlab) coverage with Bashcov]
=> So if you are interested only in the Gitlab part, please jump directly to the Chapters named "On Gitlab. (...) ".
You'll get to see:
More than 3 hours of hands-on training;
10 Downloadable resources;
Step-by-step applied theory;
You will:
Integrate the Bashcov tool;
Add a Coverage Badge to your repository;
Set a coverage percentage threshold to your future Merge Requests;
Have both individual and merged coverages across all your unit tests;
Use Dockerfile, Rakefile, .simplecov and gitlab-ci yml files in synergy;
Work with Bashcov's filters and 'nocov' option;
Export the unified coverage percentage to your MRs;
Test Bashcov on a real-world scenario in Gitlab;
Get my recommendations and best practices;