Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Use @Parameters reading from an external file

 
Theodore David Williams
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would like to use JUnit to read in a file of parameters. I think that I can use the @Parameters annotation to do this, but I am not really sure how to get the values out of the file.

file:





Anyone done anything like this before?

Thanks
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34839
369
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've used @Parameters, but not from a file. However, it's just Java so you can absolutely read from a file. Just like reading from any other file. Maybe Scanner to read a line and split() to parse the columns? The only thing to watch for is that your file is in the classpath.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic