随笔分类 -  Unit Testing

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页
摘要:Often, we end up creating multiple unit tests for the same unit of code to make sure it behaves as expected with varied input. This is a good practice 阅读全文
posted @ 2018-07-10 19:27 Zhentiw 阅读(431) 评论(0) 推荐(0)
摘要:We want to make sure that when we ship new code, our users can use the application. The best way we've found to do that is to write automated tests th 阅读全文
posted @ 2018-07-09 18:39 Zhentiw 阅读(241) 评论(0) 推荐(0)
摘要:With the right process in place, snapshot tests can be a great way to detect unintended changes in any part of your application that can be serialized 阅读全文
posted @ 2018-07-06 17:14 Zhentiw 阅读(175) 评论(0) 推荐(0)
摘要:Mocha uses a default timeout of 2000 ms. However, if for some reason that does not work for your use case, you can increase the timeout for a particul 阅读全文
posted @ 2018-04-25 18:25 Zhentiw 阅读(240) 评论(0) 推荐(0)
摘要:In this lesson, you will learn how to implement pytest fixtures. Many unit tests have the same resource requirements. For example, an instantiated obj 阅读全文
posted @ 2018-02-22 22:04 Zhentiw 阅读(360) 评论(0) 推荐(0)
摘要:In this lesson, I use Enzyme and Jest's Snapshot functionality to write an integration test for a component called CounterConsumer that consumes the R 阅读全文
posted @ 2018-02-22 01:21 Zhentiw 阅读(174) 评论(0) 推荐(0)
摘要:In this lesson, I use Enzyme and Jest to unit test a Counter Render Prop component. Writing integration tests are perfect for components that consume 阅读全文
posted @ 2018-02-22 01:15 Zhentiw 阅读(540) 评论(0) 推荐(0)
摘要:Every Angular CLI generated project comes already with Karmapreinstalled as well a couple of executable Jasmine specs. The default test reporter is "p 阅读全文
posted @ 2018-02-16 19:46 Zhentiw 阅读(136) 评论(0) 推荐(0)
摘要:In a proper unit test we want to isolate external dependencies as much as possible to guarantee a reliable test outcome. Http calls represent such ext 阅读全文
posted @ 2018-02-14 21:20 Zhentiw 阅读(565) 评论(0) 推荐(0)
摘要:In this lesson you will create a new project with a virtual environment and write your first unit test with pytest. In doing so, you will learn: insta 阅读全文
posted @ 2018-02-05 19:12 Zhentiw 阅读(351) 评论(0) 推荐(0)
摘要:Install: Basic example: Advanced example: Component: 阅读全文
posted @ 2017-10-31 19:31 Zhentiw 阅读(468) 评论(0) 推荐(0)
摘要:Most of time, we get used to use class name as a selector in the test. But one problem for this is classname is used for styling, when we also use it 阅读全文
posted @ 2017-10-30 18:19 Zhentiw 阅读(253) 评论(0) 推荐(0)
摘要:In certain situations, you care more about the final state of the redux store than you do about the particular stream of events coming out of an epic. 阅读全文
posted @ 2017-10-17 19:34 Zhentiw 阅读(624) 评论(0) 推荐(0)
摘要:Often in unit tests we are focussing on the logic involved in crafting a network request, & how we respond to the result. The external service is unli 阅读全文
posted @ 2017-10-17 18:57 Zhentiw 阅读(1185) 评论(0) 推荐(0)
摘要:Epics can be unit-tested just like any other function in your application - they have a very specific set of inputs (the action$ stream) and the outpu 阅读全文
posted @ 2017-10-17 18:20 Zhentiw 阅读(215) 评论(0) 推荐(0)
摘要:The way to test router componet needs a little bit setup, first we need to create a "router-stubs.ts". This file is a helper file. The component we wa 阅读全文
posted @ 2017-10-12 15:48 Zhentiw 阅读(940) 评论(0) 推荐(0)
摘要:Both what "TestBed.get" & "injector" trying to do is get service for the test component. But there is some diffenece which determined when use which. 阅读全文
posted @ 2017-10-10 19:21 Zhentiw 阅读(1688) 评论(0) 推荐(0)
摘要:When you testing Component rendering, you often needs to call: For example: You can also set auto change detection: Add to providers: Tests wit auto c 阅读全文
posted @ 2017-10-10 16:51 Zhentiw 阅读(273) 评论(0) 推荐(0)
摘要:When using Ngrx, we need to know how to test the component which has Router injected. Component: One thing we can test just for component wihtout temp 阅读全文
posted @ 2017-10-10 15:54 Zhentiw 阅读(572) 评论(0) 推荐(0)
摘要:Here we want to test a toggle button component, when the button was click, state should change, style should change also. Toggle component: Test: 阅读全文
posted @ 2017-09-20 02:52 Zhentiw 阅读(683) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 下一页