我不明白
TDD FIRST principle在下面的代码中是不是被遵守的.
这些是我关于FIRST原则的笔记:
- Fast: run (subset of) tests quickly (since you’ll be running them all the time)
- Independent: no tests depend on others,so can run any subset in any order
- Repeatable: run N times,get same result (to help isolate bugs and enable automation)
- Self-checking: test can automatically detect if passed (no human checking of output)
- Timely: written about the same time as code under test (with TDD,written first!)
测验问题:
Sally wants her website to have a special layout on the first Tuesday of every month. She has the following controller and test code:
06000
What FIRST principle is not being followed?
- Fast
- Independent
- Repeatable
- Self-checking
- Timely
我不知道哪个FIRST原则没有被遵守:
> Fast:代码似乎很快,因为它的测试没有什么复杂的.
>独立性:测试不依赖于其他测试.
>可重复:每次测试都会得到相同的结果. ‘special_index’如果是星期二,’index’如果不是星期二.
自检:测试可以自动检测是否通过.
>及时:代码和测试代码同时显示在这里.
因为测试代码是在控制器代码之后出现的,所以我选择了Timely的测验.但是我错了,回想起来,这不是一个好选择.我不知道在这里没有遵循哪个FIRST原则.
它不是可重复的,因为不是每天都是星期二:)如果你在星期一运行这个测试,你会得到一个结果,如果你在星期二运行一个不同的结果.
原文链接:https://www.f2er.com/javaschema/281907.html