0

Hi I want to be able to run a JunitTest Class that is not inside my eclipse project,but in a directory , thats is what I mean

Class<?> clazz = How can I get a file.class("my/dir");
Result result =  JUnitCore.runClasses(clazz);
for (Failure failure : result.getFailures()) {
     System.out.println(failure.toString());
}
System.out.println(result.wasSuccessful());
}
Stivan
  • 1,068
  • 1
  • 15
  • 22
Davben93
  • 1
  • 2
  • You have one extra `}` – Stivan May 16 '16 at 17:55
  • Use regular file reader Java (API)[https://docs.oracle.com/javase/tutorial/essential/io/file.html] – αƞjiβ May 16 '16 at 17:55
  • I can't see this link can you retype it? – Davben93 May 16 '16 at 18:15
  • This comment show how to read a file http://stackoverflow.com/a/4716623/1371064 . – Carlos Andrés García May 16 '16 at 18:36
  • @αƞjiβ I can't see this link can you retype it? – Davben93 May 16 '16 at 20:59
  • @CarlosAndresGarcía thank you very userfull now that I have the inputStream I want to be able to convert this and put it in a (for example) Class> clazz = inputStream.class and try to put it in Result result = JUnitCore.runClasses(clazz); because JUnitcore runnerClasse requires a .class type I tried to do inputStream.getClass but it returns the class of input Stream not the Class get from the input directory sorry if it isnt so clear – Davben93 May 16 '16 at 21:35

0 Answers0