I’m writing some jUnit tests that depend on data files. Where should those data files go? And how would I (in the jUnit tests) get the location of that directory?
In Python, I would use something similar to:
datadir = os.dirname(__file__) + '/data/'
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Kind of depends on what you’re using the data files for, but in general, just create a package and make sure it’s on your classpath. To load a properties file from the ‘data’ package, add a ‘MyData.props’ file and you can use load a properties file like:
Again, not exactly sure if this answers your question since I’m not 100% sure what you’re trying to do, but I hope it helps a little.