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

JUnit 5 Parameterized test @ArgumentsSource parameters not loading

I have created below JUnit5 parameterized test with ArgumentsSource for loading arguments for the test: public class DemoModelValidationTest { public ParamsProvider paramsProvider; public DemoModelValidationTest () { try { …
0
votes
1 answer

Simple way to have two values as ValueSource for Junit5 ParameterizedTest

I have many boolean methods like boolean isPalindrome(String txt) to test. At the moment I test each of these methods with two parameterised tests, one for true results and one for false results: @ParameterizedTest @ValueSource(strings = {…
halloleo
  • 9,216
  • 13
  • 64
  • 122
0
votes
1 answer

JUnit Testing:How to write parameterized test cases for a program to find the area of a circle using JUnit 4?

The problem is my input to the program is of integer data type and the output is of double data type.So,while writing parameterized JUnit test cases,assertEquals gets striked off automatically...showing 2 errors. They are as follows: -The method…
0
votes
1 answer

How can I use return of fixture function and data which will be used as parameterized in pytest test case

I get some parameters from command lines. Then I want to use these parameters as variables in test cases. I want to use parametrised test in same test case. Is it correct to run it as below? conftest.py import pytest def pytest_adoption(parser): …
ibra
  • 11
  • 2
0
votes
1 answer

Patch + Parametrize unittest Python

I am trying to parametrize unit tests in Python using parameterize library and unittest framework. I need to patch certain functions and I use the following which works @parameterized.expand([ [a1, b1], [a2,…
Ajx
  • 53
  • 1
  • 5
0
votes
1 answer

JUnit4 - Parameterized test extends parameterized base class - need Cartesian product of them

MyBaseIntegrationTestCase is a class, which is a parent for ~ 150 test classes. Now, I want to make MyBaseIntegrationTestCase parameterized (parameter is version of external software) So, I change it to smth like @RunWith(Parameterized.class) public…
0
votes
0 answers

Parameterized test doesn't work in parallel execution

I try to run my tests with jUnit5 annotation @ParametrizedTest in parallel execution, but it's not work. public class Simple { @Inject private WebSteps WebSteps; @Inject private DbSteps dbSteps; private void func(String string) { final Phone…
0
votes
0 answers

Some Junit5 test codes are not run

I am developing an android with Junit5 and Mockito. Some tests are ParameterizedTest and others are just Test. Here is my sample code. When I run this test, only "ParameterizedTests" run. "JustTests" is not shown on the JUnit test console list. How…
yoonhok
  • 2,575
  • 2
  • 30
  • 58
0
votes
1 answer

parameterized test constructor of junit java error message: Test class should have exactly one public zero-argument constructor

I can really use some help with this parameterized test case I am trying to create. No matter what kind of constructor I create the IDE gives an error message. Here is my code: @RunWith(Parameterized.class) public class SolverTest { final static…
0
votes
1 answer

How do I include/exclude a JUnit 5 `ParameterizedTest` by name in Maven

I have a parameterized JUnit 5 test, e.g. @EnumSource(Mode.class) @ParameterizedTest void shouldRunWithMode(Mode mode) { ... I want to exclude one of the enum cases from running in Maven, as described here:
0
votes
1 answer

Python 2.6 Unittest assistance with parameters and argparse, how to solve?

I am trying to run a basic unit test on Python 2.6 that takes arguments with argparse. I am limited in my environment and cannot install any further libraries or use any modules for testing but unittest. However I believe the answer lies here: How…
0
votes
1 answer

parameterizing pytest tests with fixtures and a command line argument

Trying to take a command line argument (table_name) into pytest (via conftest.py, see below) and use that argument in a helper method to make a query in a DB, and then use query results to create parameterized test inputs using…
0
votes
3 answers

Test with different parameters

I have following scenarios to Test. I would like to know which Testing framework will best fit to my requirement. Scenario 1) Param1, Param2, Param3, Param4, Param5 I will pass above parameters with parameter Number 1, 2, 3.. till 20. With each…
Ragini
  • 1,509
  • 7
  • 28
  • 42
0
votes
2 answers

How can I invoke a JUnit Parametrized test runner on a collection of generic types?

So I am trying to invoke the JUnit Parameterized test runner on a load of individual generic typed objects. The specific classes to be used are known to descendant classes. Originally I managed to get a method which returns a Collection for JUnit…
Adam Burley
  • 5,551
  • 4
  • 51
  • 72
0
votes
1 answer

Using the output of a [ValueSourceAttribute] Nunit Test in the following Test

I am developing a unit test project where I create an item in a test, then create sub items for it in the following test. These tests are parameterized tests, and these parameters are collected in the runtime, so when the project starts it starts.…