Skip to content

Commit 52b4658

Browse files
As per PR # 89 comments, Example Usage is updated with some reasoning on storing some values in the properties file.
1 parent 8acee67 commit 52b4658

File tree

1 file changed

+23
-19
lines changed

1 file changed

+23
-19
lines changed

docs/utility-guides/LoadProperties.md

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ The Load Properties Utility can be used to retrieve values from a properties fil
77
- [Utility Guide: Load Properties](#utility-guide-load-properties)
88
- [Table of Contents](#table-of-contents)
99
- [How This Works](#how-this-works)
10-
- [Example Usage - Properties files use key value pairs and the reason for using it is to avoid hard coded values in our tests](#example-usage---properties-files-use-key-value-pairs-and-the-reason-for-using-it-is-to-avoid-hard-coded-values-in-our-tests)
10+
- [Example Usage](#example-usage)
1111
- [Using the Load Properties Utility](#using-the-load-properties-utility)
12-
- [Example usage](#example-usage)
12+
- [Example Usage](#example-usage-1)
1313

1414
## How This Works
1515

@@ -27,21 +27,25 @@ To ensure that there are no mistakes when providing this input there are two add
2727

2828
To add values to the properties file follow the format:
2929

30-
## Example Usage - Properties files use key value pairs and the reason for using it is to avoid hard coded values in our tests
30+
## Example Usage
3131

32-
```python
33-
from utils.load_properties import PropertiesFile
34-
# Create an instance of the PropertiesFile class
35-
properties = PropertiesFile()
32+
1. Properties files use key-value pairs because they provide a simple, organized, and flexible way to store configuration data.
3633

37-
# Load smokescreen properties
38-
smokescreen_props = properties.get_smokescreen_properties()
39-
print(smokescreen_props["example_value_1"])
34+
2. Each line in the file assigns a value to a key (For example, c1_daily_invitation_rate=10). This makes it easy to look up and change values as needed.
4035

41-
# Load general properties
42-
general_props = properties.get_general_properties()
43-
print(general_props["example_value_2"])
44-
```
36+
3. Using key-value pairs in properties files helps keep your tests clean, flexible, and easy to maintain by avoiding hard-coded values in your test scripts.
37+
38+
Why avoid hard coded values in tests?
39+
40+
1. Maintainability: If we need to update a value (like a test organization ID or a rate), we only have to change it in one place—the properties file—instead of searching through all your test code.
41+
42+
2. Reusability: The same test code can be run with different data just by changing the properties file, making your tests more flexible.
43+
44+
3. Separation of Concerns: Test logic stays in your code, while test data and configuration are kept separate in the properties file.
45+
46+
4. Readability: It’s easier to see and manage all your test settings and data in one file.
47+
48+
5. Environment Flexibility: We can have different properties files for different environments (e.g., Dev, Test, Prod) without changing your test code.
4549

4650
## Using the Load Properties Utility
4751

@@ -52,11 +56,11 @@ Here there are two fixtures:
5256
1. `smokescreen_properties` - which is used to load the file: tests/smokescreen/bcss_smokescreen_tests.properties
5357
2. `get_general_properties` - which is used to load the file: tests/bcss_tests.properties
5458

55-
## Example usage
59+
## Example Usage
5660

5761
```python
58-
def test_example_1(page: Page, general_properties: dict) -> None:
59-
print(
60-
general_properties["example_value_1"]
61-
)
62+
def test_example_1(page: Page, general_properties: dict) -> None:
63+
print(
64+
general_properties["example_value_1"]
65+
)
6266
```

0 commit comments

Comments
 (0)