Scala: defining folder-based test cases

I need to test a program that accepts a single input file. I put all the input files in a folder, and now I want to use SBT and ScalaTest to perform the following functions:

  • TestAll: call the program with one input file at a time for all files
  • Check one: call the program with one input file provided as an argument to the command testfrom the sbt console

So far, the folder name is a fixed path, so a list of all files can be obtained:

val dir = new File("tests\\");
val files = dir.listFiles.filter(
  f => """.*\.extension$""".r.findFirstIn(f.getName).isDefined);

Can someone give me a brief idea of ​​which scalatest class is best suited for this purpose?

+5
source share

All Articles