testcasesource

Correct Way To Run Test Set Up with Nunit TestCaseSource

社会主义新天地 提交于 2020-01-03 15:59:03
问题 I am trying to run multiple tests using TestCaseSource in NUnit. But I am struggling to get the [SetUp] to run when I want it. At the moment it works how I want it to but it doesnt feel "right". So the following is the main test case code (simplified): public class ImportTestCases { ImportTestCases() { TestData.RunTestSetup(); } public static IEnumerable TestCases { get { //run the funciton under test... var results = RunFunctionSubjectToTest(TestData.ImportantVar); //get multiple results...

Delay-loading TestCaseSource in NUnit

梦想的初衷 提交于 2019-12-06 03:53:34
问题 I have some NUnit tests which uses a TestCaseSource function. Unfortunately, the TestCaseSource function that I need takes a long time to initialize, because it scans a folder tree recursively to find all of the test images that would be passed into the test function. (Alternatively it could load from a file list XML every time it's run, but automatic discovery of new image files is still a requirement.) Is it possible to specify an NUnit attribute together with TestCaseSource such that NUnit

Delay-loading TestCaseSource in NUnit

萝らか妹 提交于 2019-12-04 08:28:33
I have some NUnit tests which uses a TestCaseSource function. Unfortunately, the TestCaseSource function that I need takes a long time to initialize, because it scans a folder tree recursively to find all of the test images that would be passed into the test function. (Alternatively it could load from a file list XML every time it's run, but automatic discovery of new image files is still a requirement.) Is it possible to specify an NUnit attribute together with TestCaseSource such that NUnit does not enumerate the test cases (does not call the TestCaseSource function) until either the user

NUnit TestCaseSource

元气小坏坏 提交于 2019-11-30 21:37:48
问题 I'm having a go with the TestCaseSource attribute. One problem: when the sourceName string is invalid, the test just gets ignored instead of failing. This would be really bad if the source method gets renamed, the sourceName string doesn't get updated, and then you lose the coverage that the test provided. Is there a way to change the behaviour of NUnit, so that the test fails if the sourceName is invalid? 回答1: This is resolved in NUnit 2.6.2. There is a new constructor for the attribute that