Sign inSign up free

505. Summarize Test Results for the Pipeline

medium 20 XP ~12 minHands-on lab

Each test job writes a JSON report into a results folder, like this:

{"suite": "api", "tests": [
  {"name": "creates user", "status": "passed", "duration": 0.12},
  {"name": "rejects bad email", "status": "failed", "duration": 0.05},
  {"name": "slow import", "status": "skipped", "duration": 0}
]}

/home/student/results/ has a few to try.

Task

Create the executable script /home/student/bin/test-summary.sh DIR that reads every *.json file in DIR and prints:

<suite> <passed> <failed> <skipped>
...
TOTAL <passed> <failed> <skipped>
  • one line per suite, sorted by suite name; if two files report the same suite, add them together,
  • then the TOTAL line,
  • exit 1 if any test failed, otherwise 0.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Part of Shell Scripting for Automation. Next step: Who Is Missing, Who Shouldn't Be There?

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.