[ARO] Adding a feature to make tester able to create their own test#81
[ARO] Adding a feature to make tester able to create their own test#81erbizard wants to merge 3 commits intomicrosoftly:devfrom
Conversation
| const functionCollection: Function[] = this.expectedResponseCollection as Function[]; | ||
| let errorString = ''; | ||
| let success = false; | ||
| functionCollection.forEach((func: Function) => { |
There was a problem hiding this comment.
Have you tried bluebird Promise.map to allow for promise cases?
There was a problem hiding this comment.
Yes, but we are in the promise context, the "this.internalExpectation.expect(success, error).toBeTrue();" create an error but test still a success
src/ExpectedMessage.ts
Outdated
| * Verfy the incoming message with custom test defined by tester | ||
| * If the function that tester defined return an error, make the test break | ||
| * If the function return anything else, the test is considered as good | ||
| * I've tryed to use promise as parameter, but in a promise we change scope, so the assert doesn't work |
There was a problem hiding this comment.
[nit] spelling error tryed -> tried
|
please add tests to the |
|
I think it would be helpful to make a unique case to assert against. For instance botTester.sendMessageToBot('something', (message) => {
// do things
return 'hello'
}, 'hello')so that we know what to assert against. A bool return type could be used, but then we lose the benefit of good messaging on failures. |
|
Like I said in my first comment, I'm unable to run your test, and create test without testing them is little bit strange. maybe for your second comment, I can make a process if function return String, to make a better assert. |
fb63b7f to
9a7064f
Compare
|
If an error is thrown inside a test step, that step will be recorded as an error. If a dev wants to fail in their test, that approach would still work |
|
I can also assure you that the tests do work and your changes break existing functionality. Check out the CI tests -> https://circleci.com/gh/microsoftly/BotTester/242?utm_campaign=vcs-integration-link&utm_medium=referral&utm_source=github-build-link |
9a7064f to
1ee88fe
Compare
|
My last commit got some bug, you right, but i need to start your CI every time i need to test, cause your tests commands doesn't work, atm i don't know how your ci chain is defined, but on my computer your testing routing didn't lauch, after short look i've tried to make them work by changing your "ts-node": "^3.1.0" version, that got 4 majors version late, but nothing make it work. For the return I might check soon, but i've not many time. |
|
Also, no existing functionality were engaged in all my commit, there's only my dev that break every time |
|
That error is strange considering it can transpile just fine. Can you show the error stack? What |
|
You're also correct, I think one of the tests must be flaky |
|
"version": "3.3.0" $ ./node_modules/mocha/bin/_mocha --require node_modules/ts-node/register test/**/*.mocha.spec.ts C:\Users\arthur.rouet\Desktop\Angie-bot\BOT_Hello_Eng-master\BotTester\node_modules\ts-node\src\index.ts:307 |
|
I've also thought to a upgrade for this, just return an array with [excepted,got] results, to make the assert better on this feature. that can make better than just a string, in case of check on carousel, heroCards ... etc If you are okay with that, i can implement this before the end of the week I think. |
|
Are you on windows? I'd imagine that could be a source of the bug. I've not tested outside of an *nix env |
|
Yes I'm on windows |
|
But Unit test isn't a problem actually, I've made them and the coverage is okay. The only issue I can see her is the excepted bool to the assert that i'm going to change. When this going to be done i'll post a comment on this trend so you'll be notified. |
I was unable to make UT, caus every testing command in the package.json return error.
If you got any tips to start them i'm completly open to write them