Open an xml file that is included in the project
I added an XML file to a directory that i have in the test project.
How can i access it from the test c开发者_如何学JAVAode?
You didn't mention what language or IDE you're using, but here is what I've done with C# in Visual Studio:
- Add your XML files to the Unit Test project (create a new folder for your test files).
- Go to Test -> Edit Test Settings
- Click on Deployment
- Check the box "Enable Deployment" and add the directory you created in step one.
In the unit test:
string testxml = File.ReadAllText("test.xml")
精彩评论