Testing in a CI/CD Pipeline Part 1: PR testing
Why, how, when, where to perform testing in a CI/CD pipeline.

Search for a command to run...
Why, how, when, where to perform testing in a CI/CD pipeline.

No comments yet. Be the first to comment.
Tools are an essential part of developing good and consistent software. This is my attempt to help you out & shed some light on the tools that helped me because it's just an idea that all you need π‘.
Use Azure DevOps REST API to automate multiple inter-dependant pipelines and run them in harmony
Bringing in a fresh perspective on how you can turn your traditional streaming pipeline to perform like batch processing with endless possibilities

Uncover why SQL may not be the best choice for ETL pipelines in data applications and learn about common hurdles.

Turning Data Pipeline Failures into Success Stories: A Memory Optimization Case Study with Polars Library & Data Engineering best practices.

Practical techniques backed by benchmarks for working with Databases effectively in Python

Guide to Efficiently Streamlining Your Databricks Environment Setup

There is no doubt the benefits of TDD π§ͺ or test driven development. Follow this awesome Twitter thread and I bet if you not a fan of TDD you will surely become one.
TDD is a lot more than just the Unit testing. Lets us see how we can design our CI/CD pipeline to adapt to the TDD approach.
Info: π‘π‘π‘
I am using the Azure DevOps pipeline as CI/CD tool. But I believe you will be able to implement it in other CI/CD tool too. Understanding the mechanism is key.
Let's break down the pipeline into three component and see how to perform a test there.
PR testing is different from the system or unit testing. Let's see in brief (as the original intent of this guide is how to integrate it CI/CD pipeline)
Why
How
When
Where
- task: CmdLine@2
inputs:
script: |
# If you have setup.py
python3 -m pip install .
pytest -vv
workingDirectory: '$(System.DefaultWorkingDirectory)'
trigger:
- develop
pool:
vmImage: 'ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.x'
addToPath: true
architecture: 'x64'
- task: CmdLine@2
inputs:
script: |
# If you have setup.py
python3 -m pip install .
pytest -vv
workingDirectory: '$(System.DefaultWorkingDirectory)'
Tip: π€π€π€
From above you can see I am using trigger as develop branch as this PR testing is intended for develop branch.
Img: Branch Policies
Img: Build Validation
Img: Build Validation Policy

Img: How the PR testing works (see the marked item)