data-driven-tests

DataDriven testing with TestNG using Apache POI in Selenium WebDriver

家住魔仙堡 提交于 2019-12-11 21:53:08
问题 I am new to TestNG framework. Please guide how to parameterise the test cases using Apache POI(Excel). I have a code to read from second row from Excel. public class spreadData { private transient Collection data = null; public spreadData(final InputStream excelInputStream) throws IOException { this.data = loadFromSpreadsheet(excelInputStream); } public Collection getData() { return data; } private Collection loadFromSpreadsheet(final InputStream excelFile) throws IOException { HSSFWorkbook

How to increase/decrease indenting when stepping in/out of methods?

扶醉桌前 提交于 2019-12-11 12:58:24
问题 TL;DR - jump to last paragraph Background I'm performing some data driven testing and using the log file as one of the testing outputs. It works something like this- Read first file in folder Process first line and convert to a test Run Test Perform Validation 1 ... ... Read next file Etc. My log file reflects this: INFO - Start RunAllFilesInFolder INFO - File1: INFO - Some info INFO - Executing Test 1 INFO - Validation A result INFO - ... INFO - ... INFO - File2: ... At the moment I use/call

Microsoft Unit Tests - Data source cannot be found in the test configuration settings

会有一股神秘感。 提交于 2019-12-11 11:59:37
问题 I am trying to build Test class of data-driven unit tests in C#. I want to use 3 databases: one from SQL, one from Access and one from Excel. This is my app.config file: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="microsoft.visualstudio.testtools" type="Microsoft.VisualStudio.TestTools.UnitTesting.TestConfigurationSection, Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral"/> </configSections> <connectionStrings

Data Driven Test on Visual Studio using a complex serialized object

喜夏-厌秋 提交于 2019-12-11 09:26:28
问题 I wonder if what I want to do is possible. I have a unit test driven by a xml, as follow : [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML", "|DataDirectory|\\MyFile.xml", "TestMember", DataAccessMethod.Sequential)] [DeploymentItem("MyFile.xml")] [TestMethod] public void Hello() { ... } where MyFile.xml looks like this : <TestMembers> <TestMember> <Name>Hello</Name> <id>1234</id> <MyComplexRow> <MySerializedInstanceOfClass> <BooleanProperty>true</BooleanProperty> <IntProperty>8<

Data driven tests using nested xml data file

孤街醉人 提交于 2019-12-11 06:59:02
问题 I need to write a unit test driven by a data file that contains collections of data. For obvious reasons a csv file isn't appropriate, but XML suggests itself. However I can't seem to get it to work. Here's a fragment of the data file (only one test record shown): <?xml version="1.0" encoding="utf-8" ?> <testData> <testRecord> <displayColumnNames> <name>Include</name> <name>SampleInt1</name> <name>SampleInt2</name> <name>SampleInt3</name> <name>SampleInt4</name> <name>SampleInt5</name> <

Robot Framework data-driven automation testing: Can data derived from a database be used as a data source for a test template?

不打扰是莪最后的温柔 提交于 2019-12-06 15:59:07
问题 I am familiar with using template keywords in data-driven Robot Framework testing and know that external sources of data such as text files and csv files can be used to provide test data. However, the organisation I work for wants to use data held in a database as a source for test case data. Does anybody know if this is possible? I have searched Stack Exchange, Stack Overflow and other resources but cannot find an answer or any examples. Here is an example of the data-driven approach I am

Robot Framework data-driven automation testing: Can data derived from a database be used as a data source for a test template?

你。 提交于 2019-12-04 23:26:44
I am familiar with using template keywords in data-driven Robot Framework testing and know that external sources of data such as text files and csv files can be used to provide test data. However, the organisation I work for wants to use data held in a database as a source for test case data. Does anybody know if this is possible? I have searched Stack Exchange, Stack Overflow and other resources but cannot find an answer or any examples. Here is an example of the data-driven approach I am familiar just to give you an idea of where we are now. *** Settings *** Library Selenium2Library Library

Problems with data driven testing in MSTest

天涯浪子 提交于 2019-12-04 20:34:13
问题 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", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=GoogleTestData.xls;Persist Security Info=False;Extended Properties='Excel 8.0'", "TestSearches$", DataAccessMethod.Sequential)] [TestMethod]

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

旧巷老猫 提交于 2019-12-04 17:02:42
问题 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 that enables getting info for the current iteration from the data source, but I don't see any property that gives me what I need. 回答1: Try this: int currentIteration = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow); 回答2: private

Java TestNG with Data Driven Testing Across Multiple Tests

冷暖自知 提交于 2019-12-04 06:32:54
问题 I have a series of stores that I am testing in an ecommerce platform, and each store has a series of properties that I am looking at automating a test for. Is it possible to have a data provider that gives data across a test suite instead of just a test in TestNG? I'm trying not to use the testNG.xml file as mechanism because these properties are coming directly from a database call. ["StoreName", "username", "password", "credit-enabled", "items-store", "shipping-location", ] What I need the