Questions tagged [parameterized-unit-test]

Parameterized unit tests is a feature of some unit testing frameworks. It supports executing a given unit test multiple times with different arguments.

116 questions
0
votes
1 answer

Apply different decorators based on a condition

I'm using unittest and nose-parametarized, and want to apply different decorators to a test based on a condition. I have a test and I want to skip unittest.skip the test or execute it @parameterized.expand(args)based on the arguments passed to…
0
votes
1 answer

IllegalArgumentException in parameterized test class

I have a parametric test class, and I have a test method which I am expected to return IllegalArgumentException. @RunWith(value = Parameterized.class) public class TriangleParametrizedTest { @Rule public ExpectedException exception =…
0
votes
0 answers

nunit-console /runlist does not run certain test's in a list containing parameterized test cases

When running from Powershell with the following command & "c:\Program Files (x86)\Nunit 2.6.4\bin\nunit-console.exe" /runlist=C:.....\ReRunTests.txt "C:.....\bin\debug\Web.Test.UI.dll" and the following run…
0
votes
2 answers

JUnit: inject @Parameterized parameters?

What's the easiest way of injecting a set of parameters to a @Parameterized test class? Use case: I have a regular class that looks like this @RunWith(Parameterized.class) class Tests { public void testOne() { } public void testTwo() { } …
Christian Neverdal
  • 5,655
  • 6
  • 38
  • 93
0
votes
1 answer

Failed TestNG tests with DataProvider in IntelliJ IDEA

i recently started playing around with tdd and ran into a problem where i do not understand why one thing is working and the other one doesnt. the following code works for me: public class Ant { public Ant(Point startLocation, Point hive) { …
0
votes
1 answer

JUnit - Looping test cases and comparing the results

I am learning JUnit and I have to test a method multiple times. I have to test the method based on two parameters (Environment and Case#). I am working on two environments where I have to check if the same Case# yields the same results between…
dmachop
  • 824
  • 1
  • 21
  • 39
0
votes
2 answers

Parametrized JUnit: Loading multiple property files from String array

I am trying to write a test that loads different properties files from String array. But the code keeps throwing a null pointer exception, any ideas please? @RunWith(value = Parameterized.class) public class AllTests { private static String…
David Cunningham
  • 957
  • 2
  • 12
  • 22
-1
votes
1 answer

Reuse JUnit 5 @ArgumentsSource Parameterized test class across different java projects

I have below maven java projects: com.validator com.demoModel1 com.demoModel2 Validator project contains the validation code and the jar is used by demoModel1 and demoModel2 projects to perform validation. To perform validation, in demoModel1 and…
Priom Biswas
  • 85
  • 2
  • 12
-1
votes
1 answer

Exception on running parameterized test with junit5

I am getting Junit Vintage initialize error when trying to integrate parameterized test with spring boot app. Any pointers on resolving this issue? @ParameterizedTest(name="Run {index}: loanAmount={0}, downPayment={1}, availableFunds={2},…
Minisha
  • 2,117
  • 2
  • 25
  • 56
-1
votes
2 answers

How to pass testCase value to next one with Pytest

import pytest def add(x): return x + 1 def sub(x): return x - 1 testData1 = [1, 2] testData2 = [3] class Test_math(object): @pytest.mark.parametrize('n', testData1) def test_add(self, n): result = add(n) …
Chweng Mega
  • 1,598
  • 1
  • 13
  • 22
-1
votes
1 answer

JUnit 5 and multiple input data (Java)

How to use JUnit 5 to run series of tests of a computation, each for a different pair of input data and benchmark output? Condition: the computation should be performed only once per input and not for every test separately as it is…
Mateusz
  • 39
  • 2
1 2 3 4 5 6 7
8