-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PORT] Add LG telemetry #2451
[PORT] Add LG telemetry #2451
Conversation
Pull Request Test Coverage Report for Build 154271
💛 - Coveralls |
libraries/botbuilder-dialogs-adaptive/src/actions/beginSkill.ts
Outdated
Show resolved
Hide resolved
libraries/botbuilder-dialogs-adaptive/src/actions/beginSkill.ts
Outdated
Show resolved
Hide resolved
libraries/botbuilder-dialogs-adaptive/src/actions/beginSkill.ts
Outdated
Show resolved
Hide resolved
libraries/botbuilder-dialogs-adaptive/src/actions/httpRequest.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🕐
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes @Danieladu. Can you add some unit tests for them?
@tomlm these telemetry client calls in BeginSkill
and HttpRequest
don't exist in the .NET implementation. Can you review this PR and determine if we want to port them over to .NET?
HttpRequest.ReplaceJTokenRecursivelyAsync()
BeginSkill.BeginDialogAsync()
@chrimc62, should the telemetryClient calls in BeginSkill and HttpRequest be ported back to C#? |
Yes if they are here only. In reply to: 655837544 [](ancestors = 655837544) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Danieladu unit tests? 🕐
Sorry for the delay. i hope I can add some unit tests in the next few days. |
maybe mock a telemetry client and assert the mock client is been called with expected data? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see feedback for guidance on authoring tests along with examples.
libraries/botbuilder-dialogs-adaptive/tests/lgTelemetry.test.js
Outdated
Show resolved
Hide resolved
|
||
it('basic telemetry test', () => { | ||
const mockDialog = new MockDialog(); | ||
mockDialog.telemetryClient = new MockTelemetryClient(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since a Dialog will automatically have at least a NullTelemetryClient, you can use sinon
to stub out the trackEvent
method on dialogInstance.telemetryClient
.
const { stub } = require('sinon');
const trackEventStub = stub(mockDialog.telemetryClient, 'trackEvent');
// Later after the method that calls trackEvent finishes
assert(trackEventStub.called);
And use a captureAction to verify the stub's input.
There are also examples in botframeworkAdapter.test.js and the skillDialog.test.js files. The SkillDialog tests may be more helpful and will show an example closer to what @boydc2014 suggested. Additionally, the tests for SkillDialog in JS are extremely close to the tests in .NET (see SkillDialogTests.cs), so that may help in authoring tests for the LG Telemetry changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have added some telemetry tests in skillDialog.test.js. Please take a look. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Danieladu the updates to the BeginSkill
tests looks great, can you move createTelemetryClientAndStub()
to a utilities file since that capture action is self contained and then use it for the other tests as well?
return [skillClient, postActivityStub]; | ||
} | ||
|
||
function createtelemetryClientAndStub(captureTelemetryAction) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you make the function name pascal cased? createTelemetryClientAndStub
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test changes look good so far, per my comment can you apply do some small refactoring to reuse the test logic to add tests for the other changes in this PR?
Fixes #1864
Add LG telemetry