|
| 1 | +# Ecma402 Tests |
| 2 | + |
| 3 | +This directory contains the tests for ecma402. |
| 4 | + |
| 5 | +##### Table of content |
| 6 | + |
| 7 | +- [Initial setup](#initial-setup) |
| 8 | +- [Running the tests](#running-the-tests) |
| 9 | + |
| 10 | +## Initial Setup |
| 11 | + |
| 12 | +To be able to run ecma402 automated tests, you need to install ecma402 dependencies. To do that, run: |
| 13 | + |
| 14 | +``` |
| 15 | +$ npm install |
| 16 | +$ bower install |
| 17 | +``` |
| 18 | + |
| 19 | +Then you have the choice between: |
| 20 | + |
| 21 | +1. running the tests on Sauce Labs, see [Sauce Labs configuration](#sauce-labs-configuration). |
| 22 | +1. running the tests locally on desktop browsers, see [Selenium / Webdriver installation](#selenium--webdriver-installation) |
| 23 | + |
| 24 | +#### Sauce Labs configuration |
| 25 | + |
| 26 | +If you don't already have a Sauce Labs account, you can create one on their website, choosing the scheme that best fit your situation (Note that they ofer a free one for OSS developpers, [Open Sauce](https://saucelabs.com/opensauce)): |
| 27 | + |
| 28 | +1. Navigate to https://saucelabs.com/signup in your browser; |
| 29 | +2. Select the subscription plan you want and fill up the form to create your account. |
| 30 | + |
| 31 | +Once your account has been created, setup your `SAUCE_USERNAME` and `SAUCE_ACCESS_KEY` environment variables as they are listed |
| 32 | +on https://saucelabs.com/appium/tutorial/3. |
| 33 | + |
| 34 | +#### Selenium / Webdriver installation |
| 35 | + |
| 36 | +To run the tests locally (which is faster than running the tests on Sauce Labs but restricts the list of browsers the test run into to the list of browsers |
| 37 | +that are installed on your computer), you first need to install the following resources: |
| 38 | + |
| 39 | +1. Java JRE version 6 |
| 40 | +1. From the [Selenium download page](http://www.seleniumhq.org/download/): |
| 41 | + 1. Selenium Server |
| 42 | + 1. Drivers for the browsers installed on your computer. After you've downloaded the browser drivers, make sure that they are referenced in your $PATH (or %PATH% on Windows): |
| 43 | + 1. Firefox driver: included with Selenium Server, no extra download needed |
| 44 | + 1. Internet explorer driver: use the link provided in section _The Internet Explorer Driver Server_ of http://www.seleniumhq.org/download/ |
| 45 | + 1. Chrome driver: https://code.google.com/p/chromedriver/ |
| 46 | + 1. Safari driver: included with Selenium Server, no extra download needed |
| 47 | + |
| 48 | +## Running the tests |
| 49 | + |
| 50 | +You have two options to run the tests: |
| 51 | + |
| 52 | +1. Run locally in desktop browsers |
| 53 | +1. Run in Sauce Labs browsers |
| 54 | + |
| 55 | +When running tests using the command line, you can also adjust the list of reports generated for the test execution. |
| 56 | + |
| 57 | +### Running the unit and functional tests locally in desktop browsers |
| 58 | + |
| 59 | +1. Starts the selenium server on the default port (4444) (requires selenium server. See [installation instructions](#selenium--webdriver-installation)): |
| 60 | + |
| 61 | + ``` |
| 62 | + $ java -jar selenium-server-standalone-2.XX.0.jar |
| 63 | + ``` |
| 64 | + |
| 65 | +2. Edit the [intern.local.js](./intern.local.js) configuration to list which browsers to use for the tests |
| 66 | + |
| 67 | +3. In the ecma402 directory, type the following command: |
| 68 | + |
| 69 | + ``` |
| 70 | + $ grunt test:local |
| 71 | + ``` |
| 72 | + |
| 73 | +### Running the unit and functional tests in Sauce Labs browsers |
| 74 | + |
| 75 | +In the ecma402 directory, type the following command (requires Sauce Labs environment variables. See [Sauce Labs configuration instructions](#sauce-labs-configuration)): |
| 76 | + |
| 77 | +``` |
| 78 | +$ grunt test:remote |
| 79 | +``` |
| 80 | + |
| 81 | +Note that you can update the [intern.js](./intern.js) configuration file if you need to customize the list of browsers to run the tests into. |
| 82 | + |
| 83 | +To monitor the tests execution and access the Sauce Labs reports, you will need to [login to Sauce Labs](https://saucelabs.com/login). |
| 84 | + |
| 85 | +### Adjusting reports |
| 86 | + |
| 87 | +Optional reports can be added via grunt flags e.g. |
| 88 | + |
| 89 | + $ grunt test:local:console // run the console reporter for a local test |
| 90 | + $ grunt test:remote:lcovhtml // run the console reporter for a remote (saucelabs) test with the lcovhtml coverage reporter |
| 91 | + $ grunt test:local:console:lcovhtml // multiple reporters can be specified |
| 92 | + |
| 93 | +The following reporters are currently provided as optional flags |
| 94 | + * `lcovhtml`: this HTML report is generated at `ecma402/html-report/index.html` and provides detailed information about what sections of the widgets code are executed during the tests and, more importantly, what sections are not. |
| 95 | + * `console` |
0 commit comments