File tree Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Expand file tree Collapse file tree 3 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1
1
# 端对端测试
2
2
3
- electron-vue 使用 [ Spectron] ( http://electron.atom.io/spectron/ ) 和 [ Mocha] ( https://mochajs.org/ ) \( 与 [ Chai] ( http://chaijs.com/ ) \) 作为端到端测试的框架。 包括 ` expect ` 、` should ` 以及 ` assert ` 在内的 Mocha 和 Chai 的 API 在全局范围内可用 。
3
+ 对于端到端测试, electron-vue 使用 [ Spectron] ( http://electron.atom.io/spectron/ ) 和 测试框架 [ Mocha] ( https://mochajs.org/ ) \( 以及 [ Chai] ( http://chaijs.com/ ) \) 。Mocha 和 Chai 的 API ( 包括 ` expect ` 、` should ` 以及 ` assert ` 在内) 均在全局范围内可用 。
4
4
5
5
### 运行测试
6
6
@@ -11,7 +11,7 @@ npm run e2e
11
11
12
12
##### 注意
13
13
14
- 在运行端到端测试之前,调用 ` npm run pack ` 来创建一个产品构建,使 Spectron 在测试的时候可以使用 。
14
+ 在运行端到端测试之前,为了使 Spectron 在测试的时候可用,请调用 ` npm run pack ` 来创建一个产品构建。
15
15
16
16
### 文件结构
17
17
@@ -32,16 +32,16 @@ my-project
32
32
33
33
#### ` index.js `
34
34
35
- 这是 Mocha 入口文件,并收集在 ` specs/ ` 内的所有测试代码用于测试。
35
+ 这是 Mocha 入口文件,并收集加载在 ` specs/ ` 内的所有测试代码用于测试。
36
36
37
37
#### ` utils.js `
38
38
39
- 在这里,你会发现一些通用的函数,可以在你的 ` specs/ ` 中使用。其基本功能包括处理 electron 创建/销毁过程的 ` beforeEach ` 和 ` afterEach ` 。
39
+ 在这里,你会发现一些通用的函数,你可以在 ` specs/ ` 中使用。其基本功能包括处理 electron 创建/销毁过程的 ` beforeEach ` 和 ` afterEach ` 。
40
40
41
41
### 关于 Spectron
42
42
43
43
Spectron 是使用 [ ChromeDriver] ( https://sites.google.com/a/chromium.org/chromedriver/ ) 和 [ WebDriverIO] ( http://webdriver.io/ ) 来操作 DOM 元素的 [ electron] (http://electron.atom.io)官方测试框架。
44
44
45
45
#### WebDriverIO 的使用
46
46
47
- 如 Spectron 的 [ 文档] ( https://github.com/electron/spectron#client ) 中所述,可以通过访问 ` this.app.client ` 来访问 [ WebDriverIO APIs] ( http://webdriver.io/api.html ) 。 由于 electron-vue 使用了 Mocha,` this ` 在 ` afterEach ` 、` beforeEach ` 和 ` it ` 之间共享。 因此,值得注意的是,ES2015 的箭头函数不能在某些情况下使用 ,因为 ` this ` 的语境将被覆盖 \( [ 更多信息] ( https://mochajs.org/#arrow-functions ) \) 。
47
+ 如 Spectron 的 [ 文档] ( https://github.com/electron/spectron#client ) 中所述,你可以通过访问 ` this.app.client ` 来访问 [ WebDriverIO APIs] ( http://webdriver.io/api.html ) 。 由于 electron-vue 使用了 Mocha,` this ` 在 ` afterEach ` 、` beforeEach ` 和 ` it ` 之间共享。 因此,值得注意的是,ES2015 的 箭头函数 (arrow function) 不能在某些情况下使用 ,因为 ` this ` 的语境将被覆盖 \( [ 更多信息] ( https://mochajs.org/#arrow-functions ) \) 。
Original file line number Diff line number Diff line change 1
1
# 测试
2
2
3
- 因受到了官方 ` vuejs-templates/webpack ` 样板代码提供的测试的极大启发 ,electron-vue 同时支持单元测试和 ` renderer ` 进程的端到端测试。在 ` vue-cli ` 脚手架中,你可以选择是否包含测试。
3
+ 因受到了官方样板代码 ` vuejs-templates/webpack ` 提供的测试功能的极大启发 ,electron-vue 同时支持单元测试和 ` renderer ` 进程的端到端测试。在 ` vue-cli ` 脚手架中,你可以选择是否包含测试。
4
4
5
5
## [ 单元测试] ( unittesting.md )
6
6
@@ -26,4 +26,4 @@ npm test
26
26
27
27
### 关于 CI 测试
28
28
29
- 如果你决定在脚手架时使用 ` electron-builder ` 作为构建工具,那么你可以在针对 ` darwin ` 、` linux ` 和 ` win32 ` 的 Travis CI 以及 AppVeyor 上轻松测试应用程序 。在 ` .travis.yml ` 和 ` appveyor.yml ` 两者之间,你会发现注释掉的部分 ,你可以快速取消注释以启用测试。确保在 [ ** 使用 CI 的自动化部署** ] ( /using-electron-builder.md#automated-deployments-using-ci ) 上阅读更多信息 。
29
+ 如果在脚手架时你决定使用 ` electron-builder ` 作为构建工具,那么你可以在针对 ` darwin ` 、` linux ` 和 ` win32 ` 的 Travis CI 以及 AppVeyor 上轻松测试你的程序 。在 ` .travis.yml ` 和 ` appveyor.yml ` 两者之间,你会发现一些被注释掉的部分 ,你可以快速取消注释以启用测试。确保阅读 [ ** 使用 CI 的自动化部署** ] ( /using-electron-builder.md#automated-deployments-using-ci ) 上的更多信息 。
Original file line number Diff line number Diff line change 1
1
# 单元测试
2
2
3
- electron-vue 使用 [ Karma] ( https://karma-runner.github.io/1.0/index.html ) 作为测试的运行器,使用 [ Mocha] ( https://mochajs.org/ ) \( 与 [ Chai] ( http://chaijs.com/ ) \ 作为测试框架 进行单元测试 。
3
+ 对于进行单元测试, electron-vue 使用 [ Karma] ( https://karma-runner.github.io/1.0/index.html ) 作为测试的运行器,使用 [ Mocha] ( https://mochajs.org/ ) \( 与 [ Chai] ( http://chaijs.com/ ) \ 作为测试框架。
4
4
5
5
Mocha 和 Chai 分别使用 ` karma-mocha ` 和 ` karma-chai ` 进行集成,所以所有的 API(例如 ` expect ` )都可以在测试文件中全局使用。
6
6
@@ -26,15 +26,15 @@ my-project
26
26
27
27
#### ` specs/ `
28
28
29
- 这个目录里面是编写实际测试代码的地方。由于 Webpack 的强大功能,你可以完全依照 ES2015 和 所支持的加载程序编写 。
29
+ 这个目录里面是编写实际测试代码的地方。由于 Webpack 的强大功能,你可以完全依照 ES2015 和 其支持的加载程序编写 。
30
30
31
31
#### ` index.js `
32
32
33
- 这是 ` karma-webpack ` 使用的入口文件。该文件的目的是一次性收集所有测试和源代码 。
33
+ 这是 ` karma-webpack ` 使用的入口文件。该文件的目的是一次性收集加载所有的测试和源代码 。
34
34
35
35
#### ` karma.conf.js `
36
36
37
- 在这里,你可以找到实际的 ` karma ` 配置,并使用 spec/coverage 记录器进行设置。可以根据 [ karma 官方文档] ( http://karma-runner.github.io/1.0/config/configuration-file.html ) 进一步定制。
37
+ 在这里,你可以找到实际的 ` karma ` 配置,并使用 spec/coverage 记录器进行设置。你可以根据 [ karma 官方文档] ( http://karma-runner.github.io/1.0/config/configuration-file.html ) 进一步定制。
38
38
39
39
### Mocking Dependencies
40
40
You can’t perform that action at this time.
0 commit comments