Questions tagged [testcasesource]

46 questions
23
votes
3 answers

NUnit TestCaseSource

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…
DanB
  • 231
  • 2
  • 3
17
votes
1 answer

How to use multiple TestCaseSource attributes for an N-Unit Test

How do you use multiple TestCaseSource attributes to supply test data to a test in N-Unit 2.62? I'm currently doing the following: [Test, Combinatorial, TestCaseSource(typeof(FooFactory), "GetFoo"), TestCaseSource(typeof(BarFactory),…
elucid8
  • 1,412
  • 4
  • 19
  • 40
15
votes
3 answers

NUnit testcasesource with data refactored into another class

I am using NUnit with the TestCaseSource attribute to do data-driven testing with dynamic data in the same approach as NUnit TestCaseSource pass value to factory and How can I pass dynamic objects into an NUnit TestCase function? In each case they…
7
votes
4 answers

Correct Way To Run Test Set Up with Nunit TestCaseSource

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…
chrispepper1989
  • 2,100
  • 2
  • 23
  • 48
5
votes
1 answer

Delay-loading TestCaseSource in NUnit

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…
rwong
  • 6,062
  • 1
  • 23
  • 51
5
votes
1 answer

Nunit runsTestCase with a TestCaseSource with the first iteration having no parameters? Why?

Hi I am new to Nunit and I am passing a series of objects to a TestCase as a TestCaseSource. For some reason though Nunit seems to run the test first with no parameters passed to it which results in an ignored output: The test: private readonly…
Phil
  • 616
  • 2
  • 8
  • 21
5
votes
1 answer

Setup a complicated row test with nunit and TestCaseSource and TestCaseData

For every expect return value like 2 or 4 I want to pass this value as parameter for the unit test method. But I get an exception that the parameters are not correct. When I remove the countExpected parameter the unit test runs fine I just can not…
Elisabeth
  • 20,496
  • 52
  • 200
  • 321
3
votes
2 answers

How to invoke test method with multiple parameters (NUnit)

My test method looks like this: public static List Generator() { return A.GenerateObjects(); } [Test, TestCaseSource(nameof(Generator))] public void DoSomething(Something abc) {/*do something*/} This code works very well and…
B0r1
  • 400
  • 3
  • 15
3
votes
2 answers

Protractor : ERROR - Unable to start a WebDriver session

I wrote test cases three months back at that time they worked fine now i want to run those test cases in another system so i did basic setup. When i try to run protractor test case now they are failing with 'Unable to start a WebDriver session'. I…
Anusha Nilapu
  • 1,243
  • 8
  • 24
  • 36
3
votes
1 answer

wrong number of arguments provided in nunit

Developed testcase with Testcasesource in selenium using c#. After running the test case in the NUnit, It shows the error as "Wrong Number of arguments provided". And this is my test case code [TestFixture] class testcases { static String[]…
2
votes
2 answers

How can adjust test scripts in selenium when user interface changes constantly?

We recently ran in to a problem.Our team has automated test scripts with selenium. Now we got change request in User Interface, So we have modified the css. The issue is automated test scripts are not working. we know this is due to css change. My…
user416
  • 516
  • 3
  • 12
  • 34
2
votes
0 answers

Proper way of disposing an IDisposable instance when using NUnit's TestCaseSource

I have two slightly different variations (TestsA and TestsB) of NUnit parameterized unit tests that use a TestCaseSource to pass arguments to the tests. In each case I'm passing an instance of a class that implements the IDisposable interface (I am…
akalnay
  • 61
  • 2
2
votes
1 answer

Disposing TestCaseSource elements in NUnit test

I am using TestCaseSource with NUnit. The below code generates IEnumerable of TestCaseData that represent an archive entry, which is an input for a test. private class GithubRepositoryTestCasesFactory { private const string…
Boris Modylevsky
  • 3,029
  • 1
  • 26
  • 42
2
votes
2 answers

NUnit: TestCaseSource assigns tests to specific test methods

I'm planning to store all test cases in a excel file with columns indicate test method names, parameters and expected results; however, I found TestCaseSource simply assigns all test cases to every test method. I'm wondering that is there any way I…
LN.EXE
  • 59
  • 8
2
votes
1 answer

Unable to run TestCaseSource tests when the type under test overrides ToString

First, let me present the test setup in F# (using FsUnit on top of NUnit): type SimpleRecord = { A: int; B: int } override x.ToString() = x.A.ToString() [] type ``Simple Test Cases``() = static member…
Ifligus
  • 158
  • 3
  • 10
1
2 3 4