ScriptlessAutomation
  • 👋Welcome to Scriptless Automation
  • Discover More About Automation
    • ⚙️Automation platform intro
    • 💡Advantages of Scriptless Automation
    • 🚀Release Notes
      • 📖Open Code
      • 📕License Code
  • Product tools
    • 📪Pre-request Tools
    • 🔧Project Dependencies
  • Automation Architecture
    • 🎨Flow diagram
  • Get Started
    • 🛠️Start with Automation
    • 📖Open Code Automation
      • 🌏Web Automation
      • ↔️API Automation
    • 🏢Maven Configuration
    • 🗜️Setting Up Maven Project in IntelliJ IDEA
    • 🎛️Scriptless Config
      • 🕸️BrowserConfiguration
        • chrome.properties
      • 👥CommunicationConfiguration
        • SlackConfiguration.properties
      • 📧MailConfiguration
        • gmailCredentials.properties
      • 🛂ReportConfiguration
        • extentReportConfiguration.properties
      • 🕵️TestManagementConfiguration
        • testRail.properties
        • zephyrscale.properties
        • testiny.properties
      • ⚙️testNgConfiguration.properties
    • 🍱TestData Configuration
    • 👨‍💼Gherkin Language and Scriptless Automation Framework
  • Automation Import Notes
    • 🎨Points to Remember
  • Automation Platforms
    • 👾ScriptlessApi Automation
      • 🖊️Introduction
      • 🗜️Api Automation Setup
      • 🔃Supported API Request Types
      • 🪧API Automation Template
      • 📚Example of API Requests
        • ⬇️GET
        • ↕️POST
        • ⤵️PUT
        • ❌DELETE
      • 🎯API Response Validation
      • 👨‍👦API Dependent TestCase
      • 📝Store API Variables
      • 📔API with JSON body
      • 🙋‍♂️Api Wait
      • 🗜️API Schema Validation
      • 🏗️API Tailor-Made coding
      • 👨‍🦯API Support Generator
      • ↘️Api Response Store Objects
      • ✍️API Test Report
      • 🚃Api Response Type Validation
    • 🌐ScriptlessWeb Automation
      • 🖊️Introduction
      • 🗜️Web Automation Setup
      • 🪧Web Automation Template
      • 🧮page_object_locators
      • 📜Web Automation Key Phrases
        • 📃PAGE_NAME
        • ⌛WAIT_TYPE
        • 📜SCROLL_TYPE
        • 👨‍💼ELEMENT_NAME
        • 🏎️ACTIONS
        • ⌨️SEND_KEYS
        • ✔️VALIDATION
        • ✅VALIDATION_TYPE
      • 👨‍👦Web Dependent Test Case
      • 🐒MOCK
      • 🛂AutomationAsserts
      • 🏗️Web Tailor-Made coding
      • 📝Store Web Variables
      • 🤼‍♀️Web & API integration
      • 🖇️Dynamic Strings
      • 🗣️ReadFile Annotation for Custom Code
      • 🖼️Page_Comparison
      • 👨‍💼Gherkin Template for Web Automation
    • 📱Mobile Automation
  • 🪶Automation features
    • 🌲Environment and System Variables
    • 🗝️KeyInitializers
      • Types of KeyInitializers
    • ✍️Reporting
      • Dashboard
      • Category
      • Tests
        • Screenshot Section
    • 👯Parallel Testing
    • 🏗️Tailor-Made Coding
  • ⏩Automation Demo
Powered by GitBook
On this page

Was this helpful?

  1. Automation Platforms
  2. ScriptlessWeb Automation

MOCK

Overview

The MOCK class is a powerful component of our automated testing suite, designed to generate and manage mock data for a variety of testing scenarios. This class provides a range of functionalities to create realistic and random data, such as email addresses, names, phone numbers, and addresses, which are essential for robust and comprehensive testing.

Methods

  1. getConfigValue

    • Purpose: Retrieves specific configuration settings.

    • Usage: Useful for obtaining configurable parameters or settings that are crucial for the test environment. The method requires the name of the configuration file and the specific key to retrieve its value.

  2. generateRandomEmailAddress

    • Purpose: Creates a random email address.

    • Usage: Ideal for tests requiring unique email addresses. This method automatically generates a new email address each time it's called.

  3. getRandomEmail

    • Purpose: Retrieves the most recently generated email address.

    • Usage: Use this method to access the email address generated by generateRandomEmailAddress. It's helpful when you need to use the same email address in multiple test steps.

  4. getRandomEmailBody

    • Purpose: Extracts a specific part of an email body based on given parameters.

    • Usage: Essential for tests that require validation or verification of certain parts of an email content. Parameters guide the method to extract the relevant segment.

  5. GENERATE_DATE

    • Purpose: Produces a formatted date based on input parameters.

    • Usage: This method is useful when tests require date values. It allows for the generation of dates in various formats and offsets.

  6. FIRST_NAME

    • Purpose: Generates a random first name.

    • Usage: Ideal for tests needing a realistic first name. Each invocation produces a new name, enhancing test variability.

  7. LAST_NAME

    • Purpose: Generates a random last name.

    • Usage: Similar to FIRST_NAME, this method is used when a random last name is needed for testing purposes.

  8. PHONE_NUMBER

    • Purpose: Creates a random phone number.

    • Usage: Useful in scenarios where phone number validation or testing is required. It generates numbers in a realistic format.

  9. ADDRESS

    • Purpose: Generates a full random address.

    • Usage: When tests require an address input, this method provides a random, yet plausible, address, adding depth to testing scenarios.

Application in Testing

These methods can be invoked within automated test scripts to provide dynamic, realistic data inputs. For example, to test a sign-up form, you can use generateRandomEmailAddress to create a new email, FIRST_NAME and LAST_NAME for the user's name, and ADDRESS for the address fields.

How to Use

The MOCK class can be integrated into automated test scripts to generate and utilize dynamic data inputs. Below is a generic example template for using these methods in a typical web form automation script:

Example Script Template:

PAGE_NAME, WAIT_TYPE, SCROLL_TYPE, ELEMENT_NAME, ACTIONS, SEND_KEYS, VALIDATION, VALIDATION_TYPE
RegistrationForm, NONE, NONE, emailField, SEND_KEYS, MOCK:generateRandomEmailAddress, NONE, NONE

Conclusion

The MOCK class is an essential tool for creating dynamic and realistic test data. Its variety of methods caters to numerous testing scenarios, making it invaluable for ensuring comprehensive and effective automated testing.

PreviousWeb Dependent Test CaseNextAutomationAsserts

Last updated 1 year ago

Was this helpful?

🌐
🐒