2

I am developing a new feature for a well-established memory package. The feature Im implementing is about loading/copying/moving resources in and out to different type of structures like jars, libraries and so.

I started with writing tests first. I felt i need an test artifact, like a sample file/DLL/txt whatever, however, I do not know where to put it? What is the best practice to follow in this type of situation?

4
  • Why not put it next to the tests? Jan 26, 2019 at 12:36
  • I could do that. Would it be the best practice? I just want to learn the correct way of handling this.
    – CanCode
    Jan 26, 2019 at 22:46
  • There is rarely a single correct way of handling things in software engineering. This is a detail that can be adjusted later if your current choice turns out to be sub-optimal, so my advise it to choose something that looks logical to you and see how that works out. Jan 27, 2019 at 8:57
  • I did it it that way for now. Will be updating if i need some other structure later. Thank you for your reply. Would you like to make it an answer down here?
    – CanCode
    Jan 28, 2019 at 22:18

1 Answer 1

3

I would advise you to put it on your 'test' directory of your project, if the 'test' directory isn't flat (for instance 'mocks' 'unit' etc. as in Rails) I would create a directory called 'data'/'artifact' in there and put the file inside.

Moreover, please make sure to call the file in a name that corresponds to the actual test file. If this file is being used in many test files (with different names), I would advise you to document it so its' usage can be traced in case of cleanup/refactoring.

+There isn't a "best way" and each project is a special case, yet consistency and making it easier for future maintainers to make sense of this file can go a long way.

1
  • Thanks for suggestions and detailed answer. I followed something similar and working well for now.
    – CanCode
    Jan 30, 2019 at 19:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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