Graphite Reviewer is now Diamond

Code review vs automated testing: why you need both

Greg Foster
Greg Foster
Graphite software engineer
Try Graphite

Table of contents

In modern development workflows, code review and automated testing are critical for ensuring high-quality, reliable software. Developers often ask: code review vs testing, what's the difference? Or, is code review before testing? While both aim to catch bugs and improve software quality, they serve distinct roles. This article breaks down the difference, explains why you need both, and highlights how tools like Graphite can help.

Code review is a collaborative process where developers examine each other's code changes before merging. It focuses on code clarity, logic, structure, and maintainability. Reviewers check for potential bugs, adherence to coding standards, security issues, and opportunities for improvement. Code review acts as a gate to keep poor-quality code from entering the codebase.

Code reviews are typically done via pull requests. Tools like GitHub, GitLab, and Graphite streamline this with inline comments, review assignments, and workflow automation. Graphite, in particular, supports stacked pull requests, which help break large changes into manageable, reviewable chunks—making reviews faster and more effective.

Automated testing involves writing scripts to execute code and validate its behavior. Tests may check individual units (unit tests), component interactions (integration tests), or entire user flows (end-to-end tests). These tests run automatically via continuous integration (CI) pipelines and are key to preventing regressions.

Testing frameworks include Jest (JavaScript), JUnit (Java), and Cypress (browser automation). Tests verify that code behaves as expected under different conditions. Automated tests are fast, repeatable, and reduce the burden of manual QA.

At a high level, code review and testing tackle different concerns:

AspectCode reviewAutomated testing
TypeStatic (manual or tool-assisted)Dynamic (code is executed)
FocusCode quality, readability, maintainabilityFunctional correctness, regressions
Performed byDevelopers (peers, leads)CI tools, test runners
WhenBefore mergeOn every build or push
ToolsGitHub, GitLab, Graphite, ReviewableJest, Mocha, Cypress, JUnit, Selenium
Unique strengthCatches logic flaws, unclear naming, misuseCatches runtime errors, regressions
LimitationCan't simulate executionOnly checks what it's told to test

Code review versus testing is not an either/or. Each catches issues the other might miss.

Code reviews help identify issues that aren't detectable by tests—such as unnecessary complexity, misleading naming, or violations of architectural patterns. They also foster knowledge sharing, enforce team conventions, and keep the codebase maintainable.

Automated tests, meanwhile, validate behavior under actual execution. They protect against regressions and bugs in edge cases that might escape human eyes. Together, they create a robust defense system: code review surfaces structural and logical problems, while testing verifies behavior.

Imagine a new feature that passes all tests but contains hard-to-read logic and violates naming conventions. It works—but it's technical debt. A reviewer would flag that. On the flip side, a feature that "looks fine" to a reviewer could still crash in a specific condition—something a test could catch.

Developers typically write and run unit tests before submitting code for review. Code review follows to validate the implementation and confirm that appropriate tests were written. Once reviewed and merged, the broader QA process—including regression and integration testing—kicks in.

So yes: code review usually comes before final testing, but after initial developer-run tests. It acts as a quality gate between development and formal QA.

This balance varies by team. Some require tests to pass before code is even eligible for review. Others allow simultaneous test writing and review. The important part: both steps should be present and complement each other.

Modern tooling elevates both review and testing:

  • Code review tools: GitHub, GitLab, Bitbucket, and Graphite offer collaborative review workflows. Graphite's AI reviewer Diamond gives instant feedback, flagging logic errors and style issues before a human even looks at the code. This saves reviewers time and improves quality from the start.
  • Testing tools: Use unit and integration test frameworks (e.g. PyTest, JUnit, Mocha) and CI pipelines (e.g. GitHub Actions, GitLab CI, Jenkins) to run tests automatically. Pair with code coverage tools to highlight untested code paths.
  • Best practices:
    • Keep pull requests small and focused
    • Require tests for new features and bug fixes
    • Include test coverage in review checklists
    • Use linters and formatters for consistent style

When used well, tools like Graphite and robust CI systems amplify your team's ability to ship quality code faster.

AttributeCode reviewAutomated testing
PurposeCatch logic flaws, enforce standardsVerify behavior and catch regressions
TypeHuman inspection (static)Executable checks (dynamic)
ToolsGraphite, GitHub, GitLabJest, JUnit, Cypress, GitHub Actions
When usedAfter development, before mergeDuring and after development
Performed byDevelopers, assisted by toolsCI systems, triggered automatically
ComplementsImproves test qualityFrees reviewers to focus on structure
LimitationsDoesn't catch runtime bugsOnly finds issues with test coverage

To build and maintain high-quality software, you need both code review and automated testing. Code reviews catch structural, logical, and stylistic issues; automated tests confirm your code works as expected in real scenarios. Each addresses different types of risk and quality assurance.

Asking about one or the other misses the point—they're not substitutes. They're partners. When both are embedded into your development workflow, supported by tools like Graphite for reviews and automated test runners in CI, your team can move fast and confidently. By leveraging both practices, you'll write code that's not just functional—but clear, correct, and maintainable.

Built for the world's fastest engineering teams, now available for everyone