Skip to content

Commit 25e704d

Browse files
authored
[#409] Update docs based on feedback (#472)
* Update documentation * Update variables and TestRunner docs * Fix file paths * Fix typo in TranscriptConverter's Readme
1 parent 1ad4014 commit 25e704d

10 files changed

+227
-216
lines changed

Docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
## Guides
88

99
- [Add a Service Connection to an Azure Resource Manager](./addARMServiceConnection.md)
10-
- [Create WebApp Deployment credentials](./createWebAppDeploymentCredentials.md)
1110
- [Get the Service Principal's Object ID](./getServicePrincipalObjectID.md)
11+
- [Setup App Registrations](./setupAppRegistrations.md)
1212
- [Setup Pipelines](./setupPipelines.md)
1313
- [Setup custom Docker container](./setupDockerContainer.md)
1414
- [Regional Virtual Network integration](./regionalVirtualNetworkIntegration.md)

Docs/addARMServiceConnection.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,18 @@ Go to [Service connections](https://docs.microsoft.com/en-us/azure/devops/pipeli
99
## Requirements
1010

1111
- An [Azure DevOps Organization](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/create-organization?view=azure-devops).
12+
- An [Azure AD application and Service Principal](https://docs.microsoft.com/en-us/azure/active-directory/develop/howto-create-service-principal-portal) (*).
1213
- Access to an active [Azure Resource Manager](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/overview).
1314

15+
(*) The Service Principal needs to have a `Contributor` role in the suscription to be able to create resource groups.
16+
1417
## Steps
1518

1619
- From your Azure DevOps project, go to `Project settings -> Service Connections -> New Service connection`.
1720

1821
![addARMServiceConnection1](./media/addARMServiceConnection1.png)
1922

20-
- Select `Azure Resource Manager -> Service principal (manual)` and fill out the form. Check the `Grant access permission to all pipelines` option. The name you use for the Subscription Name field will be your `AzureSubscription` variable in the pipelines.
23+
- Select `Azure Resource Manager -> Service principal (manual)` and fill out the form. Check the `Grant access permission to all pipelines` option. The name you use for the Subscription Name field will be your `AzureSubscription` variable in the pipelines. [More Info](https://docs.microsoft.com/en-us/azure/devops/pipelines/library/connect-to-azure?view=azure-devops#create-an-azure-resource-manager-service-connection-with-an-existing-service-principal).
2124

2225
![addARMServiceConnection2](./media/addARMServiceConnection2.png)
2326

Docs/availableBotsList.md

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Available Bots
2+
These are the bots currently available. This list will be expanded in the future.
3+
4+
### Bot Names
5+
- DotNet
6+
- Consumers
7+
- BffnSimpleComposerHostBotDotNet
8+
- BffnSimpleHostBotDotNet
9+
- BffnSimpleHostBotDotNet21
10+
- BffnWaterfallHostBotDotNet
11+
- Skills
12+
- BffnEchoComposerSkillBotDotNet
13+
- BffnEchoSkillBotDotNet
14+
- BffnEchoSkillBotDotNet21
15+
- BffnEchoSkillBotDotNetV3
16+
- BffnWaterfallSkillBotDotNet
17+
18+
- JS
19+
- Consumers
20+
- BffnSimpleHostBotJS
21+
- BffnWaterfallHostBotJS
22+
- Skills
23+
- BffnEchoSkillBotJS
24+
- BffnEchoSkillBotJSV3
25+
- BffnWaterfallSkillBotJS
26+
27+
- Python
28+
- Consumers
29+
- BffnSimpleHostBotPython
30+
- BffnWaterfallHostBotPython
31+
- Skills
32+
- BffnEchoSkillBotPython
33+
- BffnWaterfallSkillBotPython

Docs/createWebAppDeploymentCredentials.md

-18
This file was deleted.

Docs/media/CreateAppRegistrations.ps1

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Write-Host "You will be prompted to login into your Azure account to create App
22
az login
33

44
$defaultPrefix = "generic-app-registration"
5-
$defaultAmount = 14
5+
$defaultAmount = 18
66
$appRegistrations = @()
77
do {
88
$prefix = Read-Host -Prompt "App Registrations prefix ('$defaultPrefix' by default)"

Docs/media/dependenciesParameters.png

52.9 KB
Loading

Docs/pipelines.md

+91-96
Large diffs are not rendered by default.

Docs/setupAppRegistrations.md

+12-40
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# How to setup up App Registrations
1+
# How to setup App Registrations
22

33
The following steps will guide you on how to manually set up App Registrations.
44
By default, App Registrations are created and used automatically across the [pipelines](./pipelines.md), but the possibility of setting them up manually is available.
@@ -16,12 +16,12 @@ To skip stages, simple click on Stages to run, deselect them, and click Use sele
1616

1717
## Create App Registrations
1818

19-
App Registration credentials must be created for each bot to be deployed and tested (there are fourteen currently, but the number is expected to increase in the future).
19+
App Registration credentials must be created for each bot to be deployed and tested (see [Available Bots](./availableBotsList.md)).
2020
To do this, you could head to [App Registrations](https://portal.azure.com/#blade/Microsoft_AAD_RegisteredApps/ApplicationsListBlade) on Azure and create them one by one, but we created a PowerShell script to create registration batches automatically. The only requirement to run it is to have access to an active Azure account.
2121

2222
Click [here](./media/CreateAppRegistrations.ps1) to go to the script.
2323

24-
Executing it will prompt you to log into your account with your default browser, then to define a prefix for the registration names, and finally for the amount of registrations to create. Both have default values (triggered by pressing Enter) to accommodate for the creation of fourteen credentials with generic names.
24+
Executing the script will prompt you to log into your account with your default browser, then to define a prefix for the registration names, and finally for the amount of registrations to create. Both have default values (triggered by pressing Enter) to accommodate for the creation of eighteen credentials with generic names.
2525
The creation process will start, displaying each registration's name, ID, and password created while running.
2626

2727
![setupAppRegistrations2](media/setupAppRegistrations2.png)
@@ -40,49 +40,21 @@ If you didn't have any variables set up already, it will look like the picture o
4040

4141
![setupAppRegistrations4](media/setupAppRegistrations4.png)
4242

43-
The following list contains all current variable names to be created, each credential pair can be populated with any of the ones created in the [Create App Registrations](#create-app-registrations) step.
44-
43+
You must create a pair of variables for each bot in the [list of available bots](./availableBotsList.md) adding `AppId` and `AppSecret` to the bot's name.
44+
For example:
4545
- BffnEchoSkillBotComposerDotNetAppId
4646
- BffnEchoSkillBotComposerDotNetAppSecret
47-
- BffnEchoSkillBotDotNet21AppId
48-
- BffnEchoSkillBotDotNet21AppSecret
49-
- BffnEchoSkillBotDotNetAppId
50-
- BffnEchoSkillBotDotNetAppSecret
51-
- BffnEchoSkillBotDotNetV3AppId
52-
- BffnEchoSkillBotDotNetV3AppSecret
53-
- BffnEchoSkillBotJSAppId
54-
- BffnEchoSkillBotJSAppSecret
55-
- BffnEchoSkillBotJSV3AppId
56-
- BffnEchoSkillBotJSV3AppSecret
57-
- BffnEchoSkillBotPythonAppId
58-
- BffnEchoSkillBotPythonAppSecret
59-
- BffnSimpleHostBotComposerDotNetAppId
60-
- BffnSimpleHostBotComposerDotNetAppSecret
61-
- BffnSimpleHostBotDotNet21AppId
62-
- BffnSimpleHostBotDotNet21AppSecret
63-
- BffnSimpleHostBotDotNetAppId
64-
- BffnSimpleHostBotDotNetAppSecret
65-
- BffnSimpleHostBotJSAppId
66-
- BffnSimpleHostBotJSAppSecret
67-
- BffnSimpleHostBotPythonAppId
68-
- BffnSimpleHostBotPythonAppSecret
69-
- BffnWaterfallHostBotDotNetAppId
70-
- BffnWaterfallHostBotDotNetAppSecret
71-
- BffnWaterfallSkillBotDotNetAppId
72-
- BffnWaterfallSkillBotDotNetAppSecret
47+
48+
Each credential pair can be populated with any of the ones created in the [Create App Registrations](#create-app-registrations) step.
7349

7450
Don't forget to click on SAVE once you've finished setting up every variable.
7551

7652
![setupAppRegistrations5](media/setupAppRegistrations5.png)
7753

7854
Lastly, you'll have to create new variables for the [Run Test Scenarios](../build/yaml/testScenarios/runTestScenarios.yml), same steps apply.
79-
This pipeline requires only the App Registration IDs of the skill bots, so the list is shorter. Just be sure to use the same IDs as with the [Deploy Bot Resources](../build/yaml/deployBotResources/deployBotResources.yml) pipeline.
80-
55+
This pipeline requires only the App Registration IDs of the skill bots, so the list is shorter.
56+
For example:
8157
- BffnEchoSkillBotComposerDotnetAppId
82-
- BffnEchoSkillBotDotNet21AppId
83-
- BffnEchoSkillBotDotNetAppId
84-
- BffnEchoSkillBotDotNetV3AppId
85-
- BffnEchoSkillBotJSAppId
86-
- BffnEchoSkillBotJSV3AppId
87-
- BffnEchoSkillBotPythonAppId
88-
- BffnWaterfallSkillBotDotNetAppId
58+
59+
Just be sure to use the same IDs as with the [Deploy Bot Resources](../build/yaml/deployBotResources/deployBotResources.yml) pipeline.
60+
+56
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Transcript Converter
2+
3+
## Summary
4+
5+
Transcript Converter is a command line tool to convert `.transcript` files from different channels (BotFramework-Emulator, Teams, Slack, etc.)* into a test script used to replicate the messages sent by the user and evaluate the answers from the bot.
6+
This test script is the input for the [Transcript Test Runner](../TranscriptTestRunner/TranscriptTestRunner.csproj).
7+
8+
(*) _This first version supports BotFramework-Emulator transcript files. Stay tuned for the next features._
9+
10+
## The Test Script
11+
A Test Script is basically a JSON file with an array of [TestScriptItem](TestScriptItem.cs) that will be used by the `TranscriptTestRunner` as a test input.
12+
13+
You can also create a test script file using this [JSON schema](../TranscriptTestRunner/testscript.schema).
14+
```json
15+
[
16+
{
17+
"type": "conversationUpdate",
18+
"role": "user"
19+
},
20+
{
21+
"type": "message",
22+
"role": "bot",
23+
"text": "Hello and welcome!",
24+
"assertions": [
25+
"type == 'message'",
26+
"from.role == 'bot'",
27+
"recipient.role == 'user'",
28+
"text == 'Hello and welcome!'",
29+
"inputHint == 'acceptingInput'"
30+
]
31+
},
32+
{
33+
"type": "message",
34+
"role": "user",
35+
"text": "Hi"
36+
}
37+
]
38+
```
39+
> **Note:** The JSON Schema is still a work in progress.
40+
41+
## User Step-by-step Guide
42+
This step-by-step guide shows how to convert a BotFramework-Emulator transcript file into a test script.
43+
44+
1- After installing the tool open a terminal and execute the following command:
45+
46+
```
47+
btc convert "path-to-source-transcript" "path-to-target-test-script"
48+
```
49+
- The first argument is the absolute or relative path to the transcript file.
50+
To create a transcript file, follow [these steps](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-debug-transcript?view=azure-bot-service-4.0#creatingstoring-a-bot-transcript-file).
51+
52+
- The second argument is optional, and sets the path to the folder where the test script will be created. If not provided, the test script will have the same name and location that the transcript.
53+
54+
2- Once the Test Script file is created, store it in a folder on your test project and pass it to the _RunTestAsync_ method of the `TestRunner` to execute the test.
55+
56+

Libraries/TranscriptTestRunner/README.md

+29-59
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,15 @@
33
## Summary
44

55
Transcript Test Runner aims to simplify complex conversation scenarios against bots.
6-
Starting from a transcript file containing the user-bot interactions to be tested, the Transcript Test Runner converts the transcript into a test script used to replicate the messages sent by the user and evaluate the answers from the bot.
6+
Starting from a [test script](testscript.schema) file containing the user-bot interactions to be tested, the Transcript Test Runner replicates the messages sent by the user and evaluates the answers from the bot.
77

8-
The Transcript Test Runner also offers the possibility of running the tests directly from a [test script](testscript.schema), adding flexibility to the assertions for the bot's messages.
9-
10-
The Test Runner supports different formats of transcript files (Emulator, Teams, Slack, etc.) and
11-
can be connected to the bots using different channels (*):
12-
- DirectLineClient
13-
- TeamsClient
14-
- SlackClient
15-
- FacebookClient
16-
17-
(*) _This first version implements the DirectLineClient and uses Emulator transcript files. Stay tuned for the next features._
8+
A Test Script is basically a JSON file with an array of [TestScriptItem](TestScriptItem.cs) that will be used by the `TestRunner` as a test input.
189

1910
## User Step-by-step Guide
20-
This step-by-step guide shows how to run a test with the `TestRunner` configuring a `DirectLine` client to communicate with the bots, and starting from an Emulator transcript file.
11+
This step-by-step guide shows how to run a test with the `TestRunner` configuring a `DirectLine` client to communicate with the bots.
12+
13+
### Creating the Test Script file
14+
You can convert a transcript file into a test script using the [Transcript Converter](../TranscriptConverter/TranscriptConverter.csproj) tool or create one manually using this [JSON schema](testscript.schema).
2115

2216
### Using the TestRunner
2317
1- Open your test project and install the `TranscriptTestRunner` package.
@@ -32,65 +26,37 @@ This step-by-step guide shows how to run a test with the `TestRunner` configurin
3226

3327
> **Note:** For more information on how to obtain the bot `DIRECTLINE` secret key, follow [this guide](https://docs.microsoft.com/en-us/azure/bot-service/bot-service-channel-connect-directline).
3428
35-
3- Add the `Emulator Transcript` file in a folder on your test project. To create a transcript file, follow [these steps](https://docs.microsoft.com/en-us/azure/bot-service/bot-builder-debug-transcript?view=azure-bot-service-4.0#creatingstoring-a-bot-transcript-file).
29+
3- Add the `Test Script` file in a folder on your test project.
3630

3731
4- Add the `TestRunner` to your test.
3832

3933
```csharp
34+
// Create the test options
35+
var options = new DirectLineTestClientOptions { BotId = "<bot-id>", DirectLineSecret = "<direct-line-secret>" };
36+
4037
// Create a DirectLine client with the `TestClientFactory`.
41-
var directLineClient = new TestClientFactory(ClientType.DirectLine).GetTestClient();
38+
var directLineClient = new TestClientFactory(ClientType.DirectLine, options).GetTestClient();
4239

4340
// Instantiate the TestRunner and set up the DirectLine client.
4441
var runner = new TestRunner(directLineClient);
4542

46-
// Run the test recorded in the transcript file.
47-
await runner.RunTestAsync("<path to the transcript file>");
48-
```
49-
The `TestRunner` will convert the transcript file into a Test Script with the messages the user sends to the bot and the assertions that should be made to the bot's answers.
50-
51-
The `TestRunner` also allows you to run the test from a custom Test Script file.
52-
53-
### Using a Test Script file
54-
A Test Script is basically a JSON file with an array of [TestScriptItem](TestScriptItem.cs) that will be used by the `TestRunner` as a test input.
55-
56-
Create a test script file using this [JSON schema](testscript.schema).
57-
```json
58-
[
59-
{
60-
"type": "conversationUpdate",
61-
"role": "user"
62-
},
63-
{
64-
"type": "message",
65-
"role": "bot",
66-
"text": "Hello and welcome!",
67-
"assertions": [
68-
"type == 'message'",
69-
"from.role == 'bot'",
70-
"recipient.role == 'user'",
71-
"text == 'Hello and welcome!'",
72-
"inputHint == 'acceptingInput'"
73-
]
74-
},
75-
{
76-
"type": "message",
77-
"role": "user",
78-
"text": "Hi"
79-
}
80-
]
43+
// Run the test recorded in the test script file.
44+
await runner.RunTestAsync("<path to the test script file>");
8145
```
82-
> **Note:** The JSON Schema is still a work in progress.
46+
The `TestRunner` will execute test script sending the user messages to the bot performing the assertions over the bot's answers.
8347

84-
Once the Test Script file is created, store it in a folder on your test project and pass it to the _RunTestAsync_ method of the TestRunner instead of the transcript file.
8548

8649
### Creating tests programmatically
87-
The `TestRunner` allows you to run tests in a programmatic way, sending Activities to the bot and Assert its reply.
50+
The `TestRunner` allows you to run tests in a programmatic way, sending Activities to the bot and asserting its reply.
8851

8952
The following sample shows how to create a simple test programmatically.
9053

9154
```csharp
55+
// Create the test options
56+
var options = new DirectLineTestClientOptions { BotId = "<bot-id>", DirectLineSecret = "<direct-line-secret>" };
57+
9258
// Create a DirectLine client instance that will be used to communicate with your bot.
93-
var directLineClient = new TestClientFactory(ClientType.DirectLine).GetTestClient();
59+
var directLineClient = new TestClientFactory(ClientType.DirectLine, options).GetTestClient();
9460

9561
// Instantiate the TestRunner and set up the DirectLine client.
9662
var runner = new TestRunner(directLineClient);
@@ -119,8 +85,10 @@ This method is used when your bot has an authentication implementation and you w
11985
The following sample shows how to use the `ClientSignInAsync` method to sign in.
12086

12187
```csharp
88+
// Create the test options.
89+
var options = new DirectLineTestClientOptions { BotId = "<bot-id>", DirectLineSecret = "<direct-line-secret>" };
12290
// Create a DirectLine client instance that will be used to communicate with your bot.
123-
var directLineClient = new TestClientFactory(ClientType.DirectLine).GetTestClient();
91+
var directLineClient = new TestClientFactory(ClientType.DirectLine, options).GetTestClient();
12492
// Instantiate the TestRunner and set up the DirectLine client.
12593
var runner = new TestRunner(directLineClient);
12694
var signInUrl = string.Empty;
@@ -168,20 +136,22 @@ var loggerFactory = LoggerFactory.Create(builder =>
168136
// Create the `Logger` instance with a Category name.
169137
var logger = loggerFactory.CreateLogger("Category");
170138

139+
// Create the test options
140+
var options = new DirectLineTestClientOptions { BotId = "<bot-id>", DirectLineSecret = "<direct-line-secret>" };
171141
// Create a DirectLine client instance that will be used to communicate with your bot.
172-
var directLineClient = new TestClientFactory(ClientType.DirectLine).GetTestClient();
142+
var directLineClient = new TestClientFactory(ClientType.DirectLine, options).GetTestClient();
173143
// Instantiate the TestRunner, set up the DirectLine client, and send the created `Logger`.
174-
var runner = new TestRunner(directLineClient, logger);
144+
var runner = new TestRunner(directLineClient, logger = logger);
175145
```
176146

177147
### Extend TestRunner functionality
178-
TestRunner has an Xunit extention to allow the users that prefer this test framework, to override the `AssertActivityAsync` with Xunit assertions.
148+
TestRunner has an Xunit extension to allow the users that prefer this test framework, to override the `AssertActivityAsync` with Xunit assertions.
179149

180150
```csharp
181151
public class XUnitTestRunner : TestRunner
182152
{
183-
public XUnitTestRunner(TestClientBase client, ILogger logger = null)
184-
: base(client, logger)
153+
public XUnitTestRunner(TestClientBase client, int replyTimeout = 180000, int thinkTime = 0, ILogger logger = null)
154+
: base(client, replyTimeout, thinkTime, logger)
185155
{
186156
}
187157

0 commit comments

Comments
 (0)