1-js/03-code-quality/05-testing-mocha#39
Merged
Conversation
resolve #21
Contributor
|
校对认领 |
Member
| 自动化测试在任务中将会被进一步使用。 | ||
|
|
||
| It's actually a part of the "educational minimum" of a developer. | ||
| 它实际上是一个开发者的“教育最低限度”的一部分。 |
| 当我们在写一个函数时,我们通常可以想象出它应该做什么:哪些参数会给出哪些结果。 | ||
|
|
||
| During development, we can check the function by running it and comparing the outcome with the expected one. For instance, we can do it in the console. | ||
| 在开发期间,我们可以通过运行程序来检查它并将结果与预期的果进行比较。例如,我们可以在控制台中这么做。 |
| 如果出了问题 —— 那么我们会修复代码,然后再一次运行并检查结果 —— 直到它工作为止。 | ||
|
|
||
| But such manual "re-runs" are imperfect. | ||
| 但这样的手动“重新运行”是不完美的。 |
Contributor
There was a problem hiding this comment.
不好意思,没有表达清楚。是中文引号。
[“重新运行”] => [「重新运行」]
|
|
||
| `it("title", function() { ... })` | ||
| : In the title of `it` we *in a human-readable way* describe the particular use case, and the second argument is a function that tests it. | ||
| : `it` 里面的 “title” 中我们可以以**人类可读**的方式描述特定的用例,第二个参数是一个测试它的函数。 |
| 如此来看,开发是**迭代**的。我们写规范,实现它,确保测试通过,然后写更多的测试来确保它们工作等等。最后,我们有了一个能工作的实现和针对它的测试。 | ||
|
|
||
| In our case, the first step is complete: we have an initial spec for `pow`. So let's make an implementation. But before that let's make a "zero" run of the spec, just to see that tests are working (they will all fail). | ||
| 在我们的案例中,第一步已经完成了:针对 `pow` 我们有一个初始规范。因此让我们来实现它吧。但在此之前,让我们做一个针对规范的“零”运行,只是为了看到测试正在运行(他们都会失败)。 |
added 2 commits
April 24, 2018 10:57
Signed-off-by: sqrtthree <imsqrtthree@gmail.com>
Author
|
@leviding Done. |
leviding
approved these changes
Apr 24, 2018
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolve #21