Questions tagged [data-driven-tests]

Data-driven testing (DDT) is a term used in the testing of computer software to describe testing done using a table of conditions directly as test inputs and verifiable outputs as well as the process where test environment settings and control are not hard-coded.

Data-driven testing is the creation of test scripts to run together with their related data sets in a framework. The framework provides re-usable test logic to reduce maintenance and improve test coverage. Input and result (test criteria) data values can be stored in one or more central data sources or databases, the actual format and organisation can be implementation specific.

328 questions
42
votes
6 answers

How to RowTest with MSTest?

I know that MSTest doesn't support RowTest and similar tests. What do MSTests users do? How is it possible to live without RowTest support? I've seen DataDriven test features but sounds like too much overhead, is there any 3rd party patch or tool…
dr. evil
  • 25,988
  • 28
  • 126
  • 198
41
votes
5 answers

MemberData tests show up as one test instead of many

When you use [Theory] together with [InlineData] it will create a test for each item of inline data that is provided. However, if you use [MemberData] it will just show up as one test. Is there a way to make [MemberData] tests show up as multiple…
NPadrutt
  • 2,651
  • 3
  • 14
  • 42
30
votes
10 answers

Data-driven tests with jUnit

What do you use for writing data-driven tests in jUnit? (My definition of) a data-driven test is a test that reads data from some external source (file, database, ...), executes one test per line/file/whatever, and displays the results in a test…
ripper234
  • 202,011
  • 255
  • 600
  • 878
25
votes
5 answers

Possible to pass parameters to TestNG DataProvider?

We would like to run some of our tests each against a set of data values, verifying that the same conditions hold true for each. The data is currently stored in either flat files or in simple Excel spreadsheets. My first thought was to create a…
Benjamin Lee
  • 1,140
  • 3
  • 13
  • 18
16
votes
2 answers

pass test case parameters using nunit console

I am developing tests using Nunit and data driven testing approach. I have test method with 2 parameters: path to xlsx file and worksheet name. It works perfect in Visual Studio when I pass parameters in TestCase attribute, for example when I want…
kotoj
  • 759
  • 1
  • 6
  • 25
16
votes
1 answer

MSTest data driven Test set DisplayName for Rows from DataSource

How can I set the DisplayName of a Data Row in data driven tests, where the data source is a XML and the provider is Microsoft.VisualStudio.TestTools.DataSource.XML. XML:
15
votes
5 answers

Data-driven testing in NUnit?

In MSTest you can do something like: [TestMethod] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "testdata.csv", "testdata#csv", DataAccessMethod.Sequential)] public void TestSomething() { double column1 =…
Nobody
  • 4,541
  • 5
  • 30
  • 62
14
votes
5 answers

Data driven testing in MSTest - problem with TestContext.DataRow

I'm having essentially the same problem as the question linked below, but I cannot seem to get it to work. I'm getting "cannot apply indexing [] to an expression of type System.Data.DataRow". As far as I can tell, I have implemented the solution…
bq1990
  • 367
  • 1
  • 4
  • 9
13
votes
3 answers

How do you get the iteration / line number from TestContext in data driven tests?

I've implemented a data driven test using MsTest framework. I was wondering if there was a way to get the iteration / line number of the current test code from the TestContext object? As far as I can see, the only property relevant to DDT is DataRow…
user1039580
  • 339
  • 4
  • 15
13
votes
2 answers

Possible to use TestNG DataProvider AND test suite Parameters?

Does anyone know if there is a way to use a TestNG DataProvider with a test at the same time as using the @Parameter annotation? Our test suites have some constant configuration information that is being passed to the test methods via the…
Benjamin Lee
  • 1,140
  • 3
  • 13
  • 18
12
votes
2 answers

Single column Date table issue:Groovy:Date variable '_' needs to be declared as method parameter

I have a very simple test as blow: def "setContent_activity_finished"(Status editStatus) { // Variables......................... given: activity.getStatus() >> editStatus.toString() when: …
Alex Luya
  • 7,516
  • 12
  • 51
  • 78
12
votes
4 answers

Data Driven Unit Tests

What is the best practice for testing an API that depends on data from the database? What are the issues I need to watch out for in a "Continuous Integration" environment that runs Unit Tests as part of the build process? I mean would you deploy…
Vyas Bharghava
  • 6,058
  • 5
  • 34
  • 55
11
votes
2 answers

Data-driven DUnit testing

The way DUnit normally works is you write some published methods, and DUnit runs them as tests. What I want to do is a little different. I want to create tests at run time based on data. I'm trying to test a particular module that processes input…
dan-gph
  • 14,921
  • 12
  • 55
  • 75
10
votes
1 answer

Data-driven unit tests with google test

I am currently writing unit tests for an embedded application using googles unit test framework. Now my boss got upset that the data I test with (i.e. the values with which I call methods of the class under test) is hard wired in the tests. He…
sigy
  • 2,165
  • 20
  • 41
9
votes
6 answers

Is there a way to use data that's already in memory to drive unit tests?

I know I can use data in files to drive unit test, for example data inside a csv or xml file. For example: [TestMethod] [DataSource( "Microsoft.VisualStudio.TestTools.DataSource.CSV", "Data.csv", "Data#csv", …
Paulo Pinto
  • 429
  • 3
  • 10
1
2 3
21 22