Skip to content

Commit f3e5f5b

Browse files
author
gitName
committed
Further edits
1 parent 6acd24a commit f3e5f5b

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed

learn-pr/azure-devops/run-functional-tests-azure-pipelines/5-write-ui-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
### YamlMime:ModuleUnit
22
uid: learn.azdo.run-functional-tests-azure-pipelines.5-write-ui-tests
3-
title: Exercise - Write the UI tests
3+
title: Write the UI tests
44
metadata:
5-
title: Exercise - Write the UI tests
5+
title: Write the UI tests
66
description: Map manual testing steps to automated test cases by using Selenium.
77
ms.date: 05/07/2025
88
author: steved0x

learn-pr/azure-devops/run-functional-tests-azure-pipelines/includes/5-write-ui-tests.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ This diagram shows the `IWebDriver` interface and a few of the classes that impl
6565
6666
The diagram shows three of the methods that `IWebDriver` provides: `Navigate`, `FindElement`, and `Close`.
6767
68-
The three classes shown here, `ChromeDriver`, `FirefoxDriver`, and `EdgeDriver`, each implement `IWebDriver` and its methods. There are other classes, such as `SafariDriver`, that also implement `IWebDriver`. Each driver class can control the web browser that it represents.
68+
The three classes shown here`ChromeDriver`, `FirefoxDriver`, and `EdgeDriver`each implement `IWebDriver` and its methods. There are other classes, such as `SafariDriver`, that also implement `IWebDriver`. Each driver class can control the web browser that it represents.
6969
7070
Andy adds a member variable named `driver` to the `HomePageTest` class, like this code:
7171
@@ -224,7 +224,7 @@ private void ClickElement(IWebElement element)
224224
225225
### Define the test method
226226
227-
**Andy:** Now, we're ready to define the test method. Based on the manual tests that we ran earlier, let's call this method `ClickLinkById_ShouldDisplayModalById`. It's a good practice to give test methods descriptive names that define precisely what the test accomplishes. Here, we want to click a link defined by its `id` attribute. Then we want to verify that the proper modal window appears, also by using its `id` attribute.
227+
**Andy:** Now, we're ready to define the test method. Based on the manual tests that we ran earlier, let's call this method `ClickLinkById_ShouldDisplayModalById`. It's a good practice to give test methods descriptive names that define precisely what the test accomplishes. Here, we want to select a link defined by its `id` attribute. Then we want to verify that the proper modal window appears, also by using its `id` attribute.
228228
229229
Andy adds starter code for the test method:
230230
@@ -238,7 +238,7 @@ public void ClickLinkById_ShouldDisplayModalById(string linkId, string modalId)
238238
239239
**Amita:** I can handle this part. We want to:
240240
241-
1. Locate the link by its `id` attribute and then click the link.
241+
1. Locate the link by its `id` attribute and select the link.
242242
1. Locate the resulting modal.
243243
1. Close the modal.
244244
1. Verify that the modal was displayed successfully.
@@ -283,15 +283,15 @@ public void ClickLinkById_ShouldDisplayModalById(string linkId, string modalId)
283283
}
284284
```
285285
286-
**Amita:** The coding looks great so far. But how do we connect this test to the `id` attributes that we collected earlier?
286+
**Amita:** The coding looks great so far, but how do we connect this test to the `id` attributes that we collected earlier?
287287
288288
**Andy:** Great question. We'll handle that next.
289289
290290
### Define test case data
291291
292292
**Andy:** In NUnit, you can provide data to your tests in a few ways. Here, we use the `TestCase` attribute. This attribute takes arguments that it later passes back to the test method when it runs. We can have multiple `TestCase` attributes that each test a different feature of our app. Each `TestCase` attribute produces a test case that's included in the report that appears at the end of a pipeline run.
293293
294-
Andy adds these `TestCase` attributes to the test method. These attributes describe the **Download game** button, one of the game screens, and the top player on the leaderboard. Each attribute specifies two `id` attributes: one for the link to click and one for the corresponding modal window.
294+
Andy adds these `TestCase` attributes to the test method. These attributes describe the **Download game** button, one of the game screens, and the top player on the leaderboard. Each attribute specifies two `id` attributes: one for the link to select and one for the corresponding modal window.
295295
296296
```cs
297297
// Download game
@@ -306,7 +306,7 @@ public void ClickLinkById_ShouldDisplayModalById(string linkId, string modalId)
306306
...
307307
```
308308
309-
**Andy:** For each `TestCase` attribute, the first parameter is the `id` attribute for the link to click on. The second parameter is the `id` attribute for the modal window that we expect to appear. You can see how these parameters correspond to the two-string arguments in our test method.
309+
**Andy:** For each `TestCase` attribute, the first parameter is the `id` attribute for the link to select. The second parameter is the `id` attribute for the modal window that we expect to appear. You can see how these parameters correspond to the two-string arguments in our test method.
310310
311311
**Amita:** I do see that. With some practice, I think I can add my own tests. When can we see these tests running in our pipeline?
312312

learn-pr/azure-devops/run-functional-tests-azure-pipelines/includes/6-run-ui-tests.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ To run the tests locally:
8989

9090
1. In Visual Studio Code, go to the integrated terminal and open a new terminal window.
9191
1. Run the following commands in the new terminal window.
92+
9293
```dotnetcli
9394
dotnet build --configuration Release
9495
dotnet run --configuration Release --no-build --project Tailspin.SpaceGame.Web
9596
```
96-
1. Make a note of the local website link, in this example it is `http://localhost:5000`.
97+
98+
1. Make a note of the local website link; in this example, it's `http://localhost:5000`.
9799
1. Switch back to the terminal window where you set the environment variables in the previous step, and ensure that you're in your project's root directory. Here's an example:
98100
99101
```bash

learn-pr/azure-devops/run-functional-tests-azure-pipelines/includes/8-summary.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ You have set up UI tests that run on Windows. But you can also run your tests on
2727

2828
If you're interested in testing UI by using Selenium, check out these resources to help you go further:
2929

30-
* [SeleniumHQ.org](https://www.seleniumhq.org?azure-portal=true)
31-
* [Selenium IDE](https://www.seleniumhq.org/selenium-ide?azure-portal=true)
30+
* [SeleniumHQ.org](https://www.selenium.dev/?azure-portal=true)
31+
* [Selenium IDE](https://www.selenium.dev/selenium-ide/?azure-portal=true)
3232
* [UI test with Selenium](/azure/devops/pipelines/test/continuous-test-selenium?azure-portal=true)
3333
* [UI testing considerations](/azure/devops/pipelines/test/ui-testing-considerations?azure-portal=true&tabs=mstest)
3434
* [Use WebDriver to automate Microsoft Edge](/microsoft-edge/webdriver-chromium?azure-portal=true)

learn-pr/azure-devops/run-functional-tests-azure-pipelines/includes/code/6-azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ trigger:
33

44
variables:
55
buildConfiguration: 'Release'
6-
dotnetSdkVersion: '6.x'
6+
dotnetSdkVersion: '8.x'
77

88
stages:
99
- stage: 'Build'
@@ -18,7 +18,7 @@ stages:
1818

1919
variables:
2020
wwwrootDir: 'Tailspin.SpaceGame.Web/wwwroot'
21-
dotnetSdkVersion: '6.x'
21+
dotnetSdkVersion: '8.x'
2222

2323
steps:
2424
- task: UseDotNet@2

0 commit comments

Comments
 (0)