Skip to content

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:

  1. Mock Service → Interface Click "Add Interface"
  2. Fill in basic information:
    • Path (e.g., /api/login)
    • Method (GET/POST, etc.)
    • Description (functional explanation)
  3. 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:

  1. Add Interface▼ Select "Import Interface"
  2. Upload file (JSON/YAML)
  3. 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:
    1. Click "Clone" on the interface row
    2. Automatically create a copy (modify path to avoid conflicts)
  • Export Interface:
    1. Click "Export" button
    2. Download JSON format script

II. Interface Debugging and Testing

1. Instance Configuration Sync

Description: Force update running interface configurations
Steps:

  1. Interface List Click "Refresh Instance Interfaces"
  2. 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:

  1. Right Side Click "Test Request"
  2. Send request and view response:
    • Status code (green/red indicators)
    • Response time (ms)
    • Response body (formatted display)

      ❗ Response header with XC-Mock-Error indicates configuration error

3. Request Proxy Configuration

Description: Resolve cross-origin restrictions
Steps:

  1. Test Panel Click "Proxy" icon
  2. Select preset proxy node

    ⚠️ Requires proxy setup in System Configuration

III. Response Configuration Management

1. Random Content Response

Description: Dynamically generate mock data
Steps:

  1. Response Configuration Enter mock function:

2. Conditional Matching Response

Description: Return different responses based on request parameters
Steps:

  1. Add multiple responses
  2. Configure matching rules:
    • Priority (lower numbers = higher priority)
    • Conditions (Header/Query/Body)
  3. Set corresponding response content

    ⚠️ Returns default response if no match

3. Delayed Response Configuration

Description: Simulate network latency scenarios
Steps:

  1. Response Configuration Set delay parameters:
    • Fixed delay (milliseconds)
    • Random range (10-200ms)

4. Error Status Code Response

Description: Simulate server errors
Steps:

  1. Response Configuration Set status code:
    • 4xx (client errors)
    • 5xx (server errors)

5. File Download Response

Description: Return binary file content
Steps:

  1. Response Body Click "Insert File"
  2. Select local file (auto-converted to Base64)

    ⚠️ File size ≤10MB

6. Request Callback Function

Description: Asynchronously forward requests to real interfaces
Steps:

  1. Response Configuration Enable "Callback" toggle
  2. 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:
    1. Click "Delete" on response card
    2. Confirm removal

2. Interface Deletion

Description: Clean up invalid interfaces
Steps:

  1. Interface List Select target interface
  2. Click "Delete" icon
  3. Confirm operation

3. Example Library Import

Description: Quickly obtain standard examples
Steps:

  1. Add Interface▼ Select "Import Example"
  2. System automatically creates built-in interface examples

MockApi Field Information

ParameterField NameTypeRequiredLength LimitDescription
IDidbigintConditional/Unique identifier;
Required for modifications
Mock Service IDmockServiceIdlongYes/Associated mock service unique ID
Interface NamesummarystringYes≤400Interface function summary
Detailed DescriptiondescriptionstringNo≤20000Detailed interface description
HTTP MethodmethodenumYes/HTTP Method,
e.g., GET
Interface EndpointendpointstringYes≤800Interface access path
Project IDprojectIdlongRead-only/Associated project ID
Interface SourcesourceenumRead-only/Source,
e.g., manually created
Import SourceimportSourceenumRead-only/Import Source,
e.g., OpenAPI
Associated Project IDassocProjectIdlongRead-only/Associated project ID
Associated Project NameassocProjectNamestringRead-only/Associated project name
Associated Interface IDassocApisIdlongRead-only/Associated interface ID
Associated Interface NameassocApisNamestringRead-only/Associated interface name
Mock Service NamemockServiceNamestringRead-only/Associated mock service name
Mock Service Domain URLmockServiceDomainUrlstringRead-only/Mock service domain URL
Mock Service Host URLmockServiceHostUrlstringRead-only/Mock service host URL
Request CountrequestNumlongRead-only/Total interface request count
Callback Request CountpushbackNumlongRead-only/Callback request count
Simulated Error CountsimulateErrorNumlongRead-only/Simulated error response count
Success CountsuccessNumlongRead-only/Successful request count
Exception CountexceptionNumlongRead-only/Exception request count
Inconsistent Operation FlaginconsistentOperationbooleanRead-only/Whether interface operations are inconsistent
Associated Interface Deletion StatusassocApisDeletedbooleanRead-only/Whether associated interface is deleted
Actual Interface MethodapisMethodenumRead-only/Actual HTTP method of associated interface
Actual Interface EndpointapisEndpointstringRead-only/Actual access path of associated interface
Response ListresponseslistRead-only/Mock response configuration list
Tenant IDtenantIdlongRead-only/Tenant ID
Creator IDcreatedBylongRead-only/Interface creator ID
Creator NamecreatedByNamestringRead-only/Creator name
Creation TimecreatedDatedatetimeRead-only/Interface creation time
Last Modified By IDlastModifiedBylongRead-only/Last modifier ID
Last Modified By NamelastModifiedByNamestringRead-only/Last modifier name
Last Modified TimelastModifiedDatedatetimeRead-only/Last modification time

Response List Fields (responses)

ParameterField NameTypeDescription
Response NamenamestringResponse configuration name
Request Matching ConditionsmatchobjectRequest matching rule configuration
Response ContentcontentobjectMock response content configuration
Callback ConfigurationpushbackobjectRequest callback configuration
Match Exception Response FlagmatchExceptionResponsebooleanWhether to match exception responses

Interface Source (source)

Enum ValueDescription
CREATEDManually created by user
ANGUS_IMPORTImported via AngusTester file
COPY_APISCopy of existing interface
ASSOC_APISMock interface from associated interface

Import Source (importSource)

Enum ValueDescription
OPENAPIImported from OpenAPI spec file
POSTMANImported from Postman collection file
ANGUSImported from AngusTester spec file

HTTP Method (method)

Enum ValueDescription
GETRetrieve specified resource
POSTSubmit data to specified resource
PUTReplace entire resource content
DELETEDelete specified resource
PATCHPartially update resource
OPTIONSGet server communication options
HEADGet resource header metadata

Released under the GPL-3.0 License.