开发者

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:

  1. Add your XML files to the Unit Test project (create a new folder for your test files).
  2. Go to Test -> Edit Test Settings
  3. Click on Deployment
  4. Check the box "Enable Deployment" and add the directory you created in step one.
  5. In the unit test:

    string testxml = File.ReadAllText("test.xml")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