Tag

Mocking

0 views collected around this technical thread.

Test Development Learning Exchange
Test Development Learning Exchange
Jan 3, 2025 · Backend Development

How to Mock External Services in pytest Using unittest.mock

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.

MockingPythonbackend
0 likes · 9 min read
How to Mock External Services in pytest Using unittest.mock
Test Development Learning Exchange
Test Development Learning Exchange
Nov 26, 2024 · Fundamentals

How to Encapsulate and Call Mock Services in pytest

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.

API mockingMockingPython
0 likes · 9 min read
How to Encapsulate and Call Mock Services in pytest
Java Tech Enthusiast
Java Tech Enthusiast
Aug 22, 2024 · Fundamentals

Using PowerMock for Unit Testing in Java: Basics and Advanced 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.

JavaJunitMocking
0 likes · 10 min read
Using PowerMock for Unit Testing in Java: Basics and Advanced Techniques
JD Tech Talk
JD Tech Talk
Jul 12, 2024 · Backend Development

Traffic Recording and Replay: Practices, Challenges, and Strategies for Backend Testing

This article shares practical insights on traffic recording and replay for backend testing, covering background, recording rules, scenario coverage, handling read/write interfaces, mock versus real replay, coverage metrics, and diff result comparison to improve system stability and test completeness.

MockingR2backend testing
0 likes · 11 min read
Traffic Recording and Replay: Practices, Challenges, and Strategies for Backend Testing
Ele.me Technology
Ele.me Technology
May 28, 2024 · Operations

Automated Mock for E2E Testing: Design and Implementation of Unmanned MOCK

Unmanned MOCK automatically generates intelligent, context‑aware mock responses for downstream services in end‑to‑end tests by collecting sub‑call data, extracting knowledge, and applying dynamic rules, so failures in downstream systems are isolated, raising test success rates toward near‑100 % without manual mock configuration.

Continuous IntegrationE2EMocking
0 likes · 12 min read
Automated Mock for E2E Testing: Design and Implementation of Unmanned MOCK
Go Programming World
Go Programming World
May 22, 2024 · Backend Development

Using xgo for Monkey Patching, Mocking, Tracing, and Incremental Coverage in Go

This article introduces the xgo tool for Go, explains its cross‑platform monkey‑patching capabilities, demonstrates how to write unit tests with mock.Patch, shows installation, usage of Trap, Trace, and incremental coverage features, and evaluates its advantages and drawbacks for backend development.

CoverageGoMocking
0 likes · 15 min read
Using xgo for Monkey Patching, Mocking, Tracing, and Incremental Coverage in Go
JD Retail Technology
JD Retail Technology
May 13, 2024 · Backend Development

A Minimalist Guide to Setting Up Unit Tests in Spring Boot

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.

Integration TestJavaJunit
0 likes · 9 min read
A Minimalist Guide to Setting Up Unit Tests in Spring Boot
Bilibili Tech
Bilibili Tech
May 10, 2024 · Frontend Development

Web‑Integrated Proxy Tool: Zero‑Installation, Remote Debugging and Mocking for Front‑End Development

This article presents a zero‑install, web‑integrated proxy that developers can launch via a browser link or QR code, injects an SDK to intercept network calls, offers remote debugging and UI‑driven mock rule configuration, and stores data in IndexedDB, while noting operational overhead and limited applicability.

Front-End DevelopmentMockingSDK integration
0 likes · 11 min read
Web‑Integrated Proxy Tool: Zero‑Installation, Remote Debugging and Mocking for Front‑End Development
Test Development Learning Exchange
Test Development Learning Exchange
Apr 10, 2024 · Fundamentals

Using freezegun to Mock and Freeze Time in Python Tests

freezegun is a Python library that lets developers mock and freeze the current time, enabling precise control over time‑dependent code during unit testing, with examples covering basic usage, timezone handling, complex datetime objects, and dynamic time manipulation.

DateTimeMockingfreezegun
0 likes · 3 min read
Using freezegun to Mock and Freeze Time in Python Tests
Tencent Cloud Developer
Tencent Cloud Developer
Jan 25, 2024 · Backend Development

How to Write Testable Business Code in Go: A Practical Guide

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.

Best PracticesGoMocking
0 likes · 17 min read
How to Write Testable Business Code in Go: A Practical Guide
HelloTech
HelloTech
Jan 4, 2024 · Frontend Development

Introduction to Front-End Unit Testing with Jest

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.

JavaScriptMockingTDD
0 likes · 14 min read
Introduction to Front-End Unit Testing with Jest
Rare Earth Juejin Tech Community
Rare Earth Juejin Tech Community
Nov 20, 2023 · Frontend Development

