Skip to content
This repository has been archived by the owner on Feb 25, 2022. It is now read-only.

Review and rework tests asserting is not True for exists(pattern) #3723

Open
tracywalker opened this issue Aug 22, 2019 · 0 comments
Open

Review and rework tests asserting is not True for exists(pattern) #3723

tracywalker opened this issue Aug 22, 2019 · 0 comments
Labels
ARCHIVED CLOSED at time of archiving polish Minor cleanup Test: regression Test case fix required
Milestone

Comments

@tracywalker
Copy link
Collaborator

I believe it isn't always the best practice to assert that a pattern or text does not exist. For example:

expected = exists('Mozilla', FirefoxSettings.FIREFOX_TIMEOUT)
assert expected is not True, 'Mozilla doesn't appear history.

What if 'Mozilla' exists elsewhere? Narrowing the search region is probably acceptable. Another way may be to create new pattern containing context of where 'Mozilla' exists. The assert true that that pattern exists.

Searching the code I also found at least one instance of a test that used assert is not True for exists(pattern)similar(.9) Increasing the similarity above default is certainly not good practice for asserting a pattern/text is not present as it possible to report falsely.

I'm filing this to issue to review all of the tests that are using this practice and implement a more true and reliable method. The solutions will be made on a case by case basis as I don't think this is a one-size-fits-all situation.

@tracywalker tracywalker added Test: regression Test case fix required polish Minor cleanup labels Aug 22, 2019
@tracywalker tracywalker added this to the Future milestone Aug 22, 2019
@tracywalker tracywalker self-assigned this Aug 22, 2019
@tracywalker tracywalker removed their assignment Jan 28, 2020
@cknowles-admin cknowles-admin added the ARCHIVED CLOSED at time of archiving label Feb 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
ARCHIVED CLOSED at time of archiving polish Minor cleanup Test: regression Test case fix required
Projects
None yet
Development

No branches or pull requests

2 participants