Questions tagged [parameterized-tests]

55 questions
3
votes
1 answer

Using pytest on ranges of many parameters

Let's say I have a Simulation object whose core attribute is a dictionary of parameters that takes something like the following form: @pytest.fixture def param_base(): '''Dict of parameter defaults''' return { "fs" : 2e4, …
user3088305
  • 41
  • 1
  • 3
3
votes
1 answer

pytest parameterize - row from CSV as a testcase

I have to read a CSV file and for each combination in each row need to run some methods.I would like to see each row as a test case. Is it possible to send row as a param - pytest parameterize my test case? Can you please give me some idea on how to…
user3116988
  • 43
  • 1
  • 4
2
votes
1 answer

PyTest Parametrized Test in order

I have 2 pyTest test cases that take a parameter. I want to run them in order with both params, instead of the first test running with all possible values, and then the 2nd test starting. Consider the below test code: import…
Anchit Arnav
  • 371
  • 2
  • 7
2
votes
1 answer

Parameterized Test in Kotlin usign mehtod source for nested test class

I may use case the class under test has many cases so it is divided into a structure of inner classes. I want to write parameterized test cases to reduce boiler plate and code duplication. For this I wanted to go with the approach of method…
Varun Yadav
  • 142
  • 1
  • 6
2
votes
1 answer

Does Robot Framework support Gherkin data tables?

How can I implement Gherkin data tables in Robot Framework? The following snippet should pass two sets of (n, is_prime) parameters to Keywords in order to verify that: is_prime(5) = True is_prime(6) = False *** Test Cases *** Function should verify…
taggore
  • 33
  • 1
  • 5
2
votes
1 answer

Why is IllegalArgumentException thrown for a Parameterized JUnit test when given List>, but works with List>

While debugging a Parameterized test, I realized the test wouldn't run if the parameters were passed as a List of Lists (List>), yet worked fine with a List of Arrays (List>). Example classes: import…
Shalbert
  • 1,044
  • 11
  • 17
2
votes
2 answers

How to read/write from/to an excel using NodeJS - Protractor?

Might be a basic question. But since I am new to protractor, I definitely need some help! How to read/write from/to an excel using NodeJS - Protractor? Can someone explain with an example? My intention is to Parameterize my scripts using NodeJS -…
2
votes
0 answers

Is there any way to access the current test's parameters (apart from the parameters themselves)?

If I write a parameterized NUnit test, using something like [TestCaseSource] or [ValueSource], NUnit will pass the parameters directly to my test method. But is there any other way to access those parameters, e.g. from SetUp, or from a helper method…
Joe White
  • 94,807
  • 60
  • 220
  • 330
1
vote
1 answer

Junit5 Parameterized Test LifeCycle. why @BeforeAll and static block run after all the tests

I am posting a simple code below, why does @BeforeAll annotated method and static block run after the Parameterized tests? How do I register a common object or Database connection in this case before loading the Parameterized test in Junit5 or…
1
vote
1 answer

JUNIT @ParameterizedTest , Parameter resolution Exception

Eclipse Version - 4.19.0 Maven Version - 3.8.1 In JUnit I am trying to implement @ParameterizedTest using @CsvSource or @MethodSource. Both are failing due to org.junit.jupiter.api.extension.ParameterResolutionException: Can someone please help as…
Jay
  • 339
  • 1
  • 7
  • 23
1
vote
1 answer

JUnit5 - how to pass input collection to ParameterizedTest

I'm trying to translate a ParameterizedTest from JUnit4 to JUnit5 (sadly I'm not particularly skilled in testing). In JUnit4 I have the following class: @RunWith(Parameterized.class) public class AssertionTestCase { private final TestInput…
Akinn
  • 1,896
  • 4
  • 23
  • 36
1
vote
1 answer

How do I pass a parameterized value to a pytest fixture?

I'm using pytest to run tests, each with a unique account ID. Each test function requires some setup and teardown, and I switched to using fixtures according to previous suggestions. But now I need to use the unique account ID associated with each…
1
vote
0 answers

Mockito Junit jupiter api not resolving the parameter JsonObject

Inorder to get multiple values for test case from JSON file, added the annotation @jsonfilesource and passed JSONObject as parameter to the method in Mockito framework. But I am getting below…
priya
  • 21
  • 2
1
vote
2 answers

Is it possible to write parameterized android espresso UI test?

When writing android espresso UI test, is it possible to write parameterized test which accepts data from two different json files to add list of items inside the app? I have seen parameterized tests that take two files and run same test code for…
1
vote
2 answers

Checking exceptions with TestCaseData parameters

I'm using NUnit 3 TestCaseData objects to feed test data to tests and Fluent Assertions library to check exceptions thrown. Typically my TestCaseData object contains two parameters param1 and param2 used to create an instance of some object within…
YMM
  • 632
  • 1
  • 10
  • 21