Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [pytest]

Pytest is a framework for writing unit tests for Python code. More information is available at docs.pytest.org.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
35 views

Unit Test Guidance for Selenium Web Scraping

I'm working through https://www.obeythetestinggoat.com/ and trying to connect the concepts to a program I'm writing. Specifically, I want to write some unit tests, but I'm having trouble thinking of ...
SwabianOrtolan's user avatar
0 votes
2 answers
65 views

How to correctly divide API tests into test cases

I'm practicing API testing and I'm wondering what the correct approach to dividing tests into test cases is. For example, GET gives me a JSON which is a list of items and I want to check a few things ...
eilchner's user avatar
2 votes
0 answers
94 views

In a BDD test, should Given set a state and verify it?

Okay, so I'm writing some BDD tests for a REST API using pytest-bdd. Let's suppose I have endpoints A, B, C and D. Normally, when someone uses this API, a request is first done to endpoint A, then if ...
joliver's user avatar
  • 23
1 vote
0 answers
629 views

How can I run test cases implementing Pytest, Playwright and Gherkin Features with Python?

I'm doing an end-to-end test automation project in which I simply login to a specific page. To do this, I use Python 3.10, Pytest, Playwright and Allure to report. In my implementation file of my ...
VSacudato's user avatar
-1 votes
1 answer
185 views

Unable to assert span content properly with Selenium and pytest

I want to check if a span element contains a certain text. It normally contains more text than I search for. That is what I do at the moment: assert self.driver.find_element_by_xpath("//td[@id='...
Hackerman's user avatar
0 votes
1 answer
3k views

How to share an allure report over email

I have developed an automation framework using Selenium and pytest. Allure is the reporting tool used in the framework. Can anyone please help me to know how an allure report can be shared? Are there ...
Aish's user avatar
  • 11
2 votes
1 answer
4k views

Automated tests are failing when ran together but pass when are ran individually

I'm using Python+pytest and Helium to create my tests. Each time I run a test individually, it works 100% of times. However, if I try to run more than 5-6 tests together, some are failing, some are ...
Johnny's user avatar
  • 21
0 votes
0 answers
476 views

Test execution gets stopped after an assertion error using Pytest

For the data driven testing, if there are 10 data sets, and the assertion fails for 3rd data set, then the rest of the 7 data sets are not considered for execution and the program gets stopped at that ...
user51563's user avatar
1 vote
2 answers
654 views

New to automation testing of APIs with Pycharm and Pytest

We are moving all manual testers to automation. I am very familiar with 'concepts' but really need a beginners step into automation for new API Service and endpoints. The developer is coding a new ...
Zenobia Bomani's user avatar
0 votes
3 answers
8k views

AttributeError: 'TestOne' object has no attribute 'driver'

When I run my script it gives me this error, CONSOLE ERROR : "C:\Users\LENOVO L540\PycharmProjects\easyNeasypytest\venv\Scripts\python.exe" "C:\Program Files\JetBrains\PyCharm Community ...
Arslan Hassan's user avatar
7 votes
2 answers
820 views

What would be the most maintainable way of defining your tests to separate them between environments (dev, test staging) using pytest?

Currently you have a large test-suite in the scale of hundreds of test cases which is getting bigger every day The requirement from the rest of the team members is simple: Let us execute tests on Dev, ...
George Pligoropoulos's user avatar
-1 votes
1 answer
752 views

How to do ETL Automation Testing using C# or Python

In my present project I m testing on reports which needs to be checked everyday manually by executing SQL queries for all columns from source tables, Dims and Facts tables and destination tables. Is ...
user46586's user avatar
3 votes
1 answer
4k views

How to use pytest session fixture return value in a test class

I am creating automation framework where in few parameters I have kept in a separate JSON file. I have written the below fixture which would load the data from the JSON file in conftest.py. import ...
Pypal's user avatar
  • 31
1 vote
1 answer
100 views

Sticking to DRY when fixtures and test cases overlap

I'm looking for a way to structure tests from simpler to more complex and at the same time stick to the DRY principle. Here is an example that might clarify things better. I'll use some pseudo code to ...
TheMeaningfulEngineer's user avatar
1 vote
2 answers
298 views

Best way to architect test development in Python so that tests can be run either with a mock or without a mock?

I'm starting a fresh python project and I want to write unit and integration tests with mocking and stubbing. However, I would like to run these tests during the build-pipeline against actual services ...
rrlamichhane's user avatar
2 votes
2 answers
114 views

Is it possible to add specific tests to the collected tests?

I'm using pytest with Appium for mobile testing. I have multiple test cases and scenarios, and all of them must start with the same specific test steps. I don't want to write this steps in all other ...
Davit's user avatar
  • 45
1 vote
0 answers
2k views

pytest one time teardown after all tests in all modules have run

I have a directory with a bunch of modules. Each module has a bunch of specific tests. I know how to teardown after methods, classes and modules. What am trying to do is teardown after all the tests ...
Aziz's user avatar
  • 161
1 vote
1 answer
1k views

Is there any posibillity to run test in specific order with pytest bdd

For mobile testing automation I'm using appium, pytest-bdd and allure. Application has multiple functions. To use it user must be logged in. Process to test is next: Scenario to authenticate - 2 ...
Davit's user avatar
  • 45
1 vote
1 answer
4k views

Is there a way in PyTest to pass command line arguments to conftest.py directly?

I know that there is a way to pass args in tests itself like it was shown here, but is there a way to pass in conftest.py directly? I want to configure some common stuff for all tests this way.
user42728's user avatar
0 votes
0 answers
250 views

Problem with parallel testing (POM, python, selenium, pytest)

I have a dir named PageObjects, there is a file Login.py. It stocks all the locators of elements plus functions that I call in test cases. It looks like this: class Login: # Locators of all ...
rodut's user avatar
  • 197
1 vote
0 answers
100 views

Issue with parallel testing in pytest

So I have two test cases in a map. From command prompt I type "pytest -n 2" then hit Enter. Instead of opening two browsers and execute them in parallel, pytest is opening 4 browsers, but only two of ...
rodut's user avatar
  • 197
0 votes
1 answer
2k views

How can I improve this python pytest excel data handling code? Does pytest have something like TestNG dataprovider?

Does Python Pytest have anything similiar to Java TestNG DataProvider where you can pass in a set of data for the tests? I created something to take the data from my excel list using openpyxl and it ...
seleniumappiumnewbie's user avatar
-1 votes
1 answer
415 views

Mac + PyCharm + Python 2.7: ImportError: No module named appium

I just changed PyCharm application from Professional to community and in my v first run I am getting below error. Prior this all tests was working correctly as expected: ImportError while importing ...
Narendra Chandratre's user avatar