Im doing some junit test. I have a bunch of files in a folder and have to test each one. Some of them freeze during the process that why i added the time out. I wanna do a loop to add all the files to the array and the run the test. As I have it now I have to put what indexes of the list i want to test manually. I tried doing a for loop but it tells me that the method is static and i cant add the files that way.
Thank you in advance...
/** * * Load assumptions and goal from file. */ package testFromFiles; import java.io.File; import java.util.Arrays; import java.util.List; import junit.framework.TestCase; //import org.junit.After; //import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class TPTPTestsAngel extends TestCase { /** * @param args * @throws Exception */ public TPTPTestsAngel(int number) { this.x = number; } String folderName = "//usr//local//Tools//projects//ParsedFiles//PUZ PrIKL//"; File folder = new File(folderName); String[] files = (folder.list()) ; TPTPTests nt; static int x ; @Parameters public static List<Integer[]> data() { Integer[][] data = new Integer[][]{{25},{65},{15}}; return Arrays.asList(data); } public void testRunTrue(int x) throws Exception { nt = new TPTPTests (folderName,files[x],files.length); nt.setFileName(files[x]); nt.testTPTPTrue(); } public void testRunFalse(int x) throws Exception { nt = new TPTPTests (folderName,files[x],files.length); nt.setFileName(files[x]); nt.testTPTPAssertFalse(); } public void testRunUnknown(int x) throws Exception { nt = new TPTPTests (folderName,files[x],files.length); nt.setFileName(files[x]); nt.testTPTPUnknown(); } @Test(timeout = 5000) public void LoopTestTrue() throws Exception { testRunTrue(x); } @Test(timeout = 5000) public void LoopTestFalse() throws Exception { testRunFalse(x); } @Test(timeout = 5000) public void LoopTestUnknown() throws Exception { testRunUnknown(x); } }