Skip to content

Instantly share code, notes, and snippets.

@vitoc
Last active April 15, 2017 02:11
Show Gist options
  • Save vitoc/22d3888a485e35b4fbd553d406e105e8 to your computer and use it in GitHub Desktop.
Save vitoc/22d3888a485e35b4fbd553d406e105e8 to your computer and use it in GitHub Desktop.
Web Test example used to load test Microsoft Bot Framework based bot via DirectLine API
<?xml version="1.0" encoding="utf-8"?>
<WebTest Name="WebTest" Id="" Owner="" Priority="" Enabled="True" CssProjectStructure="" CssIteration="" Timeout="0" WorkItemIds="" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010" Description="" CredentialUserName="" CredentialPassword="" PreAuthenticate="True" Proxy="default" StopOnError="False" RecordedResultFile="" ResultsLocale="">
<Items>
<Request Method="POST" Guid="" Version="1.1" Url="https://directline.botframework.com/api/conversations" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False">
<DependentRequests>
<Request Method="POST" Guid="" Version="1.1" Url="https://directline.botframework.com/api/conversations/{{ConvID}}/messages" ThinkTime="0" Timeout="300" ParseDependentRequests="True" FollowRedirects="True" RecordResult="True" Cache="False" ResponseTimeGoal="0" Encoding="utf-8" ExpectedHttpStatusCode="0" ExpectedResponseUrl="" ReportingName="" IgnoreHttpStatusCode="False">
<Headers>
<Header Name="Authorization" Value="Bearer " />
</Headers>
<FormPostHttpBody>
<FormPostParameter Name="text" Value="hello" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
<FormPostParameter Name="from" Value="user1" RecordedValue="" CorrelationBinding="" UrlEncode="True" />
</FormPostHttpBody>
</Request>
</DependentRequests>
<Headers>
<Header Name="Authorization" Value="Bearer " />
</Headers>
<ExtractionRules>
<ExtractionRule Classname="Amido.PerformanceTests.Common.JsonExtractionRule, JsonExtractionRule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" VariableName="ConvID" DisplayName="JSON Extraction Rule" Description="Extracts the specified JSON value from an object.">
<RuleParameters>
<RuleParameter Name="Name" Value="conversationId" />
</RuleParameters>
</ExtractionRule>
</ExtractionRules>
<FormPostHttpBody />
</Request>
</Items>
</WebTest>
@vitoc
Copy link
Author

vitoc commented Dec 28, 2016

Replace Authorization value with DirectLine secret. See: https://docs.botframework.com/en-us/restapi/directline/

This is a Visual Studio Web Test. You will need to compile the JSON extraction rule class (here: https://gist.github.com/RichardSlater/8669705) and add a reference to that to your project to run the test (each agent in the test establishes a conversation, extracts the conversation ID from the JSON response and subsequently send a message again with the conversation ID).

@EricDahlvang
Copy link

Please do not load test the DirectLine. It is a shared resource.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment