How to get MSTest to find my test data files?

后端 未结 3 1637
别跟我提以往
别跟我提以往 2021-02-05 03:00

I have a few tests that need to be fed with external data from excel files. The files are included in the test project, and in Visual Studio, I have edited the test settings fil

3条回答
  •  名媛妹妹
    2021-02-05 03:53

    The accepted answer is technically correct. However, from my experience, I find that the embedding files as resources requires an additional step of remembering to set the property "Embedded Resource". This becomes a challenge when you have a large number of data files. Also, with increasing number of data files, the size of the unit test assembly keeps growing . In my case, I had over 500MB of test data files and packing all them into the assembly was not a good idea.

    What is the alternative?

    Let the data files remain as they are. Do not use DeploymentItemAttribute, do not use embedded resources. Please refer my proposed solution How do I make a data file available to unit tests?

提交回复
热议问题