Mock Interface Management
The AngusTester Mock Interface Management
module supports flexible configuration of multiple response modes, enabling interface behavior simulation and request proxying.
I. Basic Interface Operations
1. Create Mock Interface
Description: Define new mock interface specifications
Steps:
Mock Service → Interface
Click "Add Interface"- Fill in basic information:
- Path (e.g.,
/api/login
) - Method (GET/POST, etc.)
- Description (functional explanation)
- Path (e.g.,
- Configure response content:
- Status code (200/404, etc.)
- Response body (JSON/XML/TEXT)
- Response headers (Content-Type, etc.)
⚠️ Path + Method must be globally unique
2. Bulk Import Interfaces
Description: Create interfaces in bulk via script files
Steps:
Add Interface▼
Select "Import Interface"- Upload file (JSON/YAML)
- Set conflict resolution policy:
- Overwrite (update existing interfaces with the same name)
- Skip (retain original interfaces)
3. Clone and Export
Description: Reuse or back up interface configurations
Steps:
- Clone Interface:
- Click "Clone" on the interface row
- Automatically create a copy (modify path to avoid conflicts)
- Export Interface:
- Click "Export" button
- Download JSON format script
II. Interface Debugging and Testing
1. Instance Configuration Sync
Description: Force update running interface configurations
Steps:
Interface List
Click "Refresh Instance Interfaces"- System automatically:
- Reloads latest configurations
- Maintains existing connections
Takes ~3 seconds
2. Request Testing and Verification
Description: Real-time verification of interface response accuracy
Steps:
Right Side
Click "Test Request"- Send request and view response:
- Status code (green/red indicators)
- Response time (ms)
- Response body (formatted display)
❗ Response header withXC-Mock-Error
indicates configuration error
3. Request Proxy Configuration
Description: Resolve cross-origin restrictions
Steps:
Test Panel
Click "Proxy" icon- Select preset proxy node
⚠️ Requires proxy setup inSystem Configuration
III. Response Configuration Management
1. Random Content Response
Description: Dynamically generate mock data
Steps:
Response Configuration
Enter mock function:
2. Conditional Matching Response
Description: Return different responses based on request parameters
Steps:
- Add multiple responses
- Configure matching rules:
- Priority (lower numbers = higher priority)
- Conditions (Header/Query/Body)
- Set corresponding response content
⚠️ Returns default response if no match
3. Delayed Response Configuration
Description: Simulate network latency scenarios
Steps:
Response Configuration
Set delay parameters:- Fixed delay (milliseconds)
- Random range (10-200ms)
4. Error Status Code Response
Description: Simulate server errors
Steps:
Response Configuration
Set status code:- 4xx (client errors)
- 5xx (server errors)
5. File Download Response
Description: Return binary file content
Steps:
Response Body
Click "Insert File"- Select local file (auto-converted to Base64)
⚠️ File size ≤10MB
6. Request Callback Function
Description: Asynchronously forward requests to real interfaces
Steps:
Response Configuration
Enable "Callback" toggle- Configure target URL and parameters
IV. Maintenance Operations
1. Response Management
Description: Manage multiple interface response configurations
Steps:
- Add Response: Click "Add Response"
- Delete Response:
- Click "Delete" on response card
- Confirm removal
2. Interface Deletion
Description: Clean up invalid interfaces
Steps:
Interface List
Select target interface- Click "Delete" icon
- Confirm operation
3. Example Library Import
Description: Quickly obtain standard examples
Steps:
Add Interface▼
Select "Import Example"- System automatically creates built-in interface examples
MockApi Field Information
Parameter | Field Name | Type | Required | Length Limit | Description |
---|---|---|---|---|---|
ID | id | bigint | Conditional | / | Unique identifier; Required for modifications |
Mock Service ID | mockServiceId | long | Yes | / | Associated mock service unique ID |
Interface Name | summary | string | Yes | ≤400 | Interface function summary |
Detailed Description | description | string | No | ≤20000 | Detailed interface description |
HTTP Method | method | enum | Yes | / | HTTP Method, e.g., GET |
Interface Endpoint | endpoint | string | Yes | ≤800 | Interface access path |
Project ID | projectId | long | Read-only | / | Associated project ID |
Interface Source | source | enum | Read-only | / | Source, e.g., manually created |
Import Source | importSource | enum | Read-only | / | Import Source, e.g., OpenAPI |
Associated Project ID | assocProjectId | long | Read-only | / | Associated project ID |
Associated Project Name | assocProjectName | string | Read-only | / | Associated project name |
Associated Interface ID | assocApisId | long | Read-only | / | Associated interface ID |
Associated Interface Name | assocApisName | string | Read-only | / | Associated interface name |
Mock Service Name | mockServiceName | string | Read-only | / | Associated mock service name |
Mock Service Domain URL | mockServiceDomainUrl | string | Read-only | / | Mock service domain URL |
Mock Service Host URL | mockServiceHostUrl | string | Read-only | / | Mock service host URL |
Request Count | requestNum | long | Read-only | / | Total interface request count |
Callback Request Count | pushbackNum | long | Read-only | / | Callback request count |
Simulated Error Count | simulateErrorNum | long | Read-only | / | Simulated error response count |
Success Count | successNum | long | Read-only | / | Successful request count |
Exception Count | exceptionNum | long | Read-only | / | Exception request count |
Inconsistent Operation Flag | inconsistentOperation | boolean | Read-only | / | Whether interface operations are inconsistent |
Associated Interface Deletion Status | assocApisDeleted | boolean | Read-only | / | Whether associated interface is deleted |
Actual Interface Method | apisMethod | enum | Read-only | / | Actual HTTP method of associated interface |
Actual Interface Endpoint | apisEndpoint | string | Read-only | / | Actual access path of associated interface |
Response List | responses | list | Read-only | / | Mock response configuration list |
Tenant ID | tenantId | long | Read-only | / | Tenant ID |
Creator ID | createdBy | long | Read-only | / | Interface creator ID |
Creator Name | createdByName | string | Read-only | / | Creator name |
Creation Time | createdDate | datetime | Read-only | / | Interface creation time |
Last Modified By ID | lastModifiedBy | long | Read-only | / | Last modifier ID |
Last Modified By Name | lastModifiedByName | string | Read-only | / | Last modifier name |
Last Modified Time | lastModifiedDate | datetime | Read-only | / | Last modification time |
Response List Fields (responses)
Parameter | Field Name | Type | Description |
---|---|---|---|
Response Name | name | string | Response configuration name |
Request Matching Conditions | match | object | Request matching rule configuration |
Response Content | content | object | Mock response content configuration |
Callback Configuration | pushback | object | Request callback configuration |
Match Exception Response Flag | matchExceptionResponse | boolean | Whether to match exception responses |
Interface Source (source)
Enum Value | Description |
---|---|
CREATED | Manually created by user |
ANGUS_IMPORT | Imported via AngusTester file |
COPY_APIS | Copy of existing interface |
ASSOC_APIS | Mock interface from associated interface |
Import Source (importSource)
Enum Value | Description |
---|---|
OPENAPI | Imported from OpenAPI spec file |
POSTMAN | Imported from Postman collection file |
ANGUS | Imported from AngusTester spec file |
HTTP Method (method)
Enum Value | Description |
---|---|
GET | Retrieve specified resource |
POST | Submit data to specified resource |
PUT | Replace entire resource content |
DELETE | Delete specified resource |
PATCH | Partially update resource |
OPTIONS | Get server communication options |
HEAD | Get resource header metadata |