I've written an xml parser, and I've written a unit test to go with it. Where should I store the actual xml file to be used by the test?
Should I just store it under test/unit/whatever package the test is in?
I've written an xml parser, and I've written a unit test to go with it. Where should I store the actual xml file to be used by the test?
Should I just store it under test/unit/whatever package the test is in?
It depends on several things:
Update: So, multiple unit test files for internal use. I would then just put them into a test
directory, making it easy and uniform for the tests to find them. If they are in the same package where the test class is, whenever you happen to move a class to a different package, you must remember to move the xml file too, and update the file path inside the test. Otherwise the test will happily continue running with the test file in the old directory, without you noticing anything! This opens up possibilities for subtle bugs over time - like deleting a test file which seems to be unused, or worse: overwriting it with another test file...