Testing React Components
来源:互联网 发布:华为手机彻底删除数据 编辑:程序博客网 时间:2024/05/02 04:49
Why we need test
Please see this article
Test Goals
- The test suite should be fast, to encourage us to write more tests and save us time;
- We should be able to test our React components effectively;
- The test suite should play well with ES6 syntax and our webpack setup;
- The test suite must be integrated alongside our current integration tests on CircleCI
Why not Jest
- Slow
Test suite of about 60 test cases 10 seconds vs 200ms (Karma) - I don’t like the module mocking that makes things look like black boxes
- I never actually wanted/needed black boxing
- The documentation was lacking
- I had to come up with a hacky way to call it from Node
- I didn’t really know how to debug my tests other than by the really long stack traces
- it didn’t run in a real browser.
How do test
Test points
- End to End test
- Dumb React components
- Smart React components
- Redux Store (action/reducers)
3rd libraries
- Karama
- Mocha
- Sinon
- Chai
- JSDOM
Issues
issue: framework “sinon” is not defined
fix: npm install -g karma-cli
Github issue
Sites choosing FE Test techniques
testing-with-reactjs-at-codecademy
0 0
- Testing React Components
- Testing OSGi components
- A STEP-BY-STEP TDD APPROACH ON TESTING REACT COMPONENTS USING ENZYME
- react native components
- React composing components
- React extracting components
- 动态数据测试组件(Testing Components)
- React实践系列笔记-Components
- react-bits:Using Pure Components
- React 组件/库集合:Awesome React Components
- React学习之-(React Components Lifecycle)
- Testing Commercial-off-the-Shelf Components and Systems
- MDS setting for testing PDef business components using AM tester
- React 笔记4:Components and Props
- react学习-受控组件(controlled components)
- 《React Native高效开发》之styled-components
- React 高阶组件(Higher-Order Components)
- 使用 styled-components 加速 React 开发
- python Chrome 开发者模式消失的方法
- [解决方案]Vmware安装提示虚拟机正在运行(及吐槽)
- 什么是Here Document
- java基础06
- MFC 调用 QT的dll QT内无法捕获回车键 & PostMessage向窗口发送Alt组合键
- Testing React Components
- vs2013 访问sql server 2014 并且遍历数据库
- Android运行时ART加载类和方法的过程分析
- 多线程练习2
- Leetcode-101. Symmetric Tree
- Android自定义属性,format详解
- yii框架中的分页
- Oracle 11g学习笔记--高级查询
- linux内核在线查看