Data-driven testing in NUnit?

前端 未结 5 1765
情歌与酒
情歌与酒 2020-12-14 03:40

In MSTest you can do something like:

[TestMethod]
[DataSource(\"Microsoft.VisualStudio.TestTools.DataSource.CSV\", 
            \"testdata.csv\", \"testdata#         


        
5条回答
  •  不知归路
    2020-12-14 04:17

    MS Test provides a mechanism to have your test data from different sources. However this is not available out of the box from NUnit.

    I am in favor of using separating the data and code for tests that are of some considerable size. When I separate both, my expectation are 1. Readability of test data 2. Test data should be easy to modify 3. The unit tests should run comfortably in local and build environment

    The JsonSectionReader below has all the features that I would like to have. The tool is capable of reading sections of data from embedded json files. It also provides a very comfortable mechanism to deserialize.

    https://www.nuget.org/packages/WonderTools.JsonSectionReader/

    P.S. I am the maintainer of this project, and this project was created because I didn't find any other tool that solves this problem to the extent I wanted.

提交回复
热议问题