Questions tagged [parametrized-testing]

91 questions
0
votes
1 answer

Combine TestCaseAttribute and ValuesAttribute NUnit C#

I need to do something like this: [TestCase(1, 0, TestName = "Small values")] [TestCase(int.MaxValue, 0, TestName = "Big precision value")] [TestCase(int.MaxValue, int.MaxValue - 1, TestName = "Big precision and scale values")] public void…
Defalt
  • 1
0
votes
1 answer

jenkins test reports isn't contain Junit ParamterizedTest

I want to monitor the execution time of my test in Jenkins. but the report just contains any test with test annotation not, @ParameterizedTest. how can I see the execution time of @ParameterizedTest in the Jenkins
farhad
  • 373
  • 2
  • 14
  • 28
0
votes
0 answers

Pytest parametrize + Fixtures

I am using fixtures to mock my requests. I am also using @pytest.mark.parametrize() to add arguments to my tests. I can do this: def test_format(mock_api): I can do this: @pytest.mark.parametrize( "format", [ ("xxx"), …
Nadhem Maaloul
  • 433
  • 5
  • 11
0
votes
1 answer

How can I parametrize a pytest fixture with command line arguments?

I need to get arguments from command line and use them for fixture parametrizing (I need to pass them to fixture decorator). pytest_addoption can get arguments from cmd, but I can extract them only inside of some fixture, because I need request…
0
votes
1 answer

How to parametrize fixture before some test?

from pytest import fixture @fixture def env(): return {"key1": "value1", "key2": "value2"} def do_work(env): print("working") def test_0(env): do_work(env) def test_1(env): env["key1"] = "new_value1" do_work(env) def…
mouse_00
  • 593
  • 3
  • 13
0
votes
1 answer

Parametrizing with class method, then calling that method with object

(pseudo-code) I have class Node with properties: class Node(WebElement): def __init__(self, element): super().__init__(element) ... @property def name(self): @property def node_id(self): …
user2678074
  • 768
  • 3
  • 9
  • 22
0
votes
0 answers

Pytest parametrize passing function name as a parameter

I am trying to get function name as a parameter in pytest parametrize but getting the error 'str' object is not callable since it passes as a string. @pytest.fixture(autouse=True) def mock_something(mocker, function_name, value): return…
seaque
  • 43
  • 7
0
votes
0 answers

pytest.parametrize get pytest.fixture function instead of the actual object

Let's just say I have an object(XList) that will check it's input data type, like the following class B(A): pass class C(A): pass class XList: def __init__(self, x: List): self.data = [] for _x in x: if not…
0
votes
0 answers

How to execute fixture in pytest before calculate argvalues?

I need to create db in fixture, do some manipulation with data (pass this part in code to simplify) in this db and use rows from this db as values for parameterized tests. But i couldn't force pytest execute fixture with creating db before executing…
Nikita
  • 1
  • 2
0
votes
1 answer

Difference between `scope` in `fixture` and `scope` in `parametrize` when using indirect parametrization

I want to use indirect parametrization as shown in this answer and in pytest documentation. I want to be able to set scope to be able to configure if fixture is run for every function or once for many of them. However I see that I can set scope on…
Karol Zlot
  • 2,887
  • 2
  • 20
  • 37
0
votes
1 answer

JUnit - Parameterized Test - Stopping compiling

Code that I writed below stopping compliling before contructor or @Before (depend of hiding). There is no errors and It can't run even one time. I did it with tutorial: https://www.tutorialspoint.com/junit/junit_parameterized_test.htm Can somebody…
0
votes
1 answer

PyTest: How to get list of parametrized arguments from within the function

Given a test function that has both fixtures and parametrized arguments, how to get a dict of parametrized arguments together with their values? I can access serialized list of values with request.node.name or os.environ.get('PYTEST_CURRENT_TEST'),…
Viacheslav Kroilov
  • 1,561
  • 1
  • 12
  • 23
0
votes
0 answers

JUnit parametrized in Before method executes later and throws ParameterResolutionException

I have test class that consists of @Before method with some parameters, and other test methods. @Before @ParameterizedTest @ValueSource(strings = {"123", "456"}) public void createData(String userId)…
jacob1989
  • 15
  • 3
0
votes
1 answer

pytest mock patch side_effect not iterate when used together with pytest.mark.parametrize

I have the below pytest script and the side_effect value [2, 6] is not getting iterated. It is always stuck with value 2 in the test function test_my_function. My question is: How to make the side_effect value iterate together with parametrize test…
Xianlin
  • 1,139
  • 5
  • 20
  • 34
0
votes
0 answers

How to change order of parametrize stacking in pytest classes?

I have a test class that has one parametrized class and some tests inside of it, that each have their own parametrize method. I want the class to run all tests inside of it with one class parameter and only after all tests have finished, run the…
rjs325
  • 1