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
5
votes
1 answer

Extending Microsoft.VisualStudio.TestTools.DataSource.XML

I'm writing data driven unit tests using an Xml datasource in C# VS2008. Attributes look something like this and everything works awesomely. [DeploymentItem("HtmlSchemaUrls.xml")] [DataSource("DataSource",…
Kenn
  • 2,269
  • 2
  • 28
  • 36
5
votes
1 answer

Data driven tests generated in ClassInitialize: no longer working in Visual Studio 2012

I have upgraded from Visual Studio 2010 to Visual Studio 2012. In my unit test project, I have a [ClassInitialize] method which generates a CSV file which I then feed into a data-driven [TestMethod] using [DataSource] connected to the CSV. This…
Edward
  • 7,096
  • 2
  • 32
  • 41
4
votes
2 answers

Testcafe can't find tests wrapped in iterator

I have few expand elements in my FAQ page, so I want to test all of them. When writing my fixture and/or test in foreach section, terminal reflects an error ERROR no test to run. I don't understand why I tried to wrap the only test in foreach and…
4
votes
1 answer

MSTest - Can [DataRow] values be accessed in TestInitialize and TestCleanup?

I'm having tests like so: [DataTestMethod] [DataRow("example1")] [DataRow("example2")] public void Test_Example(string name) { // test logic } Our logging system is currently implemented in a single [TestCleanup] method in a base [TestClass]. I…
FDM
  • 578
  • 5
  • 14
4
votes
2 answers

Parametrize test method in JUnit, not just whole class

I would like to make a data-driven parametrized method in JUnit. The examples that I see, parametrize the whole class. E.g. @RunWith(Parameterized.class) public class PrimeNumberCheckerTest { However, I would like to parametrize a single test…
KarolDepka
  • 7,188
  • 9
  • 37
  • 55
4
votes
2 answers

Is there an MBUnit attribute to run Row tests in the order they were defined

I've tried googling around for this but have found nothing. Basically, I'd like to run each row in the order I defined it. For example, if I have this: [Row("a")] [Row("b")] [Row("c")] [Test] public void Test(string s)... I want to be sure that…
LJM
  • 5,654
  • 6
  • 25
  • 27
4
votes
3 answers

CodedUI test does not read data from CSV input file

I am having difficulty mapping a CSV file with the Coded UI test method. This is most likely a stupid question but I cannot seem to find a solution for my problem, at least not one that works. I have made sure to set the property of the CSV file to…
4
votes
3 answers

How to run a test many times with data read from .csv file (data driving)

I am trying to automate some testing for one of our web applications and I need to know how I can make my Coded UI project read data from a CSV file. Lets say I want to test a log in screen. My CSV file will contain a few user names and passwords. I…
4
votes
2 answers

Can you build your own MSTEST DataSource

I have been looking for a way to build my own DataSource for data driven unit tests in MSTEST. I have not found any documentation how to do this or any base class or interface that I need to implement. Any ideas? I'm looking at building something…
Hakan Forss
  • 586
  • 5
  • 10
4
votes
2 answers

Execute test with vstest.console and parameters

I'm executing my test-dlls using the vstest.console.exe (the future mstest.exe) as a process in my application. I want to know if there's any possibility to send parameters or datasource from my application to the testmethod. I've been searching for…
10ff
  • 813
  • 4
  • 15
  • 31
4
votes
2 answers

Data-driven tests in Cucumber

I've got to test a message-routing application, whose functionality is broadly as follows: - message gets sent to app - app examines message - message gets forwarded somewhere, based on the content of the message The vast majority of test cases are…
monch1962
  • 4,879
  • 4
  • 27
  • 36
4
votes
3 answers

Visual Studio Load Test to simulate many users in Data Driven fashion?

I'm trying to load test a web service. I've got a simple method that takes 2 params that get sent to the web service and returns the response, and I created a Unit Test from this method. Because I want need to test various different inputs to…
3
votes
3 answers

Data driven unit tests problem

I'm having some troubles getting my unit tests to be setup to use an Excel .xlsx data source. My App.config file:
helloworld922
  • 10,197
  • 3
  • 43
  • 80
3
votes
1 answer

How to pass multiple json records using data driven approach in Karate DSL?

We have gone through the Karate documentation where we can compare the exact JSON object as a response (which contains multiple data records) but how can we pass and read the JSON in a single scenario? Below is my sample.JSON and I want to read this…
Madhur
  • 51
  • 3
3
votes
1 answer

How to set 2d array as parameter for unit testing

If expected variable is integer, it simply goes like this [DataRow(2)] [TestMethod] public void TestMethod(int expected) { // some code... } But what should one do when there is 2d array int[,] instead of int parameter? When I try to do…
1 2
3
21 22