开发者

Open an xml file that is included in the project

开发者 https://www.devze.com 2023-02-14 02:18 出处:网络
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

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

精彩评论

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