This article presents a white‑box, unit‑test‑driven approach for automatically generating C/C++ test cases that detect and recall runtime stability issues, detailing problem analysis, solution design, code‑analysis, test‑data generation, code generation, failure analysis, and deployment results across large‑scale backend modules.
This article explains unit testing concepts, introduces TestNG and PowerMock frameworks for Spring Boot, details common annotations, provides Maven dependency snippets and comprehensive Java test examples, and demonstrates advanced mocking techniques, parameterized tests, and assertion strategies to improve code reliability and coverage.
The article explains why mocking external components you don’t control can introduce maintenance problems, such as hidden bugs and upgrade difficulties, and suggests using real implementations, library‑provided fakes, or wrapper classes instead, while offering code examples and practical guidance.
Overusing mocks in unit tests can make test code harder to understand, harder to maintain, and give a false sense of correctness, so developers should recognize signs of excessive mocking and consider alternatives such as hermetic servers or fake objects.
The article explains how UI component tests should interact with real page elements instead of directly invoking handlers, using the “Front Door First” principle to achieve more comprehensive and reliable automated UI testing, illustrated with examples of a disabled Buy button and proper test code.
This comprehensive guide walks Java developers through setting up PowerMock and Mockito, demonstrates creating and spying on mocks, stubbing methods, using parameter matchers, verifying interactions—including static and private members—and explains essential annotations and best‑practice principles for robust, maintainable unit tests.
This article introduces Test‑Driven Development (TDD), walks through a complete FizzBuzz kata using Jest, explains the Red/Green/Refactor cycle, showcases common TDD patterns, and discusses challenges and best practices for writing clean, well‑tested code.
This tutorial walks you through upgrading Spring Boot, introduces MongoDB basics, and provides a hands‑by‑step guide to adding the spring‑boot‑starter‑data‑mongodb dependency, defining entity and repository classes, writing unit tests, and configuring connection properties for robust backend data management.
This guide surveys modern frontend unit‑testing solutions, comparing Node’s assert, Chai, Mocha, Jasmine, and Jest, explaining module formats, environment setups for Node, JSDOM, and real browsers, and detailing React testing with Jest + Enzyme’s shallow, mount, and render methods.
This article explains the fundamentals of unit testing in Spring Boot, covering the purpose of unit tests, how to add the spring-boot-starter-test dependency, the role of MockMvc for controller testing, step‑by‑step creation of Service and Controller test classes, key annotations, assertion techniques, and a brief comparison with Postman.
This guide demonstrates how to use TestNG for exception validation, method dependencies, XML and DataProvider parameterization, multithreaded execution via annotations and XML suites, and timeout enforcement, providing complete Java code examples for each feature.
This article explains the long‑term benefits of unit testing such as saving time and money, reducing code complexity, providing documentation, and enabling performance evaluation, and then provides a detailed guide on writing, organizing, and running Go tests with code examples.
This article explains why unit testing is essential, introduces VSCode plugins and Jest configurations that speed up test execution, outlines common testing pitfalls, and details practical test‑case design methods such as equivalence partitioning, boundary‑value analysis, and error‑guessing, while also covering stubs, mocks, and CI integration.
This article introduces mock testing for Spring MVC controllers, explains why mocks are useful, describes the main MockMvc components, shows required Maven dependencies, and provides complete example test cases for both view‑returning and JSON‑returning endpoints using JUnit and MockMvc.
This guide shows backend developers how to write unit tests for file‑upload endpoints in Spring Boot using MockMvc, including a complete example with MockMultipartFile and emphasizing test‑driven design for better code quality.
Gaode’s navigation service adopted test‑driven development using Google’s GTest to replace slow diff‑based checks with fast, lightweight unit tests, enabling incremental refactoring of legacy code, improving quality, handling data‑dependency challenges, and demonstrating that writing tests first clarifies requirements while adding minimal overhead.
This article presents a comprehensive approach to automatically generate unit tests for C/C++ backend services, leveraging static code analysis, white‑box techniques, and fuzzing to create high‑coverage test cases that proactively detect stability issues without manual effort.
This article introduces Python’s built‑in unittest framework, explains its core concepts such as test cases, fixtures, suites and runners, demonstrates common assertion methods, and provides a step‑by‑step Selenium example for testing a webmail login flow.
TestableMock is a Java unit‑testing helper that lets developers access private fields and methods, quickly mock any method call, and effectively test void methods by providing annotations and utility classes, with detailed code examples and usage guidelines for both Java and Kotlin projects.
This article explains the concept of mock testing, its role in unit and interface testing, and reviews popular mocking tools such as EasyMock, JMockit, Mockito, RAP, YApi, Moco, and DOClever, highlighting their applications in software development.
This article explains the concept of mock testing, its use in unit and API testing, illustrates real‑world analogies, compares popular mocking frameworks, and introduces several API‑mocking tools such as RAP, YApi, Moco, and DOClever for modern software development.
The article explains the different types of test doubles—Dumb, Fake, Stub, and Mock—provides guidelines on when to prefer real implementations, discusses the drawbacks of overusing Stubs and Mocks, and offers practical advice for writing and maintaining Fakes in software testing.
TestableMock is a lightweight Java mock testing tool that eliminates initialization and framework dependencies, allowing any method—including private, static, or constructor—to be replaced with a single @MockMethod annotation, dramatically simplifying unit test development.
Learn how to use the Python Hypothesis library for property‑based testing, understand different test levels and methods, and see practical examples—including unit tests for increment/decrement functions and handling edge cases with custom examples—to write more robust, automated tests.
This guide shows how Go simplifies unit testing, benchmarking, CPU profiling with pprof, and live debugging using dlv, providing step‑by‑step code examples, command‑line usage, and visual analysis techniques for backend developers.
Learn the core principles for writing effective unit tests—such as focusing on single functions, ensuring independence, and using descriptive names—alongside a concise overview of popular Python testing tools like unittest, pytest, nose, doctest, tox, and mock, to boost code reliability.
This guide explains how to restructure a Maven project to isolate unit and integration tests, configure Maven Surefire, Failsafe, Build‑Helper, and JaCoCo plugins for separate execution and combined coverage reports, and finally display the results in SonarQube.
Unit testing ensures code quality and early bug detection, yet testing OAuth2 systems in Spring presents challenges like dependency on UPMS, lack of standard implementations, and complex token handling; this guide explains why testing is essential and provides a solution using @WithMockUser, custom context factories, and sample code.
This article outlines ten practical code‑review guidelines—from logging standards and IDE warnings to unit testing, branch policies, hidden requirements, exception handling, and SQL performance—helping developers write clean, maintainable, and production‑ready code.
This guide walks through the fundamentals of Spring Boot, explaining its purpose, showing how to create a project with Spring Initializr, writing a Hello World REST controller, understanding starter dependencies, configuring properties, exploring the main application class annotations, and adding a simple unit test.
This article recounts an eight‑year journey from a C++ internship to senior roles at Alibaba and Ant Group, highlighting how mastering Node.js, embracing code review, unit testing, open‑source contribution, and continuous sharing can accelerate a software engineer's career.
This article explains why Bash scripts need unit testing, outlines common testing challenges, defines what constitutes a Bash unit test, and demonstrates how to write safe, fast, and cross‑platform tests using the Bach Testing Framework with practical code examples.
This article extends the previous JsonPath utility guide by demonstrating how to write comprehensive Groovy‑based Spock unit tests, covering Maven/Gradle setup, basic and data‑driven demos, detailed test cases for JSON path extraction, array operations, statistical functions, and a deliberately introduced bug with its console output.
This article explains why Bash scripts need unit testing, outlines common testing challenges, and demonstrates how the Bach Testing Framework provides safe, fast, and environment‑agnostic unit tests for Bash scripts by mocking external commands and isolating execution logic.
This article explains how unit testing goes beyond coverage metrics, showing that writing testable code improves design, performance, and robustness, and provides practical guidance on refactoring, mock usage, data‑driven tests, TDD, BDD, and agile development practices.
The article argues that code should primarily be written for human readers, emphasizing principles like KISS and DRY, thoughtful commenting, avoiding TODOs, and the necessity of unit tests, while acknowledging trade‑offs and offering practical guidance for producing maintainable, elegant software.
This article explores the core principles of frontend testing, comparing Test-Driven Development and Behavior-Driven Development methodologies while providing a step-by-step tutorial on configuring the Jest framework and utilizing its essential matchers to write robust, maintainable unit tests for modern web applications.
This article explains how to use Mockito's doNothing, doAnswer, doThrow, and doCallRealMethod to mock void methods in Java, demonstrating parameter verification, argument capture, and real‑method invocation with detailed code examples and reasoning behind each approach.
This article explores why clean, readable code matters, explains key principles such as KISS and DRY, discusses the role of comments, unit tests, and avoiding TODOs, and offers practical advice for developers to improve code quality and long‑term maintainability.
The article explains why having constructors perform excessive work is a design flaw, describes how to spot this problem through code symptoms, discusses its impact on testability and maintainability, and provides concrete refactoring strategies such as dependency injection, factories, and builder patterns.
The author shares a first‑hand account of a newly launched backend project, explaining how strict coding standards, Groovy‑Java mixed development, and a pragmatic testing strategy—including limited unit testing, interface checks, and annotation‑based validation—enabled rapid bug resolution and a smooth release.
The article explains how to set up Jest for front‑end unit testing, demonstrates basic test writing, async handling, hooks, snapshot and React component testing, shows coverage configuration and thresholds, compares Jest’s built‑in features to Mocha’s limitations, and offers tips on concurrency, mocking, and test‑driven development.
The article explains that stable tests should verify only the parameters that affect the behavior under test, use matchers to ignore irrelevant data, and apply contract testing or realistic fakes for microservice calls instead of over‑relying on mocks, thereby improving readability and resilience.
The article explains why test method names should describe the behavior being verified rather than the implementation, shows how clear naming reduces the need to read test code, and discusses the importance of testing public APIs instead of internal implementation details.
This guide explains why unit testing matters, compares Java testing tools, introduces PowerMock’s capabilities, details essential annotations, shows how to configure dependencies, and provides step‑by‑step code examples for mocking public, final, static, private, constructor, field and superclass methods.
This article explains why flaky tests harm development, demonstrates how shared resources cause instability, and provides practical guidelines—such as using exclusive resources, refactoring for dependency injection, writing one‑scenario tests, and avoiding verification of non‑state‑changing calls—to create reliable, focused unit tests.
The article explains why unit tests should focus on verifying distinct behaviors rather than mirroring methods, advocating separate, focused tests that make cause‑and‑effect relationships obvious and improve code readability and maintainability.
This comprehensive article shares the author's hands‑on experience with unit testing, explains why testing drives better design and lower costs, outlines common misconceptions and obstacles, and provides detailed implementation guidelines—including architecture refactoring, dependency inversion, and a real‑world TV service example—to help developers start writing effective unit tests.
This article introduces the Groovy‑based Spock framework and the Mockito mocking library, shows how to configure them together in Gradle, and provides detailed Groovy demo code illustrating various mocking, spying, verification, and exception‑handling techniques for robust Java unit testing.
This guide shows how to replace System.in and System.out with in‑memory streams during unit testing, provides reusable helper classes for setting and restoring these streams, and includes a complete example demonstrating input simulation and output capture in Java.
This tutorial walks you through integrating MyBatis XML configuration into a Spring Boot 2.x project, covering Maven dependencies, application properties, mapper XML files, entity and mapper definitions, service implementation, and unit testing with full code examples.
This guide walks through configuring unit tests, continuous integration with Travis CI, and automated coverage reporting using Coveralls for the NUTUI Vue component library, detailing the required tools, npm scripts, webpack settings, and best‑practice benefits for reliable front‑end development.
This page aggregates a wide range of technical articles, videos, case studies, tools, and tutorials covering API testing, unit and white‑box testing, performance testing, Java, Groovy, Python, UI automation, and various testing utilities, providing a valuable resource hub for software testing professionals.
This article compares three common Java techniques—using the class literal, Class.forName, and an object's getClass method—to obtain a Class object, demonstrating their distinct effects on class loading, static initialization, and instance creation through detailed code examples and test results.
This page provides a curated collection of Chinese articles covering unit testing, white‑box testing, testing frameworks such as Spock, JUnit, Selenium, performance testing, and related technical and non‑code topics for software developers and testers.
White-box testing examines a program’s internal structure, code, and logic by creating and executing test cases that cover all paths, conditions, and statements, enhancing security, reliability, and code quality, while outlining its steps, techniques, examples, advantages, and drawbacks.
This tutorial guides you through creating a basic Spring Boot calculator app, adding JUnit 4 tests, then fully migrating the project to JUnit 5 by updating dependencies, rewriting test annotations, and leveraging new JUnit 5 features such as @ExtendWith and @DisplayName.
This guide walks through integrating MyBatis into a Spring Boot project, covering dependency setup, MySQL configuration, entity and mapper creation, CRUD annotations, and unit testing to verify database operations, including transaction management and result mapping.
This collection provides a curated set of Chinese and English resources covering unit testing frameworks like Spock, JUnit, Selenium, performance testing tools, API testing, and related non‑technical articles, offering developers comprehensive guidance for software testing practices.
This article explains the fundamentals of unit testing, covering its definition, core concepts, essential principles, practical techniques such as mocking, and its role in test automation and continuous integration within modern agile development.
This article provides a comprehensive guide to pytest, covering its advantages over unittest, installation steps, basic and class‑based test writing, execution commands, assertion handling, custom markers, fixture scopes, and useful plugins for enhancing Python testing workflows.
The article explains how to use feature flags in a three‑tier microservice architecture, describing the need for both high‑level end‑to‑end tests and low‑level unit tests within CI/CD pipelines to ensure correct behavior when flags are on or off, while avoiding excessive test combinatorial explosion.
This article recounts how a developer transformed a massive three‑thousand‑line C# data‑center monitoring client into a concise fifteen‑line solution by applying reflection, generics, and systematic refactoring, while sharing practical advice on avoiding code generators, reinventing the wheel, and using unit tests to foster clean architecture.
An experienced developer recounts how he transformed a cumbersome three‑tier C# data‑center management system from thousands of lines to a concise, maintainable codebase using reflection, generics, and thoughtful refactoring, while sharing practical advice on avoiding code generators, reducing duplication, and embracing unit testing.
This article explains why Android testing is crucial, outlines common testability problems, and provides step‑by‑step solutions using MVP architecture, interface‑based design, JUnit, Mockito, Robolectric, Espresso, and CI integration to create maintainable unit and UI tests.
Integration testing verifies that individually tested software units work together as intended, bridging the gap between unit tests and system tests, and is a critical practice for DevOps teams to ensure cohesive, reliable applications.
This article presents a complete tutorial on setting up and using Jest, Enzyme, and react‑hooks‑testing‑library for unit testing React and React Native applications, covering environment configuration, simple function tests, lifecycle hooks, mocking, snapshot testing, asynchronous tests, Redux and Hook testing, as well as coverage reporting and CI integration.
This article explores the subtle bugs that arise when using Python's with‑statement for a global process lock, explains why exceptions raised in __enter__ are not caught by __exit__, and presents three practical solutions using contextlib utilities and simple control flow.
This article explains how test‑coverage metrics such as line and branch coverage can give a false sense of quality, demonstrates common pitfalls with Java examples and Cobertura reports, and offers practical guidelines for using coverage data to improve testing and code reliability.
This article explains the purpose of unit testing, outlines best‑practice guidelines for creating and managing unit test plans, and provides a comprehensive checklist covering input validation, date and time verification, security, usability, logging, business logic, reporting, environment, email, and search functionality.
This article examines why simple, exact-value assertions often fall short in unit testing, demonstrates how to apply fuzzy matching for unpredictable fields, and offers practical alternatives to keep tests reliable and maintainable.
This article explains the fundamentals of unit testing in Java, covering what unit tests are, why they matter, when to write them, and detailed step‑by‑step examples using Mockito, PowerMock, JUnit, and Spring Boot to mock dependencies, verify behavior, and assert results across DAO, service, and controller layers.
This article introduces Python’s built‑in unittest framework, outlining its lightweight advantages, core components such as TestCase, TestSuite, TestRunner and TestLoader, and demonstrates a complete automation workflow from Excel‑based test data preparation to generating HTML test reports with HTMLTestRunnerNew.
The article explains why many developers avoid unit testing despite its importance, demonstrates a Java method for filtering unpromised tools in a home‑renovation app, provides complete JUnit and Groovy/Spock test implementations, and shows how richer output from Groovy/Spock can speed debugging.
The article explains the three-tier testing hierarchy (unit, interface, UI), the recommended test size distribution, mandatory versus optional test types, and how to implement automated unit testing within a DevOps workflow using version control, build tools, test frameworks, and feedback platforms.
This tutorial walks you through Spring Boot 2.x fundamentals, explaining core MVC annotations, defining a User entity with Lombok, creating a full RESTful CRUD controller, and writing comprehensive MockMvc unit tests to verify each endpoint.
This article explains how to define, fetch, and process unit test metrics such as failCount, skipCount, and totalCount from Jenkins build logs using the Jenkins JSON API and a Groovy Jenkinsfile script.
This article provides a comprehensive overview of Test‑Driven Development, explaining its principles, workflow, relationship to acceptance testing and traditional testing, its impact on design and documentation, challenges in database development, integration with Agile Model‑Driven Development, common myths, adoption statistics, and a curated list of supporting tools.
The article humorously explains that the true goal of unit testing is to ensure software quality while maintaining development speed, comparing ineffective testing to practicing shooting without scoring, and suggesting that without proper practice, both efforts may be futile.
Development Speedsoftware engineeringsoftware quality
Go‑Spring is a Go‑language application framework that brings Spring‑style conventions such as dependency injection, auto‑configuration, starter modules, interface‑based design, and integrated testing to developers, enabling organized code, easy component swapping, configuration binding, and full‑stack unit tests while supporting databases, messaging, and microservice features.
Writing unit-testable code often requires refactoring, and by focusing on minimizing function size, dependencies, and complexity, developers can adopt seven practical techniques—including limiting function lines, single responsibility, dependency injection, avoiding complex parameters, using abstractions, extracting testable units, and handling private functions—to improve testability and team efficiency.
This article offers a practical, experience‑based overview of unit testing, explaining why it matters, what makes a good test, when to write or skip tests, who should write them, and how to structure them effectively for reliable software quality.
By applying Mike Cohn’s testing pyramid to a Go scheduling service, the author demonstrates a structured approach that combines straightforward unit tests, organized integration suites with setup/teardown hooks and coverage scripts, expressive GoConvey assertions, and end‑to‑end trace‑ID verification, while noting remaining gaps.
This article explores four key questions about automated testing: what it is, why it matters, which projects benefit from it, and how to implement it, providing a complete frontend testing framework including unit testing, API testing, functional testing, and benchmark testing.
This article explains Youzan’s layered unit‑testing framework for microservice applications, outlines typical pain points such as massive test‑case rewrites, unstable test data, and missing result verification, and demonstrates how tools like DbUnit, H2, springockito, spring‑test and PowerMock are combined to provide data preparation, mock injection, automatic cleanup, and declarative result checks.
This article explains the Inversion of Control (IoC) pattern and its Dependency Injection implementation, showing how a simple container can decouple modules, improve modularity, speed up development, and make unit testing easier for front‑end JavaScript/TypeScript projects.
Frontend DevelopmentInversion of Controldependency-injection
Learn how to use MockMvc in Spring Boot to simulate HTTP requests, test controller logic without launching a server, and verify responses with concise code examples, covering dependency setup, controller creation, test class configuration, request execution, assertions, and common testing scenarios.
This article shares practical experiences from unit testing a 6000‑line C module, detailing static code review and dynamic gtest testing, uncovering common defects such as memory leaks, and presenting two memory‑leak case studies with root‑cause analysis and cleanup recommendations.
This guide explains the purpose of the mica-boot-test component, shows how to add its Maven or Gradle dependency, and provides two example test classes demonstrating the use of @MicaBootTest with either @RunWith(MicaSpringRunner.class) or inheritance from MicaBaseTest.
This guide explains how to set up Mocha for TypeScript unit testing, configure NYC for coverage reporting, and integrate both tools within a Lerna monorepo to maintain high branch coverage across multiple packages.
This article walks through creating a complete CI/CD workflow for a Python service using GitLab CI, Docker‑based gitlab‑runner, unit testing, static code analysis with SonarQube, service containers for Redis and MongoDB, and deployment steps, providing all necessary configuration files and commands.
The article shares practical methods for reducing bugs throughout the software development lifecycle, emphasizing early communication with product managers and testers, thorough design and code reviews, mandatory unit testing, continuous integration, and proactive log monitoring to ensure smooth testing and delivery.
This article presents seven practical techniques—including using IntelliJ IDEA, upgrading to JDK 8+, adopting Maven/Gradle, leveraging Lombok, writing unit tests, refactoring incrementally, and gathering regular customer feedback—to help developers produce shorter, clearer, and more maintainable Java code.
This article explains the concept of testing frameworks, discusses why reinventing wheels is discouraged, outlines the difficulties in selecting suitable frameworks, and provides a comprehensive list of general and mobile UI automation testing tools along with criteria for evaluating good frameworks.
This article introduces Python's built‑in unittest framework, explains core concepts such as TestCase, TestSuite, TestLoader, and TestRunner, demonstrates how to write test cases, generate HTML and XML reports with HTMLTestRunner and xmlrunner, and shows parameterized testing with nose‑parameterized for CI pipelines.
This article provides a comprehensive guide to using Jest for front‑end unit testing, covering the lack of tests, benefits, installation, basic assertions, matchers, asynchronous testing, lifecycle hooks, mock functions, module mocking, snapshot testing, and best practices to improve code quality and development efficiency.
This article reviews language‑agnostic software testing antipatterns, explains the test pyramid, defines unit and integration testing, lists frequent testing mistakes, and demonstrates why a balanced mix of unit and integration tests is essential for reliable, fast, and maintainable software development.
This article explains how the PouchContainer project automates code‑style enforcement and comprehensive Golang unit testing using tools like golint, gometalinter, shellcheck, markdownlint, table‑driven tests, and mock implementations, integrating them into CI pipelines to ensure reliable releases.
This article examines language‑agnostic software testing antipatterns, explains the differences between unit and integration testing, lists common testing mistakes, and demonstrates why a balanced test pyramid—combining both fast, maintainable unit tests and slower, broader integration tests—is essential for reliable software development.