Chapter6: web driver IO & mocha

This section contain the following items:

  • 1.Introduction

  • 2.What is webdriverio?

  • 3.Environment setting

  • 4.Apply to project and analysis

  • 5.Reference

1.Introduction

In order to build a auto testing framework to fulfill our requirement, this chapter have the following items:
1) What is webDriverIO?
  2) Enviroment Setting
  2) Apply to project and analysize
  4) Reference

2.What is webdriverio?

WebdriverIO lets you control a browser or a mobile application with just a few lines of code. Your test code will look simple, concise and easy to read. The integrated
testrunner allows you to write asynchronous commands in a synchronous way so that you 
  don’t need to care about how to propagate a Promise to avoid racing conditions.

  The test runner comes also with a variety of hooks that allow you to interfere into the    
  test process in order to take screenshots if an error occurs or modify the test procedure 
  according to a previous test result. (reference from: http://webdriver.io/)

3.Environment setting

"assert": "^1.4.1",

  • 5)sudo npm install

  • 6)create test case named "webtest.js" into webdrivverio-test folder, sample code as

  • 7)start to work :

    • 7.1)launch standalone server in webdrivverio-test folder:

    java -jar selenium-server-standalone-2.53.1.jar

    • 7.2)launch http server which you want to test :

    node app.js

    • 7.3) launch webtest.js:

    node webtest.js

  • 8)Test result:

  • ```

    4.Apply to project and analysis

1) 從程式碼中可以了解Mocha屬於BDD的測試框架, 目的以User Story作為出發, 是因此程式碼看起來多半都是When

5.Reference

1.官網: http://webdriver.io/guide.htmlarrow-up-right 2.範例: https://github.com/onewithhammer/WebDriverIOTutorialarrow-up-right 3.用 mocha 編寫 Node.js unit test:http://syshen.cc/post/23479369750/%E7%94%A8-mocha-%E7%B7%A8%E5%AF%AB-nodejs-unit-testarrow-up-right 4.http://toyo0103.blogspot.tw/2015/08/unit-test-3a.htmlarrow-up-right 5.http://slides.com/alincode/deck-2/fullscreen#/arrow-up-right

```

```

Last updated