I am working on a Scala project and I want to include some sample data somewhere in the project. Specifically, my Scala project includes code that performs various natural language processing tasks on text data. I want to include a sample set of text files that the user can use to test out the program somewhere in the project structure. Right now I am putting this sample data in the resources folder (mostly because it is the only location within the project that I know how to read from). But I was wondering if this is the best location? In general what is the best practice regarding where to put sample data within the project? Alternatively, would it be a better idea to simply provide this data separately (i.e external to the project)?

  • Are you using sbt or some other build tool that desires a specific layout?
    – user40980
    Sep 1, 2014 at 16:36
  • Yes I am using sbt Sep 1, 2014 at 16:42

1 Answer 1


The data should be provided in the project, but outside the library/binary.

That is the data should be provided as part of the source archive the user downloads (unless very large; large data should be provided separately), but they should take no part in the build process. So they'd go in sample or something and the user will load that data just the way they would load their own data placed anywhere on disk (following instructions in appropriate quick start document).

Additionally you could provide an automated integration test that would load those data and exercise main functions of the program. These would start the application similarly to how the user would, load the sample data and check the behaviour, still using only the end-user interface. Easiest done with shell if you have command-line interface, but there are tools for testing a GUI too.

  • So are you saying sample should go inside the src folder or at the same level? Sep 1, 2014 at 17:39
  • 1
    @user1893354: At the same level as src. It is not a source.
    – Jan Hudec
    Sep 1, 2014 at 18:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.