data-driven-tests

Data-driven testing in NUnit?

你。 提交于 2019-11-30 02:41:53
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 code in NUnit 2.5? I would look at the parameterized tests documentation in NUnit 2.5 and see if you can do something like what you're doing there. I do not recall NUnit having a built-in CSV reading attribute to drive parameterized tests. There may be a community plug-in

Data driven load testing with Visual Studio - where are web tests generated?

与世无争的帅哥 提交于 2019-11-29 18:14:18
I have set up a Web Performance Test and Load Test project in Visual Studio 2013 that uses data driven web tests based on a local SQL Server data source. Eventually I would like to set up a test controller and test agents in order to distribute the load from multiple clients. My question is about the architecture of the controller and agents. Does each test agent also need access to the data source that generates content for the web tests or is the web test (and its dynamic parameters) generated at the controller and then distributed to the test agents? Below is a diagram I found of the

Why does data driven unit test fail in vs2012 when it worked fine in vs2010?

こ雲淡風輕ζ 提交于 2019-11-29 10:59:49
I have some data driven unit tests that were working just fine in Visual Studio 2010. These tests were implemented using the following pattern. [TestMethod()] [DeploymentItem("path_to_data_dir_relative_to_solution\\my_data.xml")] [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\my_data.xml", "Token", DataAccessMethod.Sequential)] public void MyTestMethod() { // Arrange const string EXPECTED_PARAM_NAME = "table"; string data = TestContext.DataRow["Data"].ToString(); var sut = new MyClassUnderTest(); // Act sut.DoSomething(data); // Assert Assert.IsTrue(sut

Data-driven unit tests with google test

末鹿安然 提交于 2019-11-29 10:34:18
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 requests to have this data read-in from a file. His argument is that it would thus be easier to add another test for a corner case that was previously forgotten. I am not that experienced with unit tests but so far that was not how I did it. So I tried to figure out what would be the best way to do it - even if it is a good idea to do it at all. I

Possible to pass parameters to TestNG DataProvider?

给你一囗甜甜゛ 提交于 2019-11-28 18:21:24
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 method once for each data value. My problem is that different tests need to load data from different files and there doesn't appear to be any way to send a parameter to the DataProvider. Does anyone know if this is possible? Ideally, I would like my code to look like

Data-driven tests with jUnit

南笙酒味 提交于 2019-11-27 18:46:13
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 one huge aggregate. In JUnit4 you can use the Parameterized testrunner to do data driven tests. It's not terribly well documented, but the basic idea is to create a static method (annotated with @Parameters ) that returns a Collection of Object arrays. Each of

Data-driven testing in NUnit?

爷,独闯天下 提交于 2019-11-27 12:42:45
问题 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 code in NUnit 2.5? 回答1: I would look at the parameterized tests documentation in NUnit 2.5 and see if you can do something like what you're doing there. I do not recall NUnit

How to use a list of values for a parameter?

吃可爱长大的小学妹 提交于 2019-11-27 09:53:48
I am using the test plugin for VS 2012 (although have just installed 2013), and need to know: Is it possible to have a parameter pass a different value from a selected list while load testing? I have used the sample load test located here: http://www.visualstudio.com/get-started/load-test-your-app-vs and created a new web test that meets my needs as below. I have a simple journey recorded that is an email registration web page. The journey is essentially completing name & address, email, conf email, password, conf password. On submission of the form, a verification email is sent. I need to

CodedUI test does not read data from CSV input file

时光毁灭记忆、已成空白 提交于 2019-11-27 09:34:20
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 Copy always . I have also imported the CSV file by writing the following line above the test method. [DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\Data\\login.csv", "login#csv", DataAccessMethod.Sequential), DeploymentItem("login.csv"), TestMethod] The file name is login.csv and it resides in the Data folder. The

Data-Driven Testing in Protractor

会有一股神秘感。 提交于 2019-11-27 07:05:25
问题 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', function() { var loginData = require('../example/Test Data/Test.json'); testData.forEach(function (data) { it("data.description", function (data) { browser.get("http://127.0.0.1:8080/#/login"); element(by.model("username")).sendKeys(data.username);