-
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
Support multiple assertion libraries/test runners for the TestAdapter class #100
Comments
If you have some thoughts for how to achieve that I'd love to see a PR. Look at the TestAdapter in the M2 branch though. |
Was just working on getting better code coverage on the TestAdapter and we'll need to do some re-factoring to support alternate frameworks. Should be just a matter of abstracting out the adapters internal calls to assert. Again open to feedback on how to approach this. |
I would recommend something like the implementation in the BotTester framework; define an interface for an expectation, e.g. export interface IExpectation {
notToBeEmpty(): void;
toEqual(value: {}): void;
toInclude(value: {}): void;
toBeTrue(): void;
toDeeplyInclude(value: {}): void;
} Then for each assertion library, implement accordingly. Using examples from my repo:
For some frameworks like ava, you will need to expose a test context. These can be passed in when constructing the test adapter. Lastly, the end user needs a way of defining which library to use (you can always default to assert or some other frequently used library like chai). This can be done by passing in test options to the test Object, all with standard defaults. To go even further, a config file that exposes test options can be useful as well (e.g. set timeout, default address, test framework, etc ...) can give the end user many options for how to configure their tests. |
If you're okay with this approach, I can help with the dev |
@microsoftly if you'd like to take a crack at re-working the |
Closing old issue |
Users of the BotTester framework found it useful to be able to use different testing frameworks when running their tests. While its internal chai solution would throw an error when assertions failed, users still requested the ability to have support for multiple libraries.
For reference, here's the issue thread on the BotTester framework repo.
The text was updated successfully, but these errors were encountered: