Cucumber是平实语言版的unit test,可用于包层次的测试。优势在于它允许非程序员参与,需求更加明确。
测试方法:
https://www.cnblogs.com/TankXiao/archive/2012/02/20/2347016.html
BDD/Functional test framwork: Cucumber
TDD:
https://cucumber.io/
Gherkin
plain text语音来描述unit test中的arrange(mock), act, assert。
例子
Scenario: Breaker guesses a word
Given the Maker has chosen a word
When the Breaker makes a guess
Then the Maker is asked to score
Tuesday, November 6, 2018
Friday, October 26, 2018
Gradle简介
Gradle与Maven比较:
1. Gradle利用cache使得build过程更快
2. Gradle利用分块build(incremental),也就是指对修改的文件重新build,如修改了test,只build该test
https://gradle.org/maven-vs-gradle/
https://www.jianshu.com/p/00d5469e25e7
1. Gradle利用cache使得build过程更快
2. Gradle利用分块build(incremental),也就是指对修改的文件重新build,如修改了test,只build该test
https://gradle.org/maven-vs-gradle/
https://www.jianshu.com/p/00d5469e25e7
Thursday, October 18, 2018
Java的Null pointer exception
Boolean a;
boolean b = false || a;
会出现NPE因为a可能为null。
switch(a){
case true:
return "";
}
会出现NPE因为a可能为null。
boolean b = false || a;
会出现NPE因为a可能为null。
switch(a){
case true:
return "";
}
会出现NPE因为a可能为null。
Friday, September 21, 2018
Java中的ThreadLocal和弱引用
ThreadLocal就是线程的私有变量和对象
static ThreadLocal<Metric> metric = new ThreadLocal<>();
这里用static因为相当于线程的私有全局变量,避免数据的重复copy(不同实例)。但可能导致内存泄漏(因为static不会被回收)。如果有线程池,线程会被复用就减低内存泄漏的可能。
https://www.zhihu.com/question/35250439
Strong ref是Map m = new HashMap();
Soft Ref内存不足才会回收,适用于缓存
Week Reference是回收器自动回收弱引用对象(HashMap中)
Phantom Ref是在析构finalize中不会复活下回收弱引用
https://droidyue.com/blog/2016/03/13/learning-threadlocal-in-java/
https://droidyue.com/blog/2014/10/12/understanding-weakreference-in-java/
我的书目:
static ThreadLocal<Metric> metric = new ThreadLocal<>();
这里用static因为相当于线程的私有全局变量,避免数据的重复copy(不同实例)。但可能导致内存泄漏(因为static不会被回收)。如果有线程池,线程会被复用就减低内存泄漏的可能。
https://www.zhihu.com/question/35250439
Strong ref是Map m = new HashMap();
Soft Ref内存不足才会回收,适用于缓存
Week Reference是回收器自动回收弱引用对象(HashMap中)
Phantom Ref是在析构finalize中不会复活下回收弱引用
https://droidyue.com/blog/2016/03/13/learning-threadlocal-in-java/
https://droidyue.com/blog/2014/10/12/understanding-weakreference-in-java/
我的书目:
Effective Java中文版(第2版)
Java并发编程实战
深入理解Java虚拟机:JVM高级特性与最佳实践(第2版)
重构:改善既有代码的设计
系统思维:复杂商业系统的设计之道(原书第3版)
Sunday, September 9, 2018
JS代码缺陷自动分析工具 - eslint
eslint
gulp: js build tool
node.js
webpack: web browser library
unit test: Mocha
http://www.ruanyifeng.com/blog/2015/12/a-mocha-tutorial-of-examples.html
gulp: js build tool
node.js
webpack: web browser library
unit test: Mocha
http://www.ruanyifeng.com/blog/2015/12/a-mocha-tutorial-of-examples.html
Thursday, August 16, 2018
whistle简介
如何安装
http://wproxy.org/whistle/install.html
https设置
http://wproxy.org/whistle/webui/https.html
http://wproxy.org/whistle/install.html
https设置
http://wproxy.org/whistle/webui/https.html
windows commands
netstat -ano | findstr :8899
taskkill /PID typeyourPIDhere /F
https://stackoverflow.com/questions/39632667/how-to-kill-a-currently-using-port-on-localhost-in-windows
taskkill /PID typeyourPIDhere /F
https://stackoverflow.com/questions/39632667/how-to-kill-a-currently-using-port-on-localhost-in-windows
Subscribe to:
Posts (Atom)