Skip to main content
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 ...
Michael Durrant's user avatar
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 ...
pavelsaman's user avatar
  • 4,548
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 ...
João Farias's user avatar
  • 10.9k
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 ...
pavelsaman's user avatar
  • 4,548
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 ...
pavelsaman's user avatar
  • 4,548
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 ...
Brendon Robey's user avatar
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 ...
Lee Jensen's user avatar
  • 2,240
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 ...
João Farias's user avatar
  • 10.9k
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 = ...
PDHide's user avatar
  • 11.1k
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 ...
kirbycope's user avatar
  • 4,090
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"{...
pavelsaman's user avatar
  • 4,548
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 ...
Greg Burghardt's user avatar
1 vote

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

You can make something like this: File: conftest.py option = None def pytest_addoption(parser): parser.addoption("--arg", action="store", default="example", help="Option for making some stuff") ...
Davit's user avatar
  • 45
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 ...
Todd Bradley's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible