parameterized-unit-test Questions

9

Solved

Currently I have to create a parameterized test class for every method that I want to test with several different inputs. Is there a way to add this together in one file? Right now there's Calcula...
Willumsen asked 29/12, 2012 at 13:10

43

Solved

I have tried to run Parameterized Unit Tests in Android Studio, as shown below: import android.test.suitebuilder.annotation.SmallTest; import junit.framework.TestCase; import org.junit.Test; im...

8

Solved

Is there any way to use parameterized unit tests, similar to what you can achieve in .Net using NUnit framework. [TestCase(12, 3, 4)] [TestCase(12, 2, 6)] [TestCase(12, 4, 3)] public void DivideTe...
Culmiferous asked 16/2, 2016 at 19:13

2

Solved

I just want to understand what it means or what happens if I set indirect parameter to True or False in the pytest.mark.parametrize?

2

Solved

I have created a unit test project. I get an exception specifying Unable to get default constructor for class *****.Tests.Controllers.PersonRegistration namespace *****.Tests.Controllers { [Te...
Faulk asked 2/6, 2017 at 7:46

4

Solved

I have a bunch of @ParameterizedTests that receive parameters from a @MethodSource with quite verbose toString() results (e.g. Selenium's WebDriver). These are used per default to compose the corre...
Rebeca asked 11/9, 2019 at 16:4

5

I am using DUnit to test a Delphi library. I sometimes run into cases, where i write several very similar tests to check multiple inputs to a function. Is there a way to write (something resemblin...
Kickback asked 25/1, 2012 at 8:55

3

Solved

I want to parameterize my JUnit5 tests using three parameters: string, string and list<string>. No luck so far when using @CsvSource, which is the most convenient way of passing params for m...
Refugio asked 12/10, 2017 at 14:41

3

Solved

I am using JUnit 5 as my Test Runner. In the setup method, I have hardcoded 3 params (platformName, platformVersion, and deviceName). I have a test method that should test on various combinations...
Whencesoever asked 27/5, 2020 at 6:27

1

I am trying to write a test with JUnit 5 which should test multiple combinations of some parameters. Essentially I want to test some cartesian product of inputs from different sources. Consider the...
Lamee asked 25/8, 2020 at 11:35

1

Solved

I would like to be able to parameterize my tests for various types through the following code snippet: template <typename T> class MyTestSuite : public testing::TestWithParam<tuple<T, v...
Boaster asked 18/7, 2022 at 6:48

3

I'm new to JUnit testing and I would like to create a parameterized test in IntelliJ IDEA 2017.3.3. So I added JUnit 5: Then IntelliJ downloaded org.junit.jupiter:junit-jupiter-api:5.0.0. Now, @...
Ovary asked 17/1, 2018 at 18:38

3

Solved

I have an python unitest. In the setupClass method I so some timeconsuming tasks... The tests itself run very fast. Now i would like to run the same Testcase with multiple sets of parameters. How c...
Trinitrobenzene asked 3/3, 2016 at 13:47

2

I've got a boost test case. Most lines of this test case are executed regardless of the parameters. But there are parts which are executed based on the provided parameter. I want to avoid writing t...
Luanaluanda asked 7/1, 2013 at 12:19

2

I am trying to pass in an array for testing a certain algorithm, but the arrays seem to not be passed correctly or at all. I manually tested the algorithm so I know it works as it's supposed ...
Broadnax asked 22/12, 2020 at 21:36

25

Solved

I have some kind of test data and want to create a unit test for each item. My first idea was to do it like this: import unittest l = [["foo", "a", "a",], ["bar&...
Vanadinite asked 28/8, 2008 at 17:49

2

Solved

I am trying to avoid repeating too much boilerplate in my tests, and I want to rewrite them in a more structured way. Let's say that I have two different parsers that both can parse a text into a d...
Christ asked 28/4, 2020 at 12:49

6

Solved

I'm trying to parameterize this test: @Test public void reverseQuote(double[] qsp) throws Exception { ...} It seems absurd to me that it doesn't exists some quick method to initialize array qsp ...
Banner asked 14/2, 2018 at 14:56

1

Solved

Is there a way to parameterize both test class (like you could do with Parameterized and @Parameters in JUnit 4) and test methods (like you could do with JUnitParams in JUnit 4 or with @Parameteriz...
Durarte asked 21/4, 2018 at 6:6

2

Since version 3.4, Python supports a simple subtest syntax when writing unittests. A simple example could look like this: import unittest class NumbersTest(unittest.TestCase): def test_successf...
Archambault asked 10/7, 2017 at 8:37

5

Solved

NUnit supports a feature where you can specify a set of data inputs for a unit test to be run multiple times. [RowTest] [Row(1001,1,2,3)] [Row(1,1001,2,3)] [Row(1,2,1001,3)] public void SumTests(i...
Boiardo asked 2/3, 2010 at 21:44

3

Solved

One feature I've wanted to see in MSTest for a long time has been Parameterized Unit Tests (PUTs). I was excited to hear that Intellitest would be capable of creating said tests. I've started playi...

7

Solved

In our project I have several JUnit tests that e.g. take every file from a directory and run a test on it. If I implement a testEveryFileInDirectory method in the TestCase this shows up as only one...
Morman asked 11/12, 2008 at 9:39

2

Solved

I have a method which has a lot of conditions in it: public bool IsLegalSomething(Order order) { var item0 = order.Items.SingleOrDefault(x => x.ItemCode == "ItemCode0"); var item1 = order.Ite...

5

Solved

When you run a JUnit 4 ParameterizedTest with the Eclipse TestRunner, the graphical representation is rather dumb: for each test you have a node called [0], [1], etc. Is it possible give the tests ...
Swetlana asked 22/12, 2008 at 10:16

© 2022 - 2025 — McMap. All rights reserved.