assert_
glossary ↓ downloads
track: java · selenium
suite 07 · real-world engineering

CI — tests on every push

Real-world engineering18 min
as a manual tester

You run regression when someone remembers to ask you.

in automation

CI runs it on every single code push, automatically, and emails the red. Nobody has to remember. This is automation's endgame.

Continuous Integration means a server runs your suite on every push to the repo. GitHub ships this built-in as GitHub Actions, free for public repos. The setup is one YAML file — and you already know the command it will run: mvn test.

.github/workflows/tests.yml
name: automated-tests

on:
  push:            # every push to any branch
  workflow_dispatch:  # plus a manual Run button

jobs:
  test:
    runs-on: ubuntu-latest      # a fresh Linux VM, Chrome preinstalled
    steps:
      - uses: actions/checkout@v4          # get your code
      - uses: actions/setup-java@v4         # install JDK 21
        with:
          distribution: temurin
          java-version: 21
      - name: Run tests
        run: mvn -B test -Dheadless=true     # -B = no color codes in logs
      - uses: actions/upload-artifact@v4    # keep failure evidence
        if: failure()
        with:
          name: failure-evidence
          path: |
            screenshots/
            target/surefire-reports/
what happens on every push
git push your laptop GitHub Actions · ubuntu VM checkout code set up JDK 21 mvn test -Dheadless=true ✓ BUILD SUCCESS badge turns green ✗ FAILURE artifacts: screenshots, surefire reports runs on every push — nobody has to remember

(This exact file is downloadable: tests.yml — including the nightly cron discussed below.) Commit it, push, and open the repo's Actions tab:

GitHub Actions run log
✓ automated-tests  #12  (push, main)  2m 41s

  ✓ Set up job
  ✓ actions/checkout@v4
  ✓ actions/setup-java@v4
  ✓ Run tests
      [INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 1
      [INFO] BUILD SUCCESS
The Actions tab after a green run — every step ticked, tests summary in the log
📷 screenshot slot — add images/actions-green-run.png
The Actions tab after a green run — every step ticked, tests summary in the log

That green check now appears on every commit — and any teammate's push that breaks a test goes visibly red, with your screenshots and reports downloadable from the run page. You've built the thing teams actually pay automation engineers for.

The one requirement: headless

The CI machine has no screen, so Chrome must run headless (windowless). Notice the workflow passes -Dheadless=true — the next lesson wires that flag into your DriverFactory. Sequence the two lessons' exercises accordingly: wire headless first, then push.

Scheduling — the nightly regression: add schedule: - cron: "0 2 * * *" under on: and your full suite also runs at 2:00 every night, exactly like a real team's nightly regression. Combine with tags: smoke on push, full suite on schedule.
⚠ when it breaks — the classics
I pushed, but Actions shows nothing
(empty Actions tab)

Fix: The path must be exactly .github/workflows/tests.yml — dot, plural workflows, committed and pushed. YAML is also indentation-sensitive: two spaces, never tabs.

The run is red with 'exit code 1' and nothing else obvious
Error: Process completed with exit code 1.

Fix: That's just Maven's generic failure signal. Expand the Run tests step and scroll to the first red block — same skill as the terminal lesson, same first-red-block rule.

⚡ exercise · go live
  1. Complete the next lesson's headless flag first (10 minutes), or temporarily keep only API tests tagged for CI — they need no browser.
  2. Add the workflow file, commit, push.
  3. Watch the Actions tab run live. Then break a test, push, and enjoy the red — download the screenshot artifact from the run page.
  4. Fix and push again. Green. That loop is professional life.
key takeaways
  • CI = your suite runs on every push; GitHub Actions makes it one YAML file.
  • The pipeline literally runs mvn test — the command you've known since Suite 01.
  • Upload screenshots/reports as artifacts on failure; schedule nightly full runs with cron.
← Designing a framework Headless & parallel — speed →