Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd2eb3bb

Browse files
committed
update test runner docs
1 parentb45d5c7 commitd2eb3bb

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

‎_posts/tutorial-docs/2016-01-09-test-runner.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ A CodeRoad test runner works by creating a child process and calling a test fram
99

1010
In this way, the test runner not only determines how unit tests will be written, but it actually determines the programming language used in the tutorial.
1111

12-
>Any programming language can potentially be used with CodeRoad, you need only change the test runner.
12+
>Any programming language can potentially be used with CodeRoad, you need only change the test runner. This is possible because tests are called from the command line.
1313
1414
###Current Test Runners
1515

16-
* #"diff-3f0a052b44acfd92a825dcef177c9f9bfadf3f9cf904f3d94c2418a8a4fd7a47-16-16-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">
16+
* #"diff-3f0a052b44acfd92a825dcef177c9f9bfadf3f9cf904f3d94c2418a8a4fd7a47-16-17-0" data-selected="false" role="gridcell" tabindex="-1" valign="top">
17+
* Python:[*pytest-coderoad*](//github.com/coderoad/pytest-coderoad)
1718

1819
We need more test runners. Why not build one?
1920

@@ -28,32 +29,33 @@ The test runner is called in *Atom-CodeRoad* with three ordered inputs, the fina
2829
See a brief example from the[*mocha-coderoad* runner](https://github.com/coderoad/mocha-coderoad/blob/master/src/runner.ts), as well as a code summary below:
2930

3031
```js
31-
exportdefaultfunctionrunner(testFile,config,handleResult) {
32+
// input: an object with keys of
33+
exportdefaultfunctionrunner({testString, config, handleResult}) {
3234
/* ...*/
3335
handleResult(result);// returns test result
3436
}
3537
```
3638

3739
Also notice that the runner in the above example handles any`console.log` statements. A special character string is added before the result, any data without that match is passed to the log.
3840

39-
`console.dir` is used to make objects & arrays more accessible in the console.
40-
4141
```js
4242
if (!match) {
4343
try {
44-
console.dir(JSON.parse(JSON.stringify(data)));
44+
console.log(data);
4545
}catch (e) {
4646
console.log(data);
4747
}
4848
return;
4949
}
5050
```
5151

52-
Let's look at these three test runner inputs in more detail.
52+
>In order to process the data correctly, CodeRoad overrides the console.log function with another function that parses the output and returns it's proper type.
53+
54+
Let's look at these three test runner keys that are passed into the runner as an object:
5355

54-
####1.testFile
56+
####1.testString
5557

56-
The absolute path to a file containing all concatenated pagetests. Call your test framework with this file path.
58+
A string with all test input. This includes unittests, the user input from the text editor, and some helper functions behind the scenes.
5759

5860
####2. config
5961

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp