-
Notifications
You must be signed in to change notification settings - Fork 1
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
testing guidlines #1
Comments
we should break down best practices and guilds for unit, functional, integration test. unit teststubbingfor unit test most external modules should be stubbed. the exceptions are util library like async, 101, ip, ...etc usagewe should stub in beforeEach and restore in afterEach
Assertsfor general value asserting
for funtions we should use functional testfunctional test should run the entire application and use integration testthese should be run without stubbing anything. runnable provides a great way to test with all our servers. |
I've at times failed to stub 100% of external method invocations of a function under test in a unit test. I'm going to make it a strong point to make sure all external method invocations to the method under test are stubbed whenever possible for unit tests. Thanks to @Myztiq I've also seen the light with Sinon's assertion and stub APIs (ie, when to use .returns and .yields) so I'll be using those from now on. |
I wholeheartedly agree with this sentiment. There are a bunch more things we should add here, like using |
will write something more once I have time :( prod issues |
I think I'm going to start putting some PRs towards this repo soon so we can start consolidating some of these ideas. I find error in your definitions of functional and integration tests, however. In the hierarchy of tests, I usually see
An interesting read on how 'value' could be perceived in testing is one of the posts on Google's Testing Blog. It's not super long, so I encourage anyone to read. They very much encourage unit and integration tests over end-to-end (I read it as functional) tests as they help the developers much more and have the exact same value to the customer as any end-to-end test: a bug fix. If you can write a unit test for your bug rather than an end-to-end test, wouldn't you rather do that? |
Writing some notes down before committing so everyone can agree and provide input
The text was updated successfully, but these errors were encountered: