This article exposes how unit test coverage metrics mislead management by counting executed code without verifying correctness, demonstrates with examples how tests lacking assertions create false confidence, explains Goodhart's Law in testing, warns that AI-generated tests amplify the problem by boosting coverage without ensuring quality, and advocates mutation testing and TDD to ensure tests actually catch bugs.
This tutorial demonstrates how to integrate Spring with MyBatis and JUnit using only annotations, covering Maven dependencies, Druid data source configuration, MyBatis SqlSessionFactory setup, mapper scanning, dynamic SQL with @SelectProvider, service layer wiring, and JUnit test execution with Spring's test context framework.
Thorsten Ball predicts AI will render code review, unit tests, and terminals obsolete, shift engineer value from coding to problem-solving, make tokens the new compute paradigm, dissolve traditional PM-designer-engineer triads, and challenge the very definition of 'good code' — though the transition will take a generation.
This tutorial demonstrates how to use the Easy Random library to automatically generate realistic test data for Java objects, covering basic usage, configuration parameters, field-level customization, and custom randomizers for domain-specific values.
The article demonstrates refactoring a tangled checkout method by separating pure calculation logic into a functional core using Java 17 records and sealed interfaces, leaving IO operations in an imperative shell, resulting in easily testable, reusable code without mocks or Spring containers.
This article explores how Spring Cloud OpenFeign enables elegant inter‑service calls by replacing low‑level HttpClient code with declarative interfaces, detailing the scanning and registration process, dynamic proxy creation, contract parsing, encoder/decoder mechanics, load‑balancer integration, practical examples, common pitfalls, unit‑testing strategies, and interview‑style self‑assessment.
A feature passing does not guarantee it is bug‑free; effective software testing requires a planned approach that covers unit, integration, system, and acceptance levels, using techniques such as equivalence partitioning, boundary analysis, decision tables, and both static and dynamic methods.
This guide demonstrates how to set up a Spring Boot 3.x project with MyBatis‑Plus, configure Maven dependencies, H2 database, and JPA, then write comprehensive JUnit 5 tests covering CRUD, LambdaQueryWrapper queries, pagination, logical deletion, and automatic timestamp filling, with step‑by‑step commands to run the tests.
This article explains the difference between traditional object creation and Spring's IoC container, clarifies how IOC and DI relate, compares three injection methods, debunks common misconceptions, and shows how to swap implementations seamlessly, all with concrete Java code examples.
The article argues that in real Spring Boot projects the biggest bottleneck is not writing business code but lacking reliable tests, and recommends using the Cursor AI tool to generate comprehensive unit tests first, providing a safer, more valuable entry point for AI assistance.
This guide walks through a full MyBatis unit‑testing suite built on Spring Boot 3.x and JDK 17+, showing how to configure Maven dependencies, set up an H2 datasource, write POJOs, define mapper interfaces and XML, and verify features such as mapper proxies, parameter binding, dynamic SQL, resultMap mapping, camel‑case conversion and first‑level caching with JUnit 5.
This article explains unit testing fundamentals, compares unit and integration tests, introduces Mockito's core annotations and APIs, walks through a full order‑resend example with detailed test cases, and covers best‑practice methodologies, advanced techniques, common pitfalls, naming conventions, and how to run the tests.
This guide walks through comprehensive unit tests for Spring Boot 3.x / Spring Framework 6.x event‑driven features—covering @EventListener, ApplicationListener, @Order, @Async, TransactionalEventListener, exception propagation, multiple event publishing, POJO events, and a comparison of three asynchronous handling approaches—using JDK 17+, JUnit 5, and Spring Boot Test.
This guide walks through setting up a Spring Boot 3.x project with JDK 17+, adding the necessary Maven dependencies, and implementing a comprehensive JUnit 5 test suite that demonstrates @Cacheable, @CachePut, @CacheEvict (single‑key and all‑entries), SpEL‑based keys, condition/unless caching, and the AOP proxy pitfall of same‑class calls, plus instructions for running the tests via Maven or IntelliJ IDEA.
The article explains that Chinese programmers rarely write unit tests because tight schedules, low managerial emphasis, high workload, legacy code complexity, and a culture that values rapid feature delivery over testing, leading to systemic resistance despite occasional recent shifts toward coverage mandates.
Chinese Tech Industrysoftware culturesoftware development
This article walks through a real‑world project where Claude Code is used to initialize a CLAUDE.md contract, integrate a Milvus database SDK, generate table schemas, clear AI context, manage Git worktrees, and automate unit testing and bug fixing, demonstrating significant efficiency gains.
This article presents ten practical AI prompt templates that help programmers efficiently handle requirement clarification, unit test generation, code explanation, refactoring, exception troubleshooting, performance tuning, SQL creation, knowledge documentation, design review, and cross‑language translation, each illustrated with concrete examples and usage tips.
The article explains that while test coverage helps spot untested code, 100% statement or branch coverage still leaves many scenarios unchecked, discusses statement, branch, and path coverage with concrete Go examples, and offers pragmatic advice on using coverage as a signal rather than a definitive quality metric.
This guide compiles the 30 most effective prompt templates for Alibaba's Tongyi Lingma code‑assistant, explains its three interaction modes, and offers concrete examples—from code generation and unit‑test creation to multi‑file refactoring—plus five universal tips to double output quality.
This guide explains why isolation is crucial for Python unit tests, clarifies the difference between mocks and stubs, introduces core unittest.mock objects, provides five practical scenarios with full code, shares advanced tips, warns about common pitfalls, and offers actionable steps to write robust, dependency‑free tests.
This article outlines a comprehensive testing strategy for the movie-web application, covering unit tests for utility functions and state management, component tests with React Testing Library, integration tests using MSW, and a proposed end‑to‑end workflow with Cypress or Playwright, plus CI/CD automation and coverage goals.
This comprehensive tutorial explains JUnit's definition, core components, annotations, assertion methods, test suite creation, custom test rules, and how common design patterns such as Factory, Decorator, Strategy, and Template Method can be applied to write flexible, maintainable Java unit tests, plus installation steps and advanced usage tips.
JUnit 5 introduces a modular architecture with Platform, Jupiter, and Vintage, adds a fresh annotation model, dynamic and parameterized tests, tagging, exception assertions, and nested tests, and offers clear advantages over JUnit 4, as demonstrated through a complete Calculator example and Maven execution.
This article walks through a real‑world Go project, showing why adding unit tests to core modules prevents regressions, how to mock tightly‑coupled dependencies, and provides complete example test code and best‑practice tips for reliable backend development.
This article walks through adjusting Java unit tests with ChatGPT, measuring coverage using JaCoCo, rewriting test code for User and PasswordRecovery classes, adding Mockito and PowerMock mocks, and showing how the changes raise coverage from 73.7% to over 80% across the project.
This article presents a step‑by‑step methodology for converting vague requirements into concrete Go test cases using the Testify framework, covering requirement analysis, a five‑step design process, core components, complex scenarios, maintainability techniques, and coverage evaluation.
This article outlines a comprehensive testing matrix that maps common test types—unit, API, UI, security, performance, smoke, and regression—to their problem domains, SDLC stages, and execution methods, helping teams select and prioritize tests based on risk, feedback speed, and ownership.
This article explores proven strategies for reducing technical debt, showing how short‑term debt repayment can accelerate developer productivity, deliver business value, and improve team morale through concrete examples from Atalasoft and Trello.
Long functions exceeding about 20 lines often hide multiple responsibilities, increase cognitive load, impede testing, and introduce hidden side effects; this article explains the problems, illustrates them with real JavaScript examples, and demonstrates a functional‑programming‑inspired refactor that splits logic into small, pure, testable functions.
This tutorial introduces Java Diff Utils, a lightweight open-source library for computing text differences, showing how to set it up in a Spring Boot project, compare string lists, generate unified diffs, apply patches, and create side-by-side visualizations for robust version-control and change-tracking in Java applications.
This guide explains why unit testing is essential, compares manual and automated testing, outlines the components of JavaScript test frameworks, and provides a step‑by‑step process for selecting the most suitable framework based on project needs and team capabilities.
Go’s built‑in concurrency primitives make parallel programming easy, but testing such code is tricky; this article explains the experimental testing/synctest package introduced in Go 1.24/1.25, shows how to rewrite flaky, slow tests into fast, reliable ones, and demonstrates its use with real‑world examples.
This tutorial walks through using the Lingma AI assistant to automatically create, configure, and run a full Java Maven e‑commerce order project—including environment setup, SQLite persistence, CRUD services, unit tests, and architecture visualization—showing each prompt, command, and generated code snippet.
This guide explains how GoMonkey lets Go developers replace built‑in functions, external library calls, and struct methods at runtime, enabling stable, isolated unit tests without modifying production code.
Automated testing is essential but challenging for legacy systems; this guide explains testing types, prioritizes unit and integration tests, classifies code for targeted testing, demonstrates refactoring techniques with Java examples, and applies SOLID principles to improve testability and maintainability of aging codebases.
Go’s built‑in testing framework makes writing and running unit and integration tests straightforward, offering clear conventions, command‑line tools, and examples that help developers isolate bugs, ensure code correctness, and safely refactor while covering scenarios from simple functions to full‑stack workflows.
This article explains why unit testing is essential for code quality, API design, and documentation, then walks through Go's built‑in testing conventions, common *testing.T methods, table‑driven test patterns, mocking with gomonkey, and best practices for writing maintainable tests.
Learn how to install and use the Hypothesis library for Python to perform property‑based testing, automatically generating diverse inputs, covering edge cases, and enhancing test coverage with examples on arithmetic properties, list sorting, custom strategies, settings, and real‑world scenarios like JSON and URL validation.
This article explains why using Thread.sleep() in Java ExecutorService unit tests is unreliable and inefficient, and introduces three robust alternatives—Future.get(), CountDownLatch, and shutdown/awaitTermination—to achieve stable and performant testing of asynchronous code.
This guide presents nine practical Python debugging methods—including try‑except blocks, print statements, the pdb debugger, assertions, stack trace analysis, linting tools, IDE breakpoints, logging, and unit testing—to help developers quickly identify and resolve errors in their code.
This article outlines seven practical unit‑test naming patterns, explains their structure with real‑world code examples, compares their advantages and drawbacks, and offers guidance on selecting the most suitable convention for different project sizes and team workflows.
The article explains that overusing static methods in PHP violates core OOP principles, hampers testability, creates global state, and reduces extensibility, while outlining appropriate scenarios for static usage and recommending alternatives such as dependency injection, service containers, and cautious singleton patterns.
This guide walks you through setting up a FastAPI testing environment, creating a project structure, writing both unit and integration tests using pytest, httpx, and FastAPI's TestClient, and running the tests to ensure reliable, maintainable applications.
This article explains why unit testing and debugging are essential in Python development, introduces the unittest and pytest frameworks, shows how to measure test coverage, demonstrates debugging methods like print statements, pdb, and IDE tools, and provides examples of integrating tests into CI pipelines.
This article explains why mocking is essential for reliable unit testing, outlines its core benefits such as environment isolation, speed, and coverage, and provides practical Go examples—including dynamic behavior control, state verification, and using gomock—to help engineers implement robust mock strategies.
This article explains how to use Go's httptest package and the gock library to mock HTTP servers and external API calls, providing step‑by‑step code examples, test case design, and practical tips for reliable backend unit testing.
This article examines nine frequent errors developers make when writing Go unit tests—such as improper test classification, neglecting the race detector, ignoring parallel and shuffle flags, avoiding table‑driven tests, using sleep, mishandling time APIs, overlooking httptest/iotest, misusing benchmarks, and skipping fuzz testing—providing analysis and concrete code‑based solutions to improve test reliability and efficiency.
This article explains why clean code is essential for team development and provides practical guidelines on naming, class design, function composition, and testing—including SOLID principles, meaningful identifiers, single‑responsibility classes, short functions, and test‑driven development—to improve readability, extensibility, and overall software quality.
The article critiques the practice of enforcing unit‑test coverage as a strict quality gate, explains why both overall and incremental coverage thresholds can be gamed, and proposes showing incremental coverage in merge requests while improving overall coverage through broader engineering processes.
This guide explains how Python's built‑in doctest module lets you write test cases inside docstrings, run them from the command line or programmatically, handle common pitfalls like whitespace and floating‑point issues, and integrate doctests into larger projects for reliable documentation‑driven testing.
This comprehensive technical guide explores how to leverage AI-powered coding assistants like Cursor to efficiently generate high-quality unit tests for modern frontend applications, detailing essential frameworks, structural patterns, and practical optimization techniques.
The article details a step‑by‑step workflow that uses two carefully crafted prompts with Cursor to automatically locate source files in a large monorepo, record tasks, iteratively generate Vitest unit tests, track progress, and handle failures, turning a 11 k‑line codebase into a semi‑automated test suite.
The article explains why unit tests shorten the development‑validation cycle, introduce the concept of atomic correctness to reduce debugging scope, and shows practical ways—especially with AI assistance and tools like Vitest—to eliminate the cold‑start friction of writing tests.
This guide explains how to install pytest, create a module with a function that calls an external API, and use unittest.mock fixtures and helper functions to mock requests.get for both successful and failing responses, then run the tests with pytest.
This article summarizes ByteDance’s quality‑efficiency expert Zhao Liang’s QCon presentation on using large language models to automatically generate unit tests, covering pain points, goals, data‑quality engineering, model‑analysis fusion, architecture, evaluation metrics, and future plans for a production‑grade testing tool.
This article explains how Go's testing/synctest experiment speeds up cache expiration tests by using a virtual clock and bubble isolation, providing code examples that reduce a five‑second wait to milliseconds while ensuring reliable concurrent test execution.
This article presents a detailed, step‑by‑step guide on improving unit test coverage in large Java codebases, covering strategies such as mocking, divide‑and‑conquer, tool‑assisted test generation, reflection‑based coverage, Maven configuration, and practical tips for handling static methods, final classes, and test data replay.
This tutorial demonstrates how to use pytest together with Python's unittest.mock module to mock external HTTP requests, covering fixture creation, mock response setup, and writing test cases for both successful and failed API calls.
This article explains the concept and importance of software testing, outlines various test types, and provides a step‑by‑step guide with code examples on installing PHPUnit, creating a Calculator class, writing unit tests, and running them to ensure reliable PHP applications.
This article defines legacy code, categorizes its types, outlines practical handling strategies—including rewriting, refactoring, and targeted unit testing—examines common unit‑testing mistakes, introduces a cost‑benefit quadrant model, and shows how the Tongyi Lingma tool can assist each step.
This article explains the definitions, goals, and real‑world applications of unit testing, integration testing, and system testing, illustrating each type with clear Python code examples that demonstrate how to verify functionality, interfaces, and overall system behavior in software projects.
This guide explains what unit testing is, its benefits, the AIR principles of good tests, step‑by‑step Java test creation with JUnit and Mockito, and how the AI tool Tongyi Lingma can quickly generate reliable unit tests.
This article introduces the core assertion methods in pytest, covering basic assertions, multiple assertions, exception handling, specific exception messages, list and dictionary checks, floating‑point approximations, string and tuple validation, subset verification, and log capture, each illustrated with clear Python code examples.
This article explains pytest fixtures, covering their basic concept, definition, scope options (function, module, class, session), dependencies, parameterization, use of yield for cleanup, common usage scenarios such as data preparation, database connections, and mock objects, as well as custom markers and global registration.
This article provides a comprehensive, step‑by‑step guide to using pytest for Python unit testing, covering its simplicity, advanced assertions, parameterized tests, automatic discovery, plugin ecosystem, custom fixtures, command‑line options, exception handling, parallel execution, and detailed error reporting.
A developer recounts how a newly written SpringBoot unit test unintentionally deleted all data in the test database, explores the root causes—including H2 configuration, automatic SQL script execution, and permission issues—and shares concrete steps to prevent similar disasters.
This article introduces pytest, a popular Python testing framework, outlining its key features, installation steps, how to write and run basic, parameterized, and parallel tests, generate HTML reports, and integrate with CI/CD pipelines, providing code examples throughout.
This guide introduces the pytest‑assume plugin, showing how to install it, write assumption‑based tests with code examples, handle failures, apply advanced features like decorators, combine with regular asserts, perform conditional checks, and customize error messages for more flexible Python testing.
This tutorial introduces core Python concepts—including dictionaries, sets, file and directory handling, regular expressions, logging, unit testing, performance profiling, and common third‑party libraries—providing clear explanations and ready‑to‑run code examples for each topic.
This article explains how comprehensive testing—from early shift‑left practices and lifecycle coverage to automated unit, integration, and end‑to‑end tests—ensures software quality, reduces costs, and supports rapid development, illustrated with real‑world case studies and practical design techniques.
The article demonstrates how PowerMock can be used to unit‑test a Java FileParser class—showing basic mocks for files and streams, advanced techniques for final and static classes, and achieving full coverage—while warning that its heavy class‑loader overhead can dramatically slow large test suites and increase memory consumption.
This article explains why upgrading JDK 11 prompts the removal of the unmaintained PowerMock framework, outlines the steps to replace it with Mockito‑Only—including JUnit runner configuration, handling static, private, and final methods, multithreaded mock limitations, and performance gains—while providing code examples and migration tips.
This article explains the concepts of Test‑Driven Development (TDD), Unit Test‑Driven Development (UTDD), Acceptance Test‑Driven Development (ATDD) and Behavior‑Driven Development (BDD), discusses why TDD is not dead, compares the three approaches, and provides a step‑by‑step Java implementation with code samples, testing workflow, and refactoring guidance.
This guide presents ten practical strategies—including IDE selection, static analysis tools, unit testing, code reviews, and learning from others' post‑mortems—to help developers dramatically reduce bugs, improve code quality, and increase overall productivity.
This article provides a detailed tutorial on Python's Pytest framework, covering installation, test discovery rules, execution methods, setup/teardown, fixture usage, assertions, skip mechanisms, custom marks, and parameterization with extensive code examples for practical automation testing.
This article outlines seven practical reasons why unit testing is crucial for developers, highlighting how automated tests provide fast feedback, improve code robustness, guide design, boost confidence, act as problem detectors, serve as reliable documentation, and accelerate learning of new APIs.
This guide explains why clean code matters, outlines practical naming conventions, class design principles, function structuring rules, and testing strategies—including TDD, the FIRST criteria, and automated test generation—to help developers write maintainable, readable, and high‑quality software.
This article explains how to use Go's httptest package and the gock library to mock HTTP servers and external API calls, providing step‑by‑step code examples, test case structures, and installation instructions for effective backend unit testing.
This article explains the differences and appropriate use cases of Mock, Dummy, Spy, Stub, and Fake test doubles in PHP unit testing, providing clear code examples to help developers write effective and maintainable tests.
In 2024 Meta introduced TestGen‑LLM, an AI‑powered tool that automatically generates Kotlin unit tests using large language models, improving test coverage through a multi‑stage pipeline of candidate generation, compilation filtering, execution filtering, coverage validation, refactoring, and engineer review, with reported coverage gains across Facebook and Instagram codebases.
This article introduces the Trie (prefix tree) data structure, explains its basic architecture, demonstrates insertion, search, and deletion operations with complete Go implementations, and provides practical unit tests and real‑world applications such as autocomplete, spell checking, and IP routing.
This guide introduces the Python requests‑mock library, explains how to install it, and provides ten detailed code examples demonstrating how to mock GET, POST, status codes, regex URLs, multiple responses, JSON payloads, HEAD requests, exceptions, query parameters, and redirects for reliable unit testing.
This article demonstrates how to apply Monkey Patching in Go using the gomonkey library to unit‑test a simple HTTP service, covering code examples, dependency analysis, patch creation, test execution parameters, and practical considerations such as inlining and concurrency limitations.
This article explains how to resolve external file dependencies in Go unit tests by creating temporary files with os.CreateTemp, initializing global variables, and leveraging the embed package to embed changelog files as []byte or a file system, providing complete code examples and test results.
This article explains why clean code is essential for productivity and project health, and provides practical guidance on naming, class design, function design, and testing—including SOLID principles, parameter handling, exception use, and test‑driven development—to help developers write maintainable, high‑quality software.
This article presents a concise, beginner-friendly approach to building a Spring Boot unit testing environment using only essential Maven dependencies and test classes, covering both integration-style and pure unit test techniques, complete with annotated examples and practical testing tips.
This article explains how to write Go unit tests for HTTP handlers that depend on MySQL by using fake implementations and the gomock library to replace the store layer, demonstrating both fake object and mock approaches, code examples, and best practices for isolating external dependencies.
To cut bugs and boost productivity, developers should use a robust IDE, integrate static analysis tools like FindBugs and CheckStyle, run SonarQube and Fortify for quality and security checks, write unit and functional tests, automate regression suites, and regularly conduct peer code reviews.
This article presents ten practical techniques—including choosing the right IDE, integrating static analysis tools like FindBugs and CheckStyle, using SonarQube and Fortify, writing unit and automated tests, performing incremental code reviews, and learning from others' pitfalls—to help developers dramatically reduce bugs and improve code quality.
This guide explains why an in‑memory SQLite database is ideal for PHP unit testing, outlines its key benefits such as isolation, speed, and resource efficiency, and provides step‑by‑step code examples for setup, data handling, cleanup, exception handling, schema verification, data providers, and transaction testing.
The article introduces the assertpy library for Python, explains its purpose of enhancing assertions, and provides a comprehensive set of example code snippets demonstrating how to validate strings, collections, numbers, booleans, files, and more using readable assertpy methods.
This article outlines how establishing clear review standards, leveraging object‑oriented principles and SOLID design rules, applying common design patterns, and requiring unit tests can transform code reviews from a perfunctory task into an effective quality‑boosting, knowledge‑sharing practice for development teams.
This article explains why unit testing is often seen as burdensome, then provides practical Go techniques—using pure functions, extracting dependencies, object‑oriented design, function variableization, and avoiding init—to write business code that is easy to test and maintain.
After fifteen years of software development, the author learns that writing good code demands rapid trial‑and‑error, modular design, SOLID principles, early unit testing, and controlled complexity, while avoiding perfectionism, embracing stakeholder communication, and focusing on high‑ROI learning to create reusable, maintainable tools.
This article explains the core concepts of the Mockito framework, compares it with other Java unit‑testing tools, demonstrates practical code examples, and breaks down the internal workings of annotations like @InjectMocks, @Mock, @RunWith, as well as the Mockito.when() and Mockito.verify() mechanisms.
This guide walks through integrating Spring Data Elasticsearch into a Spring Boot application, covering entity mapping annotations, repository creation, service layer implementation, and unit tests to perform create, read, update, delete, and fuzzy search operations on Elasticsearch indices.
The guide shows that by consciously designing Go data structures and function interfaces—using pure functions, parameter injection, interface abstractions, struct‑based objects, or function‑variable patterns—and avoiding init(), developers can expose and control all dependencies, making business code inherently testable and achieving high unit‑test coverage.
This guide introduces PHPUnit for PHP, explains how to install and configure it with Composer, and demonstrates common assertions such as assertEquals, assertNotEmpty, assertFalse, assertIsNumeric, and assertSame through practical real-world code examples.
This guide introduces front‑end unit testing with Jest, explaining TDD and BDD concepts, installation, writing simple and ES6/TypeScript tests, configuring coverage, using common matchers, and employing mock functions, timers, and module mocking to ensure reliable, maintainable code.