How to Mock APIs in Frontend Development Using MSW and Faker

This article explains why and how to use mock data in frontend development, compares six mainstream mock solutions, and provides a step‑by‑step guide to implementing MSW with Faker in a Vite‑based Vue 3 TypeScript project, including code examples and best‑practice recommendations.

APIFrontendMocking
0 likes · 15 min read
How to Mock APIs in Frontend Development Using MSW and Faker
DevOps
DevOps
Mar 21, 2023 · Backend Development

Effective Unit Testing Strategies for Large Legacy Systems

The article shares practical techniques for improving unit test coverage in massive, low‑quality legacy codebases, including creating isolated new modules, applying test‑driven development, decoupling through design patterns, extracting interfaces, using seams, and employing mocking to overcome static dependencies.

Mockingdependency injectionlegacy code
0 likes · 9 min read
Effective Unit Testing Strategies for Large Legacy Systems
JD Tech
JD Tech
Feb 14, 2023 · Backend Development

EasyMock Platform Overview and JSF Mock Implementation Guide

This article introduces the EasyMock platform, outlines its key capabilities for service mocking, explains the technical challenges it solves, and provides a detailed step‑by‑step walkthrough of the JSF Mock implementation—including jar acquisition, JVM class loading, dynamic proxy creation, interface registration, client invocation, and parameter matching/return logic—accompanied by code examples.

ClassLoaderDynamic ProxyJSF
0 likes · 12 min read
EasyMock Platform Overview and JSF Mock Implementation Guide
Bilibili Tech
Bilibili Tech
Jan 20, 2023 · Backend Development

API Management and Standardization at Bilibili: Design, Automation, Versioning, and Mocking

Bilibili’s unified API management platform automates documentation generation for Go and Java services, ties each API version to specific code commits, supports version snapshots, integrates with gateways for debugging and OpenAPI export, and provides service‑level mocking, thereby standardizing microservice development and reducing cross‑team overhead.

API ManagementMicroservicesMocking
0 likes · 20 min read
API Management and Standardization at Bilibili: Design, Automation, Versioning, and Mocking
JD Retail Technology
JD Retail Technology
Jan 16, 2023 · Backend Development

EasyMock Platform Overview and JSF Mock Implementation Techniques

This article introduces the EasyMock platform, explains its role in providing JSF and HTTP mock services for development and testing, outlines its architecture and capabilities, and details the step‑by‑step technical implementation of JSF Mock including jar downloading, JVM class loading, dynamic proxy creation, registration, client invocation, parameter matching, and response deserialization.

ClassLoaderDynamic ProxyJSF
0 likes · 11 min read
EasyMock Platform Overview and JSF Mock Implementation Techniques
DeWu Technology
DeWu Technology
Dec 23, 2022 · Frontend Development

Frontend Unit Testing as Documentation: Challenges and Practices

The team combats outdated documentation and costly front‑end maintenance by treating unit tests for the use‑case layer as living documentation, using BDD‑style Given‑When‑Then tests that assert only observable behavior, which improves code readability, eases onboarding, and provides a reliable safety net for future changes.

BDDJavaScriptMocking
0 likes · 13 min read
Frontend Unit Testing as Documentation: Challenges and Practices
DaTaobao Tech
DaTaobao Tech
Dec 9, 2022 · Fundamentals

Frida-gum Based Non-intrusive C++ Mock Framework

This open‑source C++ mock framework leverages Frida‑gum to replace any function—including static, member, virtual, and library calls—at runtime without source changes, offering simple MOCK and MOCK_RETURN macros, call‑count expectations, automatic scope‑based rollback, and cross‑platform support for reliable, non‑intrusive unit testing.

C++Cross‑PlatformFrida
0 likes · 11 min read
Frida-gum Based Non-intrusive C++ Mock Framework
Ant R&D Efficiency
Ant R&D Efficiency
Sep 20, 2022 · Backend Development

Guidelines for Writing Unit Tests with Mockito and Test Case Design in SpringBoot

The article outlines how to design robust SpringBoot unit tests by first mastering business flows and external dependencies, preparing isolated test data, using Mockito’s @Mock/@MockBean and @Spy/@SpyBean correctly—including proper stubbing techniques—and applying best‑practice rules and the ACTS 2.0 framework for data‑driven, coverage‑verified testing.

MockingMockitoSpringBoot
0 likes · 8 min read
Guidelines for Writing Unit Tests with Mockito and Test Case Design in SpringBoot