Tutorial: CI/CD with GitHub Actions
Set up automated test execution in your GitHub Actions pipeline — organize tests into a suite and plan, configure GitHub secrets, add the workflow file, and verify your first automated run.
Who is this for? Developers, SDETs, and engineering managers who have test cases in ContextQA and want to run them automatically on every pull request or push — so the system catches broken builds before they reach production.
Running tests manually after each deployment works when your team ships once a week. When you ship multiple times a day, manual testing becomes a bottleneck. CI/CD integration solves this by triggering your ContextQA test plan every time code changes — automatically, in the background, with results reported directly to the pull request.
In this tutorial you:
Organize test cases into a suite designed for CI
Create a test plan that the pipeline triggers
Store ContextQA credentials as GitHub secrets
Add a GitHub Actions workflow file to your repository
Push a change and verify the automated run
End result: Every pull request to your main branch triggers a ContextQA test plan. The workflow blocks the merge if tests fail, and posts a link to the full execution report.
Prerequisites
A ContextQA account with at least two test cases created (quickstart if you need to create your first)
A GitHub repository where you can add workflow files
Admin or write access to the repository's Settings → Secrets page
Familiarity with creating test cases and running tests
Step 1: Create a CI smoke test suite
CI pipelines should run fast. Instead of running every test in your workspace, create a focused suite that covers your application's critical paths — login, core feature, and one end-to-end flow.
In the left sidebar, click the Test Development icon.
Click the Test Suites tab.
Click + Create Test Suite.
Enter a suite name:
Smoke_CI.Add a description:
Critical-path tests for CI/CD pipeline execution. Keep this suite under 10 test cases for fast feedback.Click Create Suite.
The system creates an empty suite. Now add your most important test cases:
Open the
Smoke_CIsuite.Click + Add Test Cases.
Select two to five test cases that cover your application's critical paths. Good candidates:
A login or authentication flow
The primary user action (for example, search, create a record, submit a form)
A navigation flow that touches multiple pages
Click Add to confirm.
Tip: Keep CI suites small and fast. A 5-test suite that runs in 2 minutes gives developers feedback while their PR is still fresh. Save large regression suites for nightly scheduled runs.
Verify it worked: The Smoke_CI suite shows your selected test cases in the list. The test case count badge matches the number you added.
Step 2: Create a test plan for CI execution
A test plan wraps one or more suites with execution configuration — browser, environment, and parallel settings. The CI pipeline triggers this plan by ID.
Navigate to Test Development → Test Plans.
Click + Create Test Plan.
Fill in the plan configuration:
Plan name
CI — Smoke Tests
Prefix with "CI" so the team knows this plan is pipeline-triggered
Test suites
Select Smoke_CI
The suite you created in step 1
Browser
Chrome
Chrome is the most common CI target; add more browsers later
Environment
Select your staging environment
CI tests should run against staging, not production
Click Save.
After saving, note the test plan ID. You can find it in two places:
In the browser URL bar when viewing the plan:
https://app.contextqa.com/...test-plans/<plan_id>In the plan details panel
Copy this ID — you need it for the GitHub Actions workflow.
Verify it worked: Open the test plan and click Run to execute it manually once. Confirm all test cases pass against your staging environment before wiring it into CI. If tests fail here, fix them first — a failing test plan in CI blocks every pull request.
Step 3: Store credentials as GitHub secrets
The GitHub Actions workflow needs your ContextQA credentials to authenticate with the API. Store them as encrypted secrets so they never appear in code or logs.
In your GitHub repository, navigate to Settings → Secrets and variables → Actions.
Click New repository secret and add:
CONTEXTQA_USERNAME
Your ContextQA account email
CONTEXTQA_PASSWORD
Your ContextQA account password
Click New repository variable (under the Variables tab) and add:
CONTEXTQA_PLAN_ID
The test plan ID from step 2
Important: Use a dedicated ContextQA service account for CI rather than your personal login. This lets you revoke CI access independently and keeps the audit trail clean. Create a service account under Administration → Team Management with the minimum required permissions.
Verify it worked: After saving, the secrets page shows CONTEXTQA_USERNAME and CONTEXTQA_PASSWORD in the secrets list (values are hidden) and CONTEXTQA_PLAN_ID in the variables list.
Step 4: Add the GitHub Actions workflow file
Create a workflow file in your repository that triggers the ContextQA test plan on every pull request to main.
In your repository, create the directory
.github/workflows/if it does not exist.Create a new file:
.github/workflows/contextqa-tests.ymlPaste the following workflow:
Commit and push this file to a branch (not
mainyet — you test it in the next step).
How the workflow works
The workflow follows three stages:
Authenticate — sends your credentials to the ContextQA login endpoint and receives a Bearer token
Trigger — calls the test plan execute endpoint (a GET request) and receives an execution ID
Poll — checks the execution status every 30 seconds until it completes or times out
If the test plan passes, the workflow exits with code 0 (success). If it fails, the workflow exits with code 1, which marks the GitHub Actions check as failed.
Common mistake: The ContextQA execute endpoint uses a GET request, not POST. Using POST returns a 405 Method Not Allowed error. This is by design — the plan ID in the URL fully identifies the execution.
Step 5: Push a change and verify the automated run
Now test the full pipeline by opening a pull request.
Create a new branch from
main:
Make a small change to any file (for example, add a comment to your README).
Commit and push the branch:
Open a pull request targeting
mainon GitHub.Navigate to the Checks tab on the pull request. You should see the ContextQA Smoke Tests job running.
Watch the job output. It logs each polling attempt with the current status:
Click the report link in the job output to open the full ContextQA execution results — screenshots, video, and per-step pass/fail status for every test case in the plan.
Verify it worked: The pull request shows a green checkmark next to the ContextQA Smoke Tests check. The job output includes the execution report URL.
Step 6: Block merges on test failure (optional)
To require ContextQA tests to pass before a pull request can be merged:
In your GitHub repository, go to Settings → Branches → Branch protection rules.
Click Add branch protection rule (or edit an existing rule for
main).Enable Require status checks to pass before merging.
Search for
ContextQA Smoke Testsand select it.Click Save changes.
With this rule active, the Merge button on pull requests stays disabled until the ContextQA workflow job passes. Developers see a clear message: "Required status check — ContextQA Smoke Tests" with a pass or fail indicator.
Summary
You set up automated CI/CD testing in six steps:
Created a CI smoke suite with your most critical test cases
Created a test plan targeting that suite with browser and environment configuration
Stored credentials as GitHub encrypted secrets
Added a workflow file that authenticates, triggers the plan, and polls for results
Verified the pipeline by opening a pull request and watching the automated run
Blocked merges on test failure using branch protection rules
Every pull request to main now runs your ContextQA tests automatically. Developers get fast feedback, and broken code cannot merge without explicit override.
Next steps
Add more triggers: Extend the workflow to also trigger on pushes to
mainordevelopby addingpush: branches: [main, develop]under theon:section. See the GitHub Actions reference for the full example.Run across multiple browsers: Add a matrix strategy to run the same plan on Chrome, Firefox, and Safari in parallel. See the matrix builds example.
Post results as a PR comment: Add a step that posts the execution report URL directly to the pull request as a comment. See the PR comment example.
Set up nightly regression runs: Create a larger test plan with your full regression suite and trigger it on a cron schedule. See Scheduling.
Related pages
Quickstart Guide — create your first test case
Managing Test Suites — suite organization and naming conventions
Running Tests — all execution options for test cases, suites, and plans
Environments — configure base URLs and variables for different targets
GitHub Actions — full GitHub Actions reference with advanced patterns
Jenkins — Jenkins pipeline integration
Integrations Overview — all supported CI/CD and tool integrations
Automate your test pipeline in 15 minutes — no code required. Start Free Trial → — Or Book a Demo → to see CI/CD integration with your existing toolchain.
Last updated
Was this helpful?
