Skip to main content

Introduction

Apidog Dynamic Values, built upon Faker.js v9.0.0-rc.1, are enhanced and optimized specifically for API testing workflows. While retaining the robust functionality of Faker.js, Apidog offers a more intuitive and efficient experience for generating realistic test data. If you're already familiar with Faker.js, transitioning to Apidog Dynamic Values will be a breeze.

Comprehensive Dynamic Value Library

For easy reference, Apidog provides documentation with examples for each dynamic value category, mirroring the structure of Faker.js:

Key Enhancements in Apidog Dynamic Values

Here are the key changes that make Apidog Dynamic Values even more powerful and user-friendly:


1. Simplified Expression Syntax for Easy Access

Apidog uses a concise and intuitive syntax for calling dynamic values:

  • Faker.js: faker.finance.accountName()
  • Apidog: {{$finance.accountName}}

Simply type {{% within Apidog to trigger auto-completion and effortlessly explore the available dynamic values.


2. Optimized Output for Objects and Arrays - Increased Flexibility

Apidog simplifies data handling by returning JSON strings for methods that originally returned objects or arrays in Faker.js, enabling direct access to specific values:

Example 1: Extracting Airport Data

  • Faker.js: faker.airline.airport() returns an object:
 faker.airline.airport() // { name: 'Dallas Fort Worth International Airport', iataCode: 'DFW' } 
  • Apidog: Access specific fields directly:
    `{{$airline.airportName}}`  //'Dallas Fort Worth International Airport'
`{{$airline.airportIataCode}}` // 'DFW'

Example 2: Handling Multiple Dates

  • Faker.js: faker.date.betweens() returns an array:
faker.date.betweens({ from: '2020-01-01T00:00:00.000Z', to: '2030-01-01T00:00:00.000Z', count: { min: 2, max: 5 }})
// [
// 2021-12-19T06:35:40.191Z,
// 2022-09-10T08:03:51.351Z,
// 2023-04-19T11:41:17.501Z
// ]
  • Apidog: Returns a JSON stringified array for straightforward data processing:
{{$date.betweens(from='2020-01-01T00:00:00',to='2030-01-01',min=2,max=5)}}  // ["2020-10-14 00:48:27","2021-10-25 22:46:34","2027-03-06 02:33:22","2028-04-22 20:13:40","2029-12-31 14:45:59"]
tip

For a comprehensive overview of adjusted methods and their parameters, refer to the Apidog documentation.


3. Enhanced Locale Control for Localized Data Generation

Apidog provides enhanced control over Locale settings for generating region-specific data:

  • Function-Level Settings: Define Locale settings individually for each dynamic value function.
  • Project-Level Defaults: Set a default Locale for your entire Apidog project.
  • Date Formatting Overrides: Utilize the format method within date-related functions to apply Locale-specific formatting overrides.

4. Preset Parameters for Common Use Cases - Streamlined Workflows

Apidog boosts your efficiency by providing preset parameters for frequently used methods (customizable as needed):

  • {{$helpers.fromRegExp('[A-Z0-9]{4}-[A-Z0-9]{4}')}} // Generates strings matching a regular expression
  • {{$helpers.arrayElement(['abc','123'])}} // Randomly selects an element from an array
  • {{$helpers.arrayElements(['abc','123'])}} // Selects multiple random elements from an array
  • {{$helpers.replaceSymbols('##??**')}} // Replaces special symbols with random characters
  • {{$helpers.slugify('abc 123')}} // Generates a URL-friendly slug

5. Expanded Dynamic Value Library for Extended Coverage

Apidog enriches your data generation capabilities with new categories and methods:

  • New Category: food for generating diverse food-related data. Example: {{$food.vegetable}}
  • New Methods:
    • {{$date.timeZone}} for generating time zone data.
    • {{$music.album}} for creating realistic music album names.
    • {{$music.artist}} for generating artist names.
  • Enhanced Method Parameters:
    • {{$phone.number(style='human')}} for generating human-readable phone numbers, such as: (555) 123-4567.
    • {{$number.int(multipleOf=3)}} for generating integers divisible by a specified number.

6. Unlimited Concatenation - Unleash Your Creativity

Apidog provides ultimate flexibility by allowing you to seamlessly combine Mock data and dynamic values without limitations, enabling the creation of rich and realistic test scenarios.


7. Expanded Date Functionality for Powerful Date Manipulation

Apidog extends date-related functions with new parameters for formatting, offset calculation, and more, catering to diverse and complex testing requirements.