TestScript class
A mock Test Script that can be used for unit testing bot's logic.
- Extends
-
Configurable
Properties
| $kind | |
| configuration | Configuration to use for the test. |
| description | A description of the test sequence. |
| dialog | The dialog to use for the root dialog. |
| enable |
If true then trace activities will be sent to the test script. |
| http |
Gets the mock data for Microsoft.HttpRequest. |
| language |
Language policy. |
| locale | The locale (default: en-us). |
| script | The sequence of test actions to perform to validate the dialog behavior. |
| setting |
The mock data for settings. |
| user |
The mock data for Microsoft.OAuthInput. |
Methods
| default |
Build default test adapter. |
| execute(Resource |
Starts the execution of the test sequence. |
| get |
Inherited Methods
| configure(Record<string, unknown>) | Fluent method for configuring the object. |
Property Details
$kind
static $kind: string
Property Value
string
configuration
Configuration to use for the test.
configuration: Record<string, string>
Property Value
Record<string, string>
description
A description of the test sequence.
description: string
Property Value
string
dialog
The dialog to use for the root dialog.
dialog: Dialog
Property Value
Dialog
enableTrace
If true then trace activities will be sent to the test script.
enableTrace: boolean
Property Value
boolean
httpRequestMocks
Gets the mock data for Microsoft.HttpRequest.
httpRequestMocks: HttpRequestMock[]
Property Value
languagePolicy
Language policy.
languagePolicy: LanguagePolicy
Property Value
LanguagePolicy
locale
The locale (default: en-us).
locale: string
Property Value
string
script
The sequence of test actions to perform to validate the dialog behavior.
script: TestAction[]
Property Value
settingMocks
userTokenMocks
The mock data for Microsoft.OAuthInput.
userTokenMocks: UserTokenMock[]
Property Value
Method Details
defaultTestAdapter(string, Middleware[])
Build default test adapter.
function defaultTestAdapter(testName?: string, middlewares: Middleware[]): TestAdapter
Parameters
- testName
-
string
Name of test.
- middlewares
-
Middleware[]
Middlewares to be added to the adapter.
Returns
TestAdapter
Test adapter.
execute(ResourceExplorer, string, (context: TurnContext) => Promise<void>, TestAdapter, Middleware[])
Starts the execution of the test sequence.
function execute(resourceExplorer: ResourceExplorer, testName?: string, callback?: (context: TurnContext) => Promise<void>, adapter?: TestAdapter, middlewares: Middleware[]): Promise<void>
Parameters
- resourceExplorer
-
ResourceExplorer
The resource explorer to use.
- testName
-
string
Name of the test.
- callback
-
(context: TurnContext) => Promise<void>
The bot logic.
- adapter
-
TestAdapter
Optional test adapter.
- middlewares
-
Middleware[]
Middlewares to be added to the adapter.
Returns
Promise<void>
getConverter(Object)
function getConverter(property: Object): Converter | ConverterFactory
Parameters
- property
-
Object
The key of the conditional selector configuration.
Returns
Converter | ConverterFactory
The converter for the selector configuration.
Inherited Method Details
configure(Record<string, unknown>)
Fluent method for configuring the object.
function configure(config: Record<string, unknown>): this
Parameters
- config
-
Record<string, unknown>
Configuration settings to apply.
Returns
this
The Configurable after the operation is complete.
Inherited From Configurable.configure