Skip to content

Commit ad79de6

Browse files
Readme update
1 parent 74834ed commit ad79de6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,22 @@ Img.is_equal_with_tolerance("Naresh", "downloaded_file", 0.5)
307307
```
308308
The above code will validate the images with 0.5 percent tolerance level.
309309

310+
### Detailing the snap mode
311+
312+
By following the above mentioned folder structure and code format, the snap mode implementation becomes easier. Consider we have a test data YAML file with multiple keys in it. If we run the suite in snap mode, the values for the keys will be changed only for the cases for which test cases are failing, remaining values will be retained in the YAML file.
313+
314+
In case of Image comparison, if snap mode is invoked and the image files are not same, the source image file will be replaced with the downloaded file.
315+
316+
**Incase if we use custom markers in the test data file ($notnull, $string, etc.,), on using snap mode, all the markers will be overridden by the response values. Hence it is recommended to distinguish between the test cases with custom pytest markers**
317+
318+
Have two markers, `snap` and `plain` and all the snap marked test cases should not carry any custom markers in the test data file and all the plain marked test cases should have custom marked test data files. While invoking the snap mode one has to run using the snap marker.
319+
320+
```
321+
snap=1 pytest -v -m snap
322+
```
323+
This will ensure all the custom created markers are retained in the test data files.
324+
325+
**It seems possible to handle the above shortcomings of snap mode in the json validation, which I have in todo pipeline**
310326

311327
## Data sets:
312328

Tests/test_sample.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_sample_get_request_002():
2929
@allure.feature("Sample get request with image URL")
3030
@allure.severity('Critical')
3131
@pytest.mark.regression # Custom pytest marker to run the test cases with ease on demand
32-
@pytest.mark.plain # Custom pytest marker to run the test cases with ease on demand
32+
@pytest.mark.snap # Custom pytest marker to run the test cases with ease on demand
3333
def test_sample_get_request_003():
3434
Api.get("/image")
3535
Api.verify_response_code(200)

0 commit comments

Comments
 (0)