data-driven-tests

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 your database as part of the build scripts (may be run your installer) or should I go for har...

DbUnit for C++?

We're developing in C++ under Linux and about to set up automated tests. We intend to use a testing framework like CppUnit oder CxxTest. We're using Ant to build the software and we will also use it to run the tests. As some tests are going to involve database access, we are looking for a tool or framework which facilitates the tasks of...

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 TestNG DataProvider that would load the data from the file and be used to call the test meth...

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 @Parameter annotation. We would now like to use a DataProvider to run these tests over a set of da...

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 files to creates output files. I have a set of test input files with corresponding known goo...

Data-driven unit testing - Problem with CSV encoding?

Hi, 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 get the "File"-column in the code like TestContext.DataRow["File"].ToString(); ...

Running unit tests from within VS2008 vs using mstest on the command line.

Dear ladies and sirs. I have recently encountered some inconsistencies in running unit tests inside VS2008 vs running the same unit tests with mstest on the command line. My scenario is a bit advanced, so I have probably hit some corners. I have many data driven unit tests running against the same DataSource. I also like experimenting ...

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", "Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\HtmlSchemaUrls.xml", Microsoft.VisualStudio.TestTools....

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 near-identical; generate a particular type of message, load it into the system, wait a fe...

How to create DataSource file outside main test method

[TestInitialize()] public void MyTestInitialize() { XmlTextWriter writer = new XmlTextWriter("DataFile.xml", Encoding.UTF8); writer.Formatting = Formatting.Indented; writer.WriteProcessingInstruction("xml", "version='1.0' encoding='utf-8'"); writer.WriteStartElement("TestCases"); Direct...

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 runner as if you had separate tests - the result of each run is displayed separately, not in...

How can i reference an embedded data file for data-driven unit tests?

This is my scenario, I want to make a Data-Driven unit test, and for being environment-independent i want to embed the data file in my assembly. How can i reference then in the DataSourceAttribute of the Unit Test?. I'm trying to access an Excel 2003 file using the Microsoft Jet OleDB Provider. The unit test works fine when the file is ...

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 similar to FITNesse but using Team Foundation Server for my backing store. ...

Problems with data driven testing in MSTest

Hello, 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; [DeploymentItem("GoogleTestData.xls")] [DataSource("System.Data.OleDb", "...

Unit test problem with DataSource attribute [C#]

Hi, I try make my first simpel Data Driven Test. I created db (UnitTestsDb) with MS SQL Managmet studio, and also I created one db table (UsersTab). I try use this db in unit test. Code is here: [TestMethod()] [TestProperty("TestCategory","Developer"), DataSource("System.Data.SqlClient", "Data Source=.\\SQLEXPRESS;AttachDbFilena...

Data Driven Testing with cppunit

I'd like to make some data-driven tests using cppunit. I thought I saw a while ago that a version of RowTest was ported to cppunit, but now I can't seem to find it anywhere. What are some ways to do data-driven tests using cppunit? ...

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 test A is executed before test B, and test B is executed before test C. ...

how to set TestTimeout in DDT

Hi All, I'm running 100 of test cases from a xml data source using MSTest. But my test case execution never complete as few of my test cases doing something wrong. I wanted to know is there any way to specify test timeout time for individual test cases. I know in VS testrun config we can add this time. But this is for the entire test me...

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 = Convert.ToDouble(TestContext.DataRow["column1"]); ... Assert.AreEqual(...); } What is the equivalent c...