For the complete documentation index, see llms.txt. This page is also available as Markdown.

Object Parameterization in WalnutAI

Object Parameterization in WalnutAI allows you to replace hardcoded object values within a test step with dynamic parameters. This makes the same object reusable across different test steps, datasets, and execution scenarios without modifying the underlying test logic.

Instead of defining fixed values such as usernames, email addresses, account numbers, or search terms directly in an object, you can associate the object with a parameter. The parameter can then be assigned the required value, allowing the same object to be used with different values whenever needed.

Key Benefits of Object Parameterization

  • Scalability: Reuse the same locator across different test cases.

  • Flexibility: Handle dynamic elements without modifying test scripts.

  • Efficiency: Reduce maintenance efforts when UI changes.

  • Data-Driven Testing: Easily integrate with different datasets.

1. Creating a Parameter from the Parameter Section

You can create a parameter from the Parameter section of a test case and then associate it with the required object.

  • Open the required test case.

  • Navigate to the Parameter section.

  • Create a new parameter and enter the following details:

    • Parameter Name: A descriptive name for the parameter, such as Email.

    • Parameter Key: A unique key used to reference the parameter in a test step, such as email.

    • Description: A brief description explaining the purpose of the parameter, such as Email address used for login or user identification.

  • Click Create Parameter to create the parameter.

The newly created parameter will appear in the Parameter section. Based on the parameter type Local, Global, or Runtime, its availability and value handling will differ. The parameter will be reflected in the Test Data section only after it is used in a test step.

2. Parameterizing an Object Directly from a Test Step

You can also parameterize an object directly while editing a test step.

  • Select the required test step.

  • Click the Object icon.

  • Identify the hardcoded value in the object.

For example, if the object locator contains:

//input[@placeholder='admin@example.com']

  • Replace the hardcoded value with the parameter name you want to create.

Replace the hardcoded value with the parameter:

//input[@placeholder='${Email}']

  • Save the step.

Understanding Local, Global, and Runtime Parameters

The value requirement depends on the parameter type:

  • Local Parameter: The parameter is specific to the current test case. A value must be provided for the local parameter within the test case.

  • Global Parameter: The parameter can be reused across multiple test cases. When creating a global parameter, make sure to provide its value

  • Runtime Parameter: The parameter can be reused across multiple test cases without providing a value when it is created.

Last updated