18.4 C
New York
Monday, March 10, 2025

python – Automated assessments are failing when ran collectively however move when are ran individually


I am utilizing Python+pytest and Helium to create my assessments.
Every time I run a take a look at individually, it really works 100% of instances. Nonetheless, if I attempt to run greater than 5-6 assessments collectively, some are failing, some are passing. The errors are random and by no means the identical(from “LookUp” errors to “NoSuchWindowException” and different). I already checked the solutions from comparable questions requested:

  • no preconditions are altered
  • no dependencies between my assessments
  • no alteration of information that’s utilized in one other take a look at
  • i am not utilizing xdist, I’m solely attempting to run them sequentially
  • I created completely different buildings and organized the assessments in a number of methods attempting to slender down if a standard component exists – nothing confirmed up. It doesn’t matter what I embody or exclude, simply after I attempt to run 5+ assessments, this behaviour is reproduced.
    I am at all times beginning the assessments with start_chrome(URL) and finish them with kill_browser().
    My finest guess is that one way or the other, within the background, the cases are overlapping or one thing just like this, however I don’t know the place to begin the debug course of.

I am fairly new to this, any assistance is welcomed.
I am operating my assessments utilizing python3 -m pytest.
Right here is my pip listing output if it helps:

attrs        21.4.0
chromedriver 2.24.1
distlib      0.3.4
filelock     3.6.0
helium       3.0.8
iniconfig    1.1.1
packaging    21.3
pip          21.2.4
platformdirs 2.5.1
pluggy       1.0.0
py           1.11.0
pyparsing    3.0.7
pytest       7.1.1
selenium     3.141.0
setuptools   58.1.0
six          1.16.0
tomli        2.0.1
urllib3      1.26.9
virtualenv   20.13.4

Edit per remark:
listed here are a few of the errors:

- AttributeError: module 'locators' has no attribute 'checkbox_terms_and_conditions'
- AttributeError: module 'locators' has no attribute ‘set_date’
- motion = . at 0x7f80dcba6ee0>
- 
-     def carry out(self, motion):
-       from helium import Config
-       end_time = time() + Config.implicit_wait_secs
-       # Attempt to carry out `motion` at the least as soon as:
-       consequence = self._perform_no_wait(motion)
-       whereas result's None and time() < end_time:
-           consequence = self._perform_no_wait(motion)
-       if consequence shouldn't be None:
-           return consequence
- >     elevate LookupError()
- E    LookupError

Please be aware that every 2 runs have completely different errors, largely LookUpError, NoSuchWindow,or AttributeError for locators file.

in my assessments, I take advantage of an import assertion for the file that incorporates my net components locators, like ids, css class, xpath and so forth.
every folder of assessments has its personal “locators” file. I’m unsure if that is the perfect methodology, any assistance is welcomed; thanks.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles