DEV Community

DCT Technology Pvt. Ltd.
DCT Technology Pvt. Ltd.

Posted on

A Test That No One Runs Is Worse Than No Test At All

Picture this:
A developer proudly writes a bunch of test cases, merges the code, and moves on. Weeks later, a bug hits production—the test that could’ve caught it was there… but never actually ran.

What’s worse than not writing tests?
Writing them, then forgetting to run them.

Image description

🧠 Why This Happens More Than We Admit

  • The CI pipeline is misconfigured.
  • Someone renamed a folder or file structure, and test discovery silently broke.
  • Test commands were added in a local README.md but never hooked into automated deployment.
  • Teams switch to new frameworks and don't update testing commands accordingly.

Sound familiar?
Now ask yourself: When was the last time you actually verified your tests were running, not just passing?


✅ What You Can Do Today (Practical Tips)

  1. Check Your CI Config Tools like GitHub Actions, GitLab CI, or CircleCI are great—but only when set up properly. Here’s an example GitHub Action to run your tests every push:
   name: Run Tests
   on: [push, pull_request]
   jobs:
     test:
       runs-on: ubuntu-latest
       steps:
         - uses: actions/checkout@v3
         - name: Setup Node
           uses: actions/setup-node@v4
           with:
             node-version: '18'
         - run: npm install
         - run: npm test
Enter fullscreen mode Exit fullscreen mode

Want a deeper dive? Check out this guide on setting up test pipelines.

  1. Make Tests Mandatory in PRs
    Never merge without seeing green. Use GitHub branch protection rules or GitLab merge checks to block PRs unless tests pass.

  2. Add a Test Summary to Your Build Output
    Use reporters that show test counts. If it says “0 tests run”, it should raise a red flag immediately.

  3. Run Tests Locally Before Pushing
    Use tools like husky to automate test runs:

   npx husky-init && npm install
   npx husky add .husky/pre-commit "npm test"
Enter fullscreen mode Exit fullscreen mode

More on Husky here.

  1. Visibility = Accountability Show test results on your dashboard. Tools like Codecov or SonarCloud visualize test coverage and execution history.

🚨 Real World Example: A Costly Miss

In a large React project, a dev assumed the npm test script was running during deployment. It wasn’t. A simple undefined prop slipped into a component, broke the UI for thousands, and it was already covered by a test.

The problem? The test folder was accidentally renamed to __test__ instead of __tests__.


🔍 Your Dev Toolkit Should Include...

  • Linting + Testing in CI/CD
  • Test coverage reports with nyc (Istanbul)
  • Periodic validation of test runs
  • Integration + E2E testing via Cypress or Playwright

Don’t stop at just writing tests. Validate, run, automate.
Make tests visible. Make failures loud.


🧩 Ask Yourself (and Comment Below):

  • When was the last time you checked if your tests are actually running?
  • Do you trust your test setup enough to ship without fear?

Let’s open this up—drop your strategies, horror stories, or even your test setup below 👇


🔁 For more real-world dev tips, testing best practices, and software engineering wisdom—
Follow [DCT Technology]and never miss an upgrade to your dev game!


#devcommunity #webdevelopment #testing #qa #ci #codetips #softwareengineering #devlife #techblogs #automation #nodejs #reactjs #githubactions #dcttechnology #testautomation #bugfreecode

Top comments (0)