Parameterized unit tests is a feature of some unit testing frameworks. It supports executing a given unit test multiple times with different arguments.
Questions tagged [parameterized-unit-test]
116 questions
1
vote
0 answers
robolectric parameterized test - Array of PointF
Good day my fellow developers,
I'm trying to write a Data Driven Unit test for my VectorHelper class. Since the class works heavily on PointF objects and those objects have no implementation in android.jar on host JVM, I use so called shadowing from…

Gregory Stein
- 325
- 4
- 14
1
vote
1 answer
Parameterized testing tools with automatic code exploration
I've checked and played a bit with Microsoft Pex. It's a very handy tool/library even though it's not as straight forward to write parametrized unit tests with it. But when used correctly it can provide much better test code coverage than writing…

Robert Koritnik
- 103,639
- 52
- 277
- 404
1
vote
1 answer
how to get flexible columns with junitparams
I have this situation where I'm reading values from input file using junitparams. In some cases, my rows have values in all the columns (say 5), however, in other cases only the first few columns have values.
I want junitparams to assign value for…

Hemant
- 1,313
- 17
- 30
1
vote
1 answer
Junit runs all Test with the parameter marked with @Parameter
In the following code, I would like to run TestMethod1 with the parameters marked with @Parameters
@RunWith(Parameterized.class)
public class Foo{
private boolean input;
private boolean expected;
public Foo(boolean input, boolean…

Ronald
- 2,721
- 8
- 33
- 44
1
vote
2 answers
Smart Unit Tests standalone
I've been working with Smart Unit Tests (formerly Pex) for some time now. Pex had the ability to run as a standalone, command-line application which was really useful for several scenarios (e.g. extending the list of parameters of the Parameterized…

davidhonfi
- 31
- 6
1
vote
2 answers
Passing a thread local variable to JUnit test
I have a thread which inits a thread local class variable and starts with running unit tests:
public class FooThread extends Thread {
TestRunner runner;
Foo foo;
public void run() {
initSomeThreadLocalStuff(); // inits foo and…

Gobliins
- 3,848
- 16
- 67
- 122
1
vote
2 answers
Use different parameters for particular test
In Junit 4 parameterized testing, if I have 3 tests in test class and I want to use different parameter for particular test, how should I do it?
Lets say may 3rd test checks whether a particular exception throws. So I need to pass wrong parameters…

Darshana
- 2,462
- 6
- 28
- 54
1
vote
0 answers
Eclipse parameterized test freeze with JUnit 4.11
Configured eclipse indigo SR2 to use junit 4.11 with hamcrest-core-1.3.jar.
Whenever test is run in ide with this:
@Parameters(name = "{0}")
the JUnit console halts at zero. e.g. "0/100".
It works fine in ide without the name parameter. …

John Doe
- 1,364
- 1
- 12
- 19
1
vote
1 answer
Parameterised test in JUnit
I have a program, containing 3 parameterized methods, that receives arguments from the command line. I would like to test them and I have written a test in JUnit, by right clicking on the original class and clicking new Junit test. In the test…

newtoprogramming
- 69
- 2
- 11
1
vote
1 answer
xunit.net parameterized unit testing: Show red/green for each combination?
Parameterized Unit Testing is great when you have X unit test * Y configurations.
I have 3 unit tests, and each must run in 5 particular situations.
I use xUnit.net's Theory/PropertyData feature, it works well.
PROBLEM: In the Test Runner UI, there…

Nicolas Raoul
- 58,567
- 58
- 222
- 373
0
votes
0 answers
Mocha - How to Update parameterized test parameters from before hook
describe('', () => {
let ids = [];
before('',() => {
cypress.api('GET', 'http://localhost:3000/api/id-list').then((response) => {
response.body.foreach((id) => {
ids.push(id);
});
});
});
ids.foreach((id) => {
…

Jayanath
- 57
- 4
0
votes
1 answer
How to pass a function name in parametrize in pytest and How can i use that in testcase?
In the below script i would like to parametrize functions call RegisterClientCabinMovementDetection(x) and RegisterClientOccupantInSeatDetection(x) (made bold in script)so on... is there any way to parametrize function in pytest…
0
votes
1 answer
How do I use pytest fixture dependencies and params at the same time?
I'm trying to create a fixture that has dependencies on other fixtures and is also parameterized. Example:
@pytest.fixture(scope="module")
def fix1():
...
@pytest.fixture(scope="module", params=[False, True])
def fix2(fix1, param):
...
which…

Nima Rahnema
- 13
- 3
0
votes
1 answer
changing configuration value in spring-boot app with values of parameterized test
I use this in my MyService.kt.
The useXml is read via application.yml and application-test.yml
@Service
class MyService (
@Value("\${something.use-xml}")
var useXml: Boolean = false
) {
if(useXml) {
// do this
} else {
// do …

Joergi
- 1,527
- 3
- 39
- 82
0
votes
2 answers
How to reference an object in a class using a decorator
I have a list of dicts defined in setUpClass in a Django TestCase:
class MyTest(TestCase):
@classmethod
def setUpClass(cls):
myobj = MyModel.objects.create()
cls.MY_LIST = [
({ 'key1': {'a': myobj.id, 'b':…

alias51
- 8,178
- 22
- 94
- 166