JUnit's @Parameterized runner provides support for parameterized tests.
Questions tagged [parameterized]
525 questions
10
votes
1 answer
Prevention against SQL Injection in Hibernate
I have used hibernate to interact with my database, now I wanted to make my database layer secure against SQL Injection, so I did some research and I found out that my queries should be parameterized , so does it mean if I just structure my HQL…

Juzer Arsiwala
- 601
- 2
- 10
- 20
10
votes
1 answer
Parameterized multi-layered suites
I currently have an abstract BaseTest class which holds several generic @Test's.
public abstract class BaseTest {
private String expected;
private String actual;
public BaseTest(String expected, String actual) {
this.expected =…

budi
- 6,351
- 10
- 55
- 80
9
votes
2 answers
maven release plugin with parameterized version
is it possible to use the maven release plugin with a multi-module project, where some of the inter-module dependencies are specified using a parameter from the parent pom?
When I try to call release:prepare i get the following error:
[ERROR]…

kpentchev
- 3,040
- 2
- 24
- 41
9
votes
1 answer
Modifying nested attributes on an included Layout
I've been learning about merge and include lately, and I have a question I can't seem to figure out the answer too. Say I have a layout that defines a header component that I want to add to multiple layouts. However, I want to change the title, or…

chubbsondubs
- 37,646
- 24
- 106
- 138
9
votes
3 answers
Use reflection to create a generic parameterized class in Java
How can I use reflection to create a generic parameterized class in Java?
I have
public class SomeClass {
public SomeClass() {
}
}
and I need an instance of it.
I've tried variations of
Class c = Class.forName("SomeClass");
but could…

luvieere
- 37,065
- 18
- 127
- 179
9
votes
6 answers
Is it possible to replace the entire Repository Url with a parameterized string in Hudson/Jenkins?
In Hudson/Jenkins, is it possible to replace the entire string in the Subversion Module Repository URL with a String parameter? I don't want to just replace just the version or anything like that, I want to replace the entire url.
So, when I run…

AHungerArtist
- 9,332
- 17
- 73
- 109
9
votes
2 answers
What is the difference between a parameterized class and a metaclass (code examples in Python please)?
Hello Stack Overflow contributers,
I'm a novice programmer learning Python right now, and I came upon this site which helps explain object-oriented paradigms. I know that metaclasses are classes of classes (like how meta-directories are directories…

yrsnkd
- 153
- 1
- 6
9
votes
2 answers
How to run selected junit tests with different parameters
I want to run selected test methods from any test class with different parameters
Ex: 1) ClassA -> Test methods A, B
@Test
public void testA(String param) {
System.out.println("From A: "+param);
}
@Test
public void testB(String param) {
}
2)…

kvysh
- 165
- 1
- 1
- 10
9
votes
1 answer
JUnit parameterized- create one instance for each parameter
I was annoyed to find in the Parameterized documentation that "when running a parameterized test class, instances are created for the cross-product of the test methods and the test data elements." This means that the constructor is run once for…

Nate Glenn
- 6,455
- 8
- 52
- 95
9
votes
6 answers
Parameterized SQL Columns?
I have some code which utilizes parameterized queries to prevent against injection, but I also need to be able to dynamically construct the query regardless of the structure of the table. What is the proper way to do this?
Here's an example, say I…

Martin
- 5,945
- 7
- 50
- 77
8
votes
2 answers
Parameterized beforeEach/beforeAll in JUnit 5
I want to write a test for a small database-like application. This application uses queries and a query should return the correct result. This is easily implemented in JUnit 5, something like
@BeforeEach
void before() {
database =…

CoronA
- 7,717
- 2
- 26
- 53
8
votes
2 answers
Error when running Python parameterized test method
IDE: PyCharm Community Edition 3.1.1
Python: 2.7.6
I using DDT for test parameterization http://ddt.readthedocs.org/en/latest/example.html
I want to choose and run parameterized test method from test class in PyCharm -> see example:
from unittest…

pbaranski
- 22,778
- 19
- 100
- 117
7
votes
3 answers
Parameterized JUnit tests with non-primitive parameters?
There is a nice possibility to run JUnit test with parameters where the same test method is executed multiple times with different data as described here: http://junit.org/apidocs/org/junit/runners/Parameterized.html
Unfortunately, it only seems…

datka
- 860
- 2
- 11
- 15
7
votes
5 answers
Get class of generic
My class starts with
public abstract class LastActionHero(){
Now somewhere in the code I want to write H.class but that isn't possible (like String.class or Integer.class is).
Can you tell me how I can get the Class of the generic?
user321068
7
votes
1 answer
Does Mocha offer the option to parameterize tests "@Theory" style?
Both JUnit and N/XUnit enable us to parameterize tests which differ only by input values and expected results. In other words, we can statically define sets of test data (inputs + expected results) and let one single test execute and validate…

krazyk4tlady
- 389
- 1
- 5
- 13