GoFrame v2.9 Documentation
首页 白天 夜间 BookChat 小程序 小程序 下载 阅读记录
  • 书签 我的书签
  • 添加书签 添加书签 移除书签 移除书签

Testing

来源 GoFrame 浏览 1 扫码 打印 2026-10-25 01:04:55
  • Testing

Testing

📄️ Unit TestingThe usage of the gtest module under the GoFrame framework, providing convenient and lightweight unit testing methods. gtest extends the functionality of the standard library testing, adding multiple testing features such as test case isolation and common assertion methods. It is suitable for most unit testing scenarios and can be combined with third-party testing frameworks like testify and goconvey for more complex testing.

上一篇:
下一篇:
  • 书签
  • 添加书签 移除书签
  • Quick Start
    • Preface
    • Quick Start
      • Installation
      • Hello World
      • Parameters Retrieving
      • Parameters Structure
      • Standard Routing
      • Using Middleware
      • Response Structure
      • API Documentation
      • What’s Next
    • Project Scaffold🌟
      • Introduction
      • Project Initialization
      • API Development Tutorial🌟
        • Step1 - Design Data Structure
        • Step2 - Generate dao/do/entity
        • Step3 - Write API Definition
        • Step4 - Generate Controller
        • Step5 - Implement API Logic
        • Step6 - Configuration
        • Step7 - Run and Test
      • What’s Next
  • Documentation
    • CLI Tool
      • Installation
      • Version Check
      • Version Upgrade
      • Project Scaffold
      • Cross-Compiling
      • Code Generating
        • Controller Generating
        • Dao/Do/Entity Generating
        • Service Generating
        • Enums Maintenance
        • Protobuf Compilation
        • DB Table To Protobuf
      • Auto Compiling
      • Resource Packing
      • Image Building
      • Compatibility Fix
      • Help Info
    • Core Components 🔥
      • Objects
      • Debug Mode
      • Command
        • Command - Concepts
        • Command - Methods
        • Command - Args Parsing
        • Command - Object
        • Command - Structure
        • Command - Interaction
        • Command - Tracing
      • Configuration
        • Configuration - Object
        • Configuration - File
        • Configuration - Methods
        • Configuration - Interface
          • Configuration - AdapterFile
          • Configuration - AdapterContent
        • Configuration - YAML
        • Configuration - TOML
      • Logging
        • Logging - Configuration
        • Logging - Log Level
        • Logging - File Directory
        • Logging - Chaining Operations
        • Logging - Color Printing
        • Logging - Context
        • Logging - Handler
        • Logging - JSON Format
        • Logging - Asynchronous Output
        • Logging - Stack Printing
        • Logging - Debug Info
        • Logging - Writer Interface
        • Logging - Flags
        • Logging - Rotatation
        • Logging - FAQ
      • Error Handling
        • Error Handling - Methods
        • Error Handling - Stack
        • Error Handling - Comparison
        • Error Handling - Other Features
        • Error Handling - Best Practices
        • Error Handling - Performance
        • Error Handling - Error Code
          • Error Code - Interface
          • Error Code - Example
          • Error Code - Extension
          • Error Code - Implementation
          • Error Code - Built-in Codes
      • Data Validation
        • Data Validation - Rules
        • Data Validation - Object
        • Data Validation - Result
        • Data Validation - Data Type
          • Data Type - Value
          • Data Type - Map
            • Map Validation - Example
            • Map Validation - Sequence
          • Data Type - Struct
            • Struct Validation - Example
            • Struct Validation - Assoc
        • Data Validation - Optional Rule
        • Data Validation - Recursive
        • Data Validation - Custom
          • Custom Rule - Registration
          • Custom Rule - Input Object
        • Data Validation - Error Msg
        • Data Validation - Methods
        • Data Validation - FAQ
      • Type Conversion
        • Type Conversion - Types
        • Type Conversion - Map
        • Type Conversion - Struct
        • Type Conversion - Structs
        • Type Conversion - Scan
        • Type Conversion - Interface
        • Type Conversion - Performance
        • Type Conversion - Converter
        • Type Conversion - Custom Type Conversion
      • Database ORM🔥
        • ORM - Configuration
          • ORM Configuration - File
          • ORM Configuration - Methods
          • ORM Configuration - FAQ
        • ORM - Model 🔥
          • ORM Model - Model
          • ORM Model - Insert/Save
          • ORM Model - Update/Delete
          • ORM Model - Query
            • Model Query - Where
            • Model Query - Methods
            • Model Query - AllAndCount
            • Model Query - Exist
            • Model Query - Scan
            • Model Query - ScanAndCount
            • Model Query - Join
            • Model Query - Group/Order
            • Model Query - Union/UnionAll
            • Model Query - Subquery
            • Model Query - Operators
          • ORM Model - Association
            • Model Association - ScanList
            • Model Association - With
          • ORM Model - Object Input
          • ORM Model - Fields Filtering
          • ORM Model - Fields Retrieval
          • ORM Model - Transaction
          • ORM Model - Master/Slave
          • ORM Model - Query Cache
          • ORM Model - Time Fields
            • Time Fields - Intro
            • Time Fields - Integer Fields
            • Time Fields - Boolean Fields
            • Time Fields - SoftTimeOption
          • ORM Model - Schema
          • ORM Model - Hook
          • ORM Model - Handler
          • ORM Model - Lock
        • ORM - Method Ops (Native)
        • ORM - Transaction
          • ORM Transaction - Methods
          • ORM Transaction - Closure
          • ORM Transaction - Nested
          • ORM Transactions - Propagation
          • ORM Transactions - Isolation Levels
          • ORM Transactions - Read-Only Mode
        • ORM - Result Handling
          • ORM Result - Types
          • ORM Result - Empty Check
          • ORM Result - Empty Array
        • ORM - Timezone
        • ORM - Model Generation
        • ORM - Sharding
          • ORM Sharding - Table Sharding
          • ORM Sharding - Database Sharding
        • ORM - Senior Features
          • ORM Senior - RawSQL
          • ORM Senior - SQL Capture
          • ORM Senior - Debug Mode
          • ORM Senior - Logging
          • ORM Senior - Field Mapping
          • ORM Senior - Dry Run
          • ORM Senior - Type Recognition
          • ORM Senior - Type Conversion
          • ORM Senior - Connection Pool
          • ORM Senior - Embedded Struct
          • ORM Senior - UnmarshalValue
        • ORM - Interface
          • ORM Interface - Callback
          • ORM Interface - Driver
        • ORM - Context
        • ORM - Best Practices
          • Utilizing Pointer Properties and Do Objects for Flexible Modification Interfaces
          • Try to use JSON for complex types for storage, facilitating automatic conversion to objects upon scanning, avoiding custom parsing
          • Avoid Object Initialization and sql.ErrNoRows Judgment in Queries
        • ORM - FAQ
      • Caching
        • Caching - Interface
        • Caching - In-Memory
        • Caching - Redis
        • Caching - Methods
      • Template Engine
        • Template Engine - Configuration
        • Template Engine - Tags
        • Template Engine - Variables
        • Template Engine - Layout
        • Template Engine - XSS
        • Template Engine - Others
        • Template Engine - Funcs
          • Template Funcs - Intro
          • Template Funcs - Built-In
          • Template Funcs - Custom
      • I18N
        • I18N - Configuration
        • I18N - Example
      • Resource
        • Resource - Packing With Tool
        • Resource - Packing With Method
        • Resource - Methods
        • Resource - Examples
        • Resource - Best Practices
    • Components Category
      • Container
        • Map
          • Map - Usage
          • Map - Performance
          • Map - Methods
        • Array
          • Array - Usage
          • Array - Methods
        • Set
          • Set - Usage
          • Set - Performance
          • Set - Methods
        • List
          • List - Usage
          • List - Performance
        • Generic
          • Generic - Usage
          • Generic - Methods
          • Generic - Precautions
        • Safe Type
          • Safe Type - Usage
          • Safe Type - Performance
        • Queue
          • Queue - Usage
          • Queue - Performance
        • Tree
          • Tree - Usage
          • Tree - Methods
        • Pool
          • Pool - Usage
      • System
        • Time
          • Time - Format
          • Time - Object
          • Time - Examples
          • Time - Time Zone
          • Time - Methods
        • Timer
          • Timer - Usage
          • Timer - Performance
        • Mutex
        • Memory Lock
        • Context
        • Command
        • Logging
        • Cron Job
          • Cron Job - Expressions
          • Cron Job - Usage
          • Cron Job - Logging
          • Cron Job
        • Caching
        • File
        • Resource
        • Configuration
        • Environment
        • File Watching
          • File Watching - Add
          • File Watching - Remove
          • File Watching - System Vars
        • Process
          • Process - Usage
          • Process - Communication
          • Process - Signal
          • Process - Tracing
        • Template Engine
        • Goroutine
        • Build Information
        • Object Information
      • Text
        • String Processing
        • Regular Expression
          • Regular Expressions - Usage
          • Regular Expressions - Methods
      • Codec
        • General Codec
          • General Codec - Creation
          • General Codec - Nested Visiting
          • General Codec - Struct
          • General Codec - Dynamic Creation and Modification
          • General Codec - Data Format
          • General Codec - Methods
          • General Codec - FAQ
        • Binary
        • BASE64
        • Classic Hash Functions
        • HTML
        • URL
        • XML
        • INI
        • YAML
        • TOML
        • Charset Conversion
        • Compression
      • Database
        • Database ORM
        • Redis Client
      • Network
        • TCP
          • TCP - Object
            • TCP Object - Package
            • TCP Object - Senior
          • TCP - Methods
          • TCP - TLS
          • TCP - Connection Pool
        • UDP
          • UDP - Object
          • UDP - Methods
      • Crypto
        • MD5
        • AES
        • DES
        • SHA1
        • CRC32
      • Utilities
        • Random
        • Unique Number
        • Metadata
        • Type Conversion
        • Data Validation
        • Pagination
        • Utility Functions
      • Testing
        • Unit Testing
      • Errors
        • Error Handling
        • Error Code
      • Debugging
        • Debugging
      • I18N
        • I18N
      • NoSQL Redis
        • Redis - Configuration
        • Redis - Examples
        • Redis - Do
        • Redis - Conn
        • Redis - Interface
    • WEB Service Development
      • Getting Started
      • Router 🔥
        • Router - Route Patterns
        • Router - Registration
          • Registration - Function
          • Registration - Object
          • Registration - Group Routing
          • Standard Router
            • Standard Router - Example
            • Standard Router - Usage
            • Standard Router - FAQ
        • Router - Middleware
          • Middleware - Intro
          • Middleware - Examples
          • Middleware - FAQ
      • API Document
        • API Document - OpenAPIv3
        • API Document - Custom UI
        • API Document - Extending Response
      • Request 🔥
        • Request - Parameters
        • Request - Parameter Binding
        • Request - Validation
        • Request - JSON/XML
        • Request - Default Value
        • Request - Custom Parameters
        • Request - Context
        • Request - File Uploading
      • Response
        • Response - Buffering
        • Response - JSON/XML
        • Response - Redirect
        • Response - Exit
        • Response - File Downloading
        • Response - Template Parsing
        • Response - Streaming
      • Configuration
        • Configuration - File
        • Configuration - File Template
        • Configuration - Methods
      • Cookie
      • Session
        • Session - File
        • Session - Memory
        • Session - Redis-KeyValue
        • Session - Redis-HashTable
        • Session - Storage Interface
        • Session - RegenerateId
      • Exception Handling
      • HTTPClient
        • HTTPClient - Examples
        • HTTPClient - File Uploading
        • HTTPClient - Cookie
        • HTTPClient - Header
        • HTTPClient - ContentType
        • HTTPClient - Transport
        • HTTPClient - Raw
        • HTTPClient - Proxy
        • HTTPClient - Middleware
        • HTTPClient - FAQ
        • HTTPClient - Metrics
      • Pagination
        • Pagination - Dynamic Paging
        • Pagination - Static Paging
        • Pagination - Ajax Paging
        • Pagination - URL Template
        • Pagination - Custom Paging
      • Advanced Features
        • Static File Service
        • Logging
        • HTTPS & TLS
        • Graceful Restart
        • CORS
        • CSRF
        • HOOK Callbacks
        • WebSocket
        • Status Code Handling
        • PProf Performance Analysis
        • SameSite
        • HTTPServer - Metrics
      • Performance
      • FAQ
    • Microservice Development
      • Preparation
      • Project Structure
      • Scaffold Components
      • GRPC Server Configuration
      • GRPC Interceptor Component
      • Service Registry and Discovery
      • Service Load Balancing
      • Service Configuration
    • Service Observability
      • Service Tracing
        • Tracing - Intro
        • Tracing - Preparation
        • Tracing - Basic Example
        • Tracing - HTTP Example
          • Tracing HTTP - Baggage
          • Tracing HTTP - Data Ops
        • Tracing - GRPC Example
        • Tracing - Best Practices
          • TraceID Injection and Retrieval
      • Service Metrics
        • Metrics - Intro
        • Metrics - Usage
        • Metrics - Synchronous Metrics
        • Metrics - Asynchronous Metrics
        • Metrics - Attributes
        • Metrics - Built-in Metrics
        • Metrics - Component Metrics
    • Frequently Asked Questions (FAQ)
    • Project Deployment
      • Deployment - Standalone
      • Deployment - Proxy
      • Deployment - Container
    • Framework Design
      • Modular Design
      • Unified Framework Design
      • Engineering Design 🔥
        • Code Layering
        • Project Structure🔥
        • DAO Encapsulation
          • Pain Points and Improvements In ORM Component
          • Pain Points and Improvements In Business Project
        • Structured Programming
        • Data and Business Models
        • Mono-Repo Management
      • OpenTelemetry Tracing
      • Error Stack
      • Interface and Generic
      • Implicit and Explicit Init
      • Golang Enums
      • Context Shared Variables
    • Other Documents
      • Environment Preparation
        • Installation
        • Go Module
        • Configuration
        • Private Modules
      • Happily Upgrade from v1 to v2
      • Printing Placeholder Format
      • Appendix: System Signals List
    • Docs Changelog
  • Examples
    • gRPC
      • Basic Usage
      • Context Usage
      • Raw gRPC Example
      • Load Balancing
      • Service Resolver
    • NoSQL
      • Redis
      • MongoDB
    • Database
      • Encoded Password Database Connection
    • HTTP Server
      • JWT Authentication
      • Basic Authentication
      • Proxy
      • Rate Limit
      • Response with JSON Array
      • Server-Sent Events(SSE)
      • Swagger Auth
      • File Upload Example
      • WebSocket
    • Observability
      • Metric
        • Basic
        • Callback
        • Dynamic Attributes
        • Global Attributes
        • HTTP Client
        • HTTP Server
        • Meter Attributes
        • Prometheus Integration
      • Tracing
        • gRPC with Database
        • HTTP Service
        • HTTP with Database
        • In-Process Service (HTTP Exporter)
        • In-Process Service (gRPC Exporter)
        • OpenTelemetry Example
        • Multi-Process Example
        • OpenTelemetry Provider Examples
    • Load Balancer
      • HTTP Service
      • Polaris Integration
    • Service Config
      • Apollo
      • Consul
      • Kubernetes ConfigMap
      • Nacos
      • Polaris
    • Service Registry
      • Consul
      • Etcd
      • File
      • Nacos
      • Polaris
    • Practices
      • Dependency Injection
  • Release
    • Version Release Notes
    • v2.9 2025-03-18
    • v2.8 2024-11-18
    • v2.7 2024-04-09
    • v2.6 2023-12-19
    • v2.5 2023-07-17
    • v2.4 2023-04-24
    • v2.3 2023-01-18
    • v2.2 2022-10-11
    • v2.1 2022-06-22
    • v2.0 2022-03-09
    • Historical Version v1.x
      • v1.16 2021-06-01
      • v1.15 2020-12-31
      • v1.14 2020-10-27
      • v1.13 2020-06-10
      • v1.12 2020-03-31
      • v1.11 2020-01-14
      • v1.10 2019-12-05
      • v1.9 2019-09-24
      • v1.8 2019-07-15
      • v1.7 2019-06-10
      • v1.6 2019-04-09
      • v1.5 2019-02-28
      • v1.4 2019-01-24
      • v1.3 2018-12-26
      • v1.2 2018-11-26
      • v1.1 2018-11-26
      • v1.0 2018-10-24
    • Historical Version v0.x
      • v0.3 2018-08-07
      • v0.2 2018-05-21
      • v0.1 2018-04-23
暂无相关搜索结果!

    本文档使用 WanXiangYunDang 构建

    展开/收起文章目录

    思维导图备注

    文章二维码

    手机扫一扫,轻松掌上读

    文档下载

    请下载您需要的格式的文档,随时随地,享受汲取知识的乐趣!
    PDF文档 EPUB文档 MOBI文档

    微信小程序阅读

    BookChat 微信小程序阅读
    微信扫一扫,知识掌上学

    书签列表

      阅读记录

      阅读进度: 0.00% ( 0/0 ) 重置阅读进度