I have to test a program which takes one input file. I have put all the input files inside a folder and now I want to use SBT and ScalaTest to have following features:
test
command from sbt consoleFor the time being foldername is a fixed path, so list of all files can be obtained by:
val dir = new File("tests\\");
val files = dir.listFiles.filter(
f => """.*\.extension$""".r.findFirstIn(f.getName).isDefined);
Can any one give me a brief idea as to which scalatest class is best suited for this purpose?
I think you should consider refactoring the program so that you have a method which takes an InputStream
rather than a file. That way you can test the method without worrying about files. Of course it depends on the structure and size of the files.
If you don't want to do that you can implement your own SBT Task with a parameter (the filename).
http://code.google.com/p/simple-build-tool/wiki/CustomActions
http://code.google.com/p/simple-build-tool/wiki/MethodTasks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With