Check several different example inputs in a single test?

前端 未结 7 921
感情败类
感情败类 2021-01-17 07:31

Let\'s say I want to write a function that validates an email address with a regex. I write a little test to check my function and write the actual function. Make it pass.

7条回答
  •  长发绾君心
    2021-01-17 08:25

    Most testing frameworks now support some sort of data based testing to let you run the same test on multiple data sets.

    See the ValuesAttribute in NUnit.

    xUnit.net, MBUnit and others have similar methods.

提交回复
热议问题