9
votes
What would be the most maintainable way of defining your tests to separate them between environments (dev, test staging) using pytest?
I recommend
One set of tests
You've clearly defined a common problem that many of us face.
I have tried all of the solutions you outlined but they all seem to run into the issue of a lot of ...
3
votes
New to automation testing of APIs with Pycharm and Pytest
Testing APIs is potentially endless, just like almost anything in testing. I recommend focusing on one area rather than drowning yourself in something completely new. That would be a recipe for ...
3
votes
Accepted
Best way to architect test development in Python so that tests can be run either with a mock or without a mock?
You can create have multiple implementations of your client object.
import abc
class MyServiceClient(abc.ABC):
@abc.abstractmethod
def get_item(self, id):
pass
class ...
2
votes
Accepted
Is it possible to add specific tests to the collected tests?
You can also use x-unit style for setups and teardowns:
class TestSetupTeardownExample:
@classmethod
def setup_class(cls):
print("setup class")
@classmethod
def ...
2
votes
How to use pytest session fixture return value in a test class
If I'm not mistaken, usefixtures can't be used in this way, that is to return values to each of your test methods. You'd use this for like cleanup tasks like in the example here.
For what you're ...
2
votes
What would be the most maintainable way of defining your tests to separate them between environments (dev, test staging) using pytest?
I work in an environment where we have many environments but they're all part of a single release pipeline, i.e., features are first deployed to dev and they progress through all environments until ...
1
vote
How to correctly divide API tests into test cases
These are good questions to have, especially while you are learning.
Is this the correct way to do it?
No. I mean, it's fine to get something working quickly, but you should utilize a test library and ...
1
vote
How to share an allure report over email
You can use your build tools to save the generated report on the cloud, allowing you to share a link.
E.g. this Jenkins plugin enables you to save the report as an artefact. Then you can simply give ...
1
vote
AttributeError: 'TestOne' object has no attribute 'driver'
self.driver
means driver of this object and your code cannot find any variable called driver for that object instance.
There is no instance variable driver:
def test_e2e(self):
action = ...
1
vote
How to do ETL Automation Testing using C# or Python
When I first started out in Technical Operations I would run SQL scripts to verify the ETL processes we had running. Now that I had experience in SQA I would more likely write some unit tests so its ...
1
vote
Accepted
Sticking to DRY when fixtures and test cases overlap
I'd also take into account how much code the "creating new user" part is. In pytest/Python, it really boils down to just one line of code, something like:
response = requests.post(f"{...
1
vote
Accepted
Is there any posibillity to run test in specific order with pytest bdd
This is a common trap people fall into when writing behavior driven tests. You do not want to run entire scenarios as a prerequisite. Instead, you need to write one or more Given steps that simulate ...
1
vote
Accepted
How can I improve this python pytest excel data handling code? Does pytest have something like TestNG dataprovider?
You've probably figured this out already, since you posted the question two months ago. But just in case, and for the benefit of anyone else who has the same question...
PyTest's approach to ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
pytest × 23python × 15
automated-testing × 11
selenium-webdriver × 6
api-testing × 3
unit-tests × 2
bdd × 2
allure × 2
manual-testing × 1
test-management × 1
test-design × 1
browser-automation × 1
appium × 1
chromedriver × 1
mobile-automation × 1
test-strategy × 1
api × 1
data-driven × 1
assert × 1
mock × 1
gherkin × 1
etl × 1
playwright × 1