Questions tagged [parameterized-tests]

55 questions
48
votes
5 answers

jasmine parameterized unit test

Okay as a C# NUnit guy this might be odd. But does jasmine allow parameterized unit test? I am not sure if it goes against the "declare" and "it" to make things readable to non programmers. I have seen some third party plug ins but they are kind of…
15
votes
1 answer

Parameterized testing with Mockito by using JUnit @Rule?

This follows on from this question: where I am asked to start a new question. The problem is that I just don't know enough about JUnit Rule, or what's going on here with Runners and the like, to crack the problem in the way alluded to by Jeff…
mike rodent
  • 14,126
  • 11
  • 103
  • 157
11
votes
1 answer

How to create parameterized test with few enums in JUnit 5?

For example, I have few enums in my project: Figure, with values TRIANGLE and SQUARE Color, with values are RED and YELLOW How to create a test, using the cartesian product of all of the combinations? The follow code doesn't work: // this doesn't…
Victor Levin
  • 238
  • 2
  • 7
8
votes
2 answers

Parameterized tests in f# - This is not a valid constant expression

For some reason when passing arguments to the test via TestCase attrubute, I get the following error message about the first argument, which in this case is an array: This is not a valid constant expression or custom attribute value module…
7
votes
1 answer

NotAMockException / How to stub a value in parameterized test in Kotlin?

For the following Kotlin class: class ProductLogic( private val product: Product? ) { fun shouldShow(): Boolean { if (product == null) { return false } val version = product.version!! if…
JJD
  • 50,076
  • 60
  • 203
  • 339
7
votes
1 answer

Parameterized Groovy JUnit test-cases in Eclipse

I'm having trouble running a Parameterized Groovy JUnit test-case in Eclipse (see below for test code and environment details). Symptoms Right-clicking on the class in Package Explorer and doing Run As -> JUnit Test Case just brings up a dialog…
Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680
5
votes
1 answer

Parameterize @BeforeMethod method in TestNG

I have a base test class for my tests which does the initialisation work before each test. Here is the code public class BaseTestParameters { MyObj myObj; @DataProvider(name = "apiType") public static Object[][] createData() { …
4
votes
0 answers

How do I parameterize property values for spring boot test

I am working on an aggregation framework using spring boot, which can be used to aggregate multiple kinds of I/O operations' results. Additionally, it has support for both non-blocking (reactive) & blocking aggregation layer, which is controlled by…
aksh1618
  • 2,245
  • 18
  • 37
4
votes
2 answers

Use parameterized test returns Method should have no parameters

I have a problem, I would like to pass the test method to send a request using the GET method and POST. I used parameterization, but I get information java.lang.Exception: Method simpleMessage should have no parameters @Test …
Charles
  • 139
  • 2
  • 3
  • 7
4
votes
2 answers

Data Table tests in Kotlintest - advanced method names and spreading of test cases

I am using Kotlintest and data tables to test an application that uses Kotlin, SpringBoot and Gradle because the syntax is way more concise than ParameterizedJunitTests when you have complex data in your tables. Is there a way to use the parameter…
peach
  • 657
  • 5
  • 26
4
votes
4 answers

is there a faster way to write similar test cases for Django views?

Basically, I realize that I am writing the same test case (test_update_with_only_1_field) for a similar URL for multiple models from django.test import RequestFactory, TestCase class BaseApiTest(TestCase): def setUp(self): superuser =…
Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
4
votes
2 answers

How to apply two @RunWith in spring boot starter test

I am using spring boot starter test for writing JUnit test cases. I would love to use JunitParamrunner which facilitates passing files for parameterized test.Basically it reads data from file line by line and for every line invoke a test case. The…
rohit
  • 862
  • 12
  • 26
3
votes
0 answers

Visual Studio 2017 warning for INSTANTIATE_TEST_SUITE_P while using googletest

I have a gtest test fixture for variable parameterized tests and I instantiate the test suite as below: INSTANTIATE_TEST_SUITE_P(Instantiation, Fixture, ::testing::Range(1, 100)); When I execute the tests, things work like I expect and the tests…
locke14
  • 1,335
  • 3
  • 15
  • 36
3
votes
2 answers

Java Exception No Tests Found Matching when Junit5 ParameterizedTest Attempt

SO I am trying to use ParameterizedTest from JUnit5 and setup the pom to load everything and now have the following test class. import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.equalTo; import static…
Patrick Aquilone
  • 584
  • 2
  • 11
  • 28
3
votes
2 answers

How can I write parameterized tests with open source testcafe?

I found a lot of introductions to parameterized tests/ test cases for test cafe, but the syntax is completely different to the one I am using. I guess they're for the discontinued paid version. How can I do the same thing with the free version? I'm…
Medusa
  • 593
  • 2
  • 5
  • 18
1
2 3 4