Skip to content

Commit 408eeaa

Browse files
committed
merge from master
2 parents b918f02 + 51b0781 commit 408eeaa

37 files changed

+302
-827
lines changed

.openpublishing.redirection.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2065,6 +2065,16 @@
20652065
"redirect_url": "/visualstudio/test/create-and-run-unit-tests-for-a-store-app-in-visual-studio/",
20662066
"redirect_document_id": false
20672067
},
2068+
{
2069+
"source_path": "docs/test/test-windows-phone-8-1-apps-with-coded-ui-tests.md",
2070+
"redirect_url": "/visualstudio/test/test-uwp-app-with-coded-ui-test",
2071+
"redirect_document_id": false
2072+
},
2073+
{
2074+
"source_path": "docs/test/test-windows-store-8-1-apps-with-coded-ui-tests.md",
2075+
"redirect_url": "/visualstudio/test/test-uwp-app-with-coded-ui-test",
2076+
"redirect_document_id": false
2077+
},
20682078
{
20692079
"source_path": "docs/test/troubleshooting-code-analysis-issues.md",
20702080
"redirect_url": "/visualstudio/code-quality/analyzing-application-quality-by-using-code-analysis-tools",

docs/test/creating-a-data-driven-coded-ui-test.md

Lines changed: 17 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,27 @@ ms.date: 11/04/2016
44
ms.prod: visual-studio-dev15
55
ms.technology: vs-ide-test
66
ms.topic: conceptual
7-
helpviewer_keywords:
7+
helpviewer_keywords:
88
- "coded UI tests, data-driven"
99
author: gewarren
1010
ms.author: gewarren
1111
manager: douge
12-
ms.workload:
12+
ms.workload:
1313
- "multiple"
1414
---
15-
# Creating a Data-Driven Coded UI Test
15+
# Create a Data-Driven Coded UI Test
1616

1717
To test different conditions, you can run your tests multiple times with different parameter values. Data-driven coded UI tests are a convenient way to do this. You define parameter values in a data source, and each row in the data source is an iteration of the coded UI test. The overall result of the test will be based on the outcome for all the iterations. For example, if one test iteration fails, the overall test result is failure.
1818

19-
**Requirements**
19+
**Requirements**
2020

21-
- Visual Studio Enterprise
21+
- Visual Studio Enterprise
2222

2323
## Create a data-driven coded UI test
24-
This sample creates a coded UI test that runs on the Windows Calculator application. It adds two numbers together and uses an assertion to validate that the sum is correct. Next, the assertion and the parameter values for the two numbers are coded to become data-driven and stored in a comma-separated value (.csv) file.
2524

26-
#### Step 1 - Create a coded UI test
25+
This sample creates a coded UI test that runs on the Windows Calculator application. It adds two numbers together and uses an assertion to validate that the sum is correct. Next, the assertion and the parameter values for the two numbers are coded to become data-driven and stored in a comma-separated value (.csv) file.
26+
27+
### Step 1 - Create a coded UI test
2728

2829
1. Create a project.
2930

@@ -87,7 +88,7 @@ To test different conditions, you can run your tests multiple times with differe
8788

8889
At this point, all the parameter values are defined in their methods as constants. Next, let's create a data set to make our test data-driven.
8990

90-
#### Step 2 - Create a data set
91+
### Step 2 - Create a data set
9192

9293
1. Add a text file to the dataDrivenSample project named `data.csv`.
9394

@@ -113,7 +114,7 @@ To test different conditions, you can run your tests multiple times with differe
113114

114115
Now that we have the data set created, let's bind the data to the test.
115116

116-
#### Step 3 - Add data source binding
117+
### Step 3 - Add data source binding
117118

118119
1. To bind the data source, add a `DataSource` attribute within the existing `[TestMethod]` attribute that is immediately above the test method.
119120

@@ -140,7 +141,7 @@ To test different conditions, you can run your tests multiple times with differe
140141

141142
Next, we'll configure the test to use the values in the data source file.
142143

143-
#### Step 4 - Use the data in the coded UI test
144+
### Step 4 - Use the data in the coded UI test
144145

145146
1. Add `using Microsoft.VisualStudio.TestTools.UITesting.WinControls` to the top of the CodedUITest.cs file:
146147

@@ -189,7 +190,7 @@ To test different conditions, you can run your tests multiple times with differe
189190

190191
3. Save the solution.
191192

192-
#### Step 5 - Run the data-driven test
193+
### Step 5 - Run the data-driven test
193194

194195
1. Verify that the test is now data-driven by running the test again.
195196

@@ -202,9 +203,10 @@ To test different conditions, you can run your tests multiple times with differe
202203
## Q & A
203204

204205
### <a name="CreateDataDrivenCUIT_QA_DataSourceAttributes"></a> What are the data source attributes for other data source types, such as SQL Express or XML?
205-
You can use the sample data source strings in the table below by copying them to your code and making the necessary customizations.
206206

207-
**Data Source Types and Attributes**
207+
You can use the sample data source strings in the table below by copying them to your code and making the necessary customizations.
208+
209+
**Data Source Types and Attributes**
208210

209211
- CSV
210212

@@ -226,20 +228,9 @@ To test different conditions, you can run your tests multiple times with differe
226228

227229
`[DataSource("System.Data.SqlClient", "Data Source=.\\sqlexpress;Initial Catalog=tempdb;Integrated Security=True", "Data", DataAccessMethod.Sequential), TestMethod]`
228230

229-
### Q: Can I use data-driven tests on my Windows Phone app?
230-
**A:** Yes. Data-driven Coded UI tests for Windows Phone are defined using the DataRow attribute on a test method. In the following example, x and y use the values of 1 and 2 for the first iteration and -1 and -2 for the second iteration of the test.
231-
232-
```csharp
233-
[DataRow(1, 2, DisplayName = "Add positive numbers")]
234-
[DataRow(-1, -2, DisplayName = "Add negative numbers")]
235-
[TestMethod]
236-
public void DataDrivingDemo_MyTestMethod(int x, int y)
237-
```
238-
239-
For more information, see [Use Data-driven coded UI tests on Windows Phone apps](../test/test-windows-phone-8-1-apps-with-coded-ui-tests.md#TestingPhoneAppsCodedUI_DataDriven).
240-
241231
### Q: Why can't I modify the code in the UIMap.Designer file?
242-
**A:** Any code changes you make in the UIMapDesigner.cs file will be overwritten every time you generate code using the UIMap - Coded UI Test Builder. In this sample, and in most cases, the code changes needed to enable a test to use a data source can be made to the test's source code file (that is, CodedUITest1.cs).
232+
233+
**A:** Any code changes you make in the UIMapDesigner.cs file will be overwritten every time you generate code using the UIMap - Coded UI Test Builder. In this sample, and in most cases, the code changes needed to enable a test to use a data source can be made to the test's source code file (that is, CodedUITest1.cs).
243234

244235
If you have to modify a recorded method, you must copy it to UIMap.cs file and rename it. The UIMap.cs file can be used to override methods and properties in the UIMapDesigner.cs file. You must remove the reference to the original method in the Coded UITest.cs file and replace it with the renamed method name.
245236

docs/test/developer-testing-scenarios.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ ms.date: 05/02/2017
44
ms.prod: visual-studio-dev15
55
ms.technology: vs-ide-test
66
ms.topic: conceptual
7-
helpviewer_keywords:
7+
helpviewer_keywords:
88
- "unit testing, create unit tests"
99
ms.author: gewarren
1010
manager: douge
11-
ms.workload:
11+
ms.workload:
1212
- "multiple"
1313
author: gewarren
1414
---
@@ -54,8 +54,7 @@ need.
5454

5555
* [Use UI Automation To Test Your Code](use-ui-automation-to-test-your-code.md)
5656
* [Get started creating, editing and maintaining a coded UI test](walkthrough-creating-editing-and-maintaining-a-coded-ui-test.md)
57-
* [Test UWP apps with Coded UI Tests](test-windows-store-8-1-apps-with-coded-ui-tests.md)
58-
* [Test Windows Phone Apps with Coded UI Tests](test-windows-phone-8-1-apps-with-coded-ui-tests.md)
57+
* [Test UWP apps with Coded UI Tests](test-uwp-app-with-coded-ui-test.md)
5958
* [Test SharePoint Applications with Coded UI Tests](testing-sharepoint-2010-applications-with-coded-ui-tests.md)
6059
* [Introduction to Coded UI Tests with Visual Studio Enterprise (Lab)](http://download.microsoft.com/download/6/2/B/62B60ECE-B9DC-4E8A-A97C-EA261BFB935E/Docs/Introduction%20to%20Coded%20UI%20Tests%20with%20Visual%20Studio%20Enterprise%202015.docx)
6160

Loading
7.04 KB
Loading
Loading

docs/test/media/automation-id.png

12.7 KB
Loading
44.8 KB
Loading
Loading

docs/test/media/cross-hair-tool.png

52.1 KB
Loading
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-11.7 KB
Binary file not shown.
-7.96 KB
Binary file not shown.
Binary file not shown.
-2.5 KB
Binary file not shown.
-16.6 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-8.95 KB
Binary file not shown.
6.01 KB
Loading
Loading
11.3 KB
Loading

docs/test/media/target-icon.png

504 Bytes
Loading
Loading

docs/test/media/toolbox-controls.png

10.8 KB
Loading
3.14 KB
Loading

docs/test/media/uwp-app.png

2.79 KB
Loading

0 commit comments

Comments
 (0)