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.

379 questions
11
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,408
  • 1
  • 24
  • 55
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
  • 427
  • 3
  • 10
9
votes
2 answers

Data-driven unit testing - Problem with CSV encoding?

I have the following CSV file that is used in my data-driven unit test: File;expected Resources.resx;default Resources.de.resx;de AttachmentDetail.ascx.it.resx;it SomeOtherFile.rm-CH.resx;rm-CH "File" and "expected" are the header. But if I want to…
Juri
  • 32,424
  • 20
  • 102
  • 136
8
votes
1 answer

Problems with data driven testing in MSTest

I am trying to get data driven testing to work in C# with MSTest/Selenium. Here is a sample of some of my code trying to set it up: [TestClass] public class NewTest { private ISelenium selenium; private StringBuilder verificationErrors; …
Jacob
  • 93
  • 1
  • 1
  • 4
6
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
  • 628
  • 6
  • 18
6
votes
3 answers

Read & map data from Json file in c# test

I was trying to use data from JSON file in automation test. Because I found how to work with it, thanks of @jeroenh I left here the correct way. I hope, it will help to somebody. -- JSON file (testDataCo.Json): { "DataCo": [ { …
martin pb
  • 105
  • 1
  • 1
  • 6
6
votes
2 answers

What's the preferred way to implement Data Driven Testing using Elixir/ExUnit?

I'd like to reuse the same code of a test case for several handcrafted combinations of input data and expected outcomes, but without copypasting the code for each set. Frameworks in other languages support it in different ways, for example in…
6
votes
1 answer

Data-driven test with mocking

I have a method that receives a ContactForm object and a map with recipients. So I wrote the following spec that the correct recipient from the Map is returned, based on the inquiry of the form: def "Correct recipients for first inquiry"() { …
Sebastian Wramba
  • 10,087
  • 8
  • 41
  • 58
6
votes
0 answers

Can MSTest Data Driven Tests Be Run in Parallel?

A similar question was asked several years ago for VisualStudio2010 and never answered here: How to parallelize a Data-Driven unit test in Visual Studio 2010? I'm hoping that perhaps this functionality exists now in VS2012. My situation is just like…
6
votes
1 answer

Writing test results back to the TestContext with an Excel WorkSheet as DataSource

We have a lot of tests where the test data is stored in Excel. I created testmethods where the Excel sheets are connected as a DataSource to the TestContext. For convenience reasons, I want to update the Excel sheets with the result of the tests so…
AutomatedChaos
  • 7,267
  • 2
  • 27
  • 47
5
votes
2 answers

Documentation for performing data driven testing using testCafe?

Data Driven testing is an important aspect of writing automated test cases for any tool. I have been experimenting with testcafe lately and haven't been able to find a convincing way of doing data-driven tests i.e. executing a test for different…
5
votes
2 answers

Is there an easier way to handle unit testing a method with too many conditions?

I have a method which has a lot of conditions in it: public bool IsLegalSomething(Order order) { var item0 = order.Items.SingleOrDefault(x => x.ItemCode == "ItemCode0"); var item1 = order.Items.SingleOrDefault(x => x.ItemCode ==…
michael
  • 14,844
  • 28
  • 89
  • 177
5
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
  • 8,318
  • 10
  • 45
  • 58
5
votes
5 answers

Data-Driven Testing in Protractor

I am new to protractor. Can anyone please guide me for data driven testing using protractor. Below is the code, config file and testdata.json file. 'use strict'; var testData = require('../example/Test Data/Test.json'); describe('LoginPage',…
Sahil Sehgal
  • 151
  • 2
  • 5
  • 11
5
votes
1 answer

Nested XML for Data Driven Unit Test

My aim is to have 'nested' data in each of my unit test Iterations. I want to do this so I can have a set of Data to call upon, as well as a list of Actions (described by strings) that are then interpreted and performed in my tests. I currently have…
Nashibukasan
  • 2,028
  • 23
  • 37
1
2
3
25 26