Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Use @Parameters reading from an external file  RSS feed

 
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
Sheriff
Posts: 37222
519
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!