Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JUnit 4.0+ - Using Parameterized test with external values

807603Nov 2 2007 — edited Nov 2 2007
Hi,

I'm trying to use JUnit, but I want to control how the test case is executed using an external configuration file. I thought about using an Parameterized test class such as -
@RunWith(Parameterized.class)
public class SampleTest {

	private int x, y;
	
	@Test
	public void runSampleTest() {
		System.out.println("Running runSampleTest()");
	}
	
	  @Parameters 
	  public static LinkedList data() {
	    LinkedList params = new LinkedList();
	    params.add(new Integer[] { 1, 3 });
	    return params;
	  }
	
}
However, I can only specify my parameter values from within the method data(). How can I configure this dynamically?

Thanks,
--John C.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 30 2007
Added on Nov 2 2007
1 comment
409 views