Global Properties in ACCELQ play a vital role in managing data that is consistent across multiple Actions and Scenarios within a project. They provide a centralized mechanism for defining and maintaining project-level values, ensuring test automation remains clean, flexible, and easy to update.
What are Global Properties
Global Properties are project-level variables that can be used across all Actions and Scenarios in ACCELQ. These properties are ideal for storing relatively static application-level data, such as:
- Application URLs
- Port numbers
- Common login credentials (e.g., admin username and password)
Although these values may occasionally change, they are relatively static.
Key Features of Global Properties
-
Centralized Management
Global Properties are managed under the Resources section in ACCELQ. This centralization ensures clean Action logic and simplifies updates. -
Environment-Specific Values
If application environments are enabled in Project Configuration, Global Properties can hold different values for each environment. For example, the "Application URL" may vary between development, staging, and production environments. -
Reusability Across the Project
These properties can be shared and reused across all Actions and Scenarios, eliminating the need to repeatedly define the same data.
How to create and manage Global Properties
-
Accessing Global Properties
Navigate to the Resources section in ACCELQ to view and manage Global Properties. -
Creating a New Global Property
- Click on the Add Property button.
- Define a name and indicate if the property is specific to the Application Environments.
- Define value(s) for the property.
-
Importing Properties
You can import multiple properties at once from an Excel or CSV file, saving time and ensuring consistency. The system offers to download a template file during the import process. -
Updating Values
Changes to Global Property values are instantly reflected wherever they are used, ensuring seamless updates across the project.
Note: Global Properties can also be created inline during the primary use cases in Action logic statement creation and Scenario parameter overriding.
Using Global Properties
1. In Action Logic
Global Properties can be directly referenced in Action logic to simplify code and avoid hardcoding.
Example:
In your Action logic, suppose you need to read data from an Account Information Excel file located at a specific file path that is relatively static. Instead of hardcoding the file name and path, you can define a Global Property and use it in the Action logic.
Get text from row number '1', column number '2' in Excel file: [G]'Account Information Excel File'
This ensures that if the file path ever changes, you only need to update the Global Property without modifying the Action logic.
2. For Parameter Overriding in Scenarios
Global Properties can override step parameters in Scenarios, ensuring consistent and fixed values for a parameter across test cases when required.
Example:
For an HRMS application, a test Scenario verifies employee records. The admin credentials used for login remain the same for all test cases. Here, you can override the "username" and "password" parameters of the Login step with Global Properties:
This approach centralizes credential management and reduces redundancy by avoiding typing the same values in all the test cases of this Scenario.
Learn more about parameter overriding.
When to Use Global Properties
- Static but Occasionally Changing Data: Use Global Properties for relatively fixed values like URLs, port numbers, or common credentials.
- Consistent Values Across Environments: Leverage environment-specific configurations for properties like database connections or API endpoints.
Best Practices
-
Avoid Hardcoding
Always use Global Properties to define reusable data instead of hardcoding values directly in Action logic or Scenarios. This data may still change occasionally, but easy to update centrally. -
Enable Application Environments
Define separate values for each environment to maintain flexibility when switching your test execution between environments during automation test runs. -
Use Descriptive Names
Choose intuitive names for Global Properties to improve readability and maintainability, such asApplication URL
,Admin Username
, orDatabase Port
. You can use spaces in property names for better readability. -
Leverage Import/Export
Use the import/export feature to manage large sets of properties efficiently, ensuring consistency across projects.
Comments
0 comments
Article is closed for comments.