CommandsIntermediate5-7 min reference
Jenkins for QA
Jenkins is still the CI server many test suites run on, driven by a Jenkinsfile. This sheet is the QA-relevant pipeline syntax — stages, parallelism, artifacts, and test reporting — not a full Jenkins admin guide. For CI/CD concepts and the GitHub Actions equivalent see the CI/CD for Testers sheet; for a ready Jenkinsfile see the Configs library (both linked below).
Declarative pipeline skeleton
pipeline {
agent any
stages {
stage('Install') { steps { sh 'npm ci' } }
stage('Test') { steps { sh 'npm test' } }
}
post {
always { junit 'reports/**/*.xml' } // publish results
failure { archiveArtifacts 'screenshots/**' }
}
}The blocks QA cares about
| Block | Purpose |
|---|---|
agent | Where it runs (label, docker { image }) |
stages / stage | Pipeline steps (Build, Test, Deploy) |
steps | Shell commands (sh, bat) |
post | Run after — always, success, failure, unstable |
environment | Env vars / credentials |
parameters | Manual run inputs (browser, env) |
parallel | Run suites concurrently |
options | timeout, retry, timestamps |
Reporting & artifacts
junit '**/test-results/*.xml'— trend graphs + per-test results.archiveArtifacts— keep screenshots, videos, traces, HTML reports.publishHTML(HTML Publisher plugin) — Playwright/Allure reports.- Mark a build unstable (not failed) on test failures vs infra failures.
Common mistakes
- Publishing results only on success — use
post { always { junit … } }so failures still report. - Not archiving screenshots/traces, leaving failures undebuggable.
- One giant stage instead of Install/Test/Report stages (no visibility).
- Hard-coded secrets instead of Jenkins credentials.
- Confusing failed (infra) with unstable (tests failed) status.
// Related resources