Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 160 lines (120 sloc) 6.641 kb

Arrow

Build Status

Overview

Arrow is a test framework designed to promote test-driven JavaScript development. Arrow provides a consistent test creation and execution environment for both Developers and Quality Engineers.

Arrow aims to completely remove the line between development’s Unit tests, and Functional and Integration tests by providing a uniform way to create and execute both.

Arrow itself is a thin, extensible layer that marries JavaScript, NodeJS, PhantomJS and Selenium. Arrow allows you to write tests using YUI-Test and execute those tests using NodeJS, PhantomJS or Selenium. Additionally, Arrow provides a rich mechanism for building, organizing and executing test and test scenarios.

Install

npm install -g yahoo-arrow

Options

  • --help display this help page
  • --version display installed arrow version
  • --lib comma separated list of js files needed by the test
  • --page path to the mock or production html page, for example: http://www.yahoo.com or mock.html
  • --driver selenium|phantomjs|browser. (default: phantomjs)
  • --browser firefox|chrome|opera|reuse. Specify browser version with a hypen, ex.: firefox-4.0 or opera-11.0 (default: firefox)
  • --report true/false. Creates report files in junit and json format, and also prints a consolidated test report summary on console
  • --reportFolder : (optional) folderPath. creates report files in that folder. (default: descriptor folder path)
  • --testName comma separated list of test names defined in test descriptor. all other tests will be ignored
  • --group comma separated list of groups defined in test descriptor, all other groups will be ignored
  • --logLevel DEBUG|INFO|WARN|ERROR|FATAL (default: INFO)
  • --dimension a custom dimension file for defining ycb contexts
  • --context name of ycb context
  • --seleniumHost : (optional) override selenium host url (example: --seleniumHost=http://host.com:port/wd/hub)
  • --hybridAppTestServer : (optional) override hybridAppTestServer host url (example: --hybridAppTestServer=http://host.com:port/shanghai), the default is http://localhost:9000/shanghai
  • --capabilities : (optional) the name of a json file containing webdriver capabilities required by your project
  • --startProxyServer : (optional) true/false. Starts a proxy server, intercepting all selenium browser calls
  • --routerProxyConfig : (optional) filePath. Expects a Json file, allows users to modify host and headers for all calls being made by browser. Also supports recording of select url calls ( if you mark "record" : true)

     Example Json :
                   {
                       "yahoo.com": {
                           "newHost": "x.x.x.x (your new host ip/name)",
                           "headers":[
                               {
                                   "param": "<param>",
                                   "value": "<val>"
                               }
                           ],
                           "record": true
                        },
                        "news.yahoo.com": {
                           "newHost": "x.x.x.x (your new host ip/name)",
                           "headers":[
                               {
                                   "param": "<param>",
                                   "value": "<val>"
                               }
                           ],
                           "record": true
                        }
                   }
    
  • --exitCode : (optional) true/false. Causes the exit code to be non-zero if any tests fail (default: false)

  • --coverage : (optional) true/false. creates code-coverage report for all js files included/loaded by arrow (default: false)

Examples

Below are some examples to help you get started.

Unit test:

arrow --lib=../src/greeter.js test-unit.js

Unit test with a mock page:

arrow --page=testMock.html --lib=./test-lib.js test-unit.js

Unit test with selenium:

arrow --page=testMock.html --lib=./test-lib.js --driver=selenium test-unit.js

Integration test:

arrow --page=http://www.hostname.com/testpage --lib=./test-lib.js test-int.js

Integration test:

arrow --page=http://www.hostname.com/testpage --lib=./test-lib.js --driver=selenium test-int.js

Custom controller:

arrow --controller=custom-controller.js --driver=selenium

Function test with hybridApp web driver:

arrow hybridApp_descriptor.json --driver=hybridApp

Arrow Dependencies

NPM Dependencies

NPM Dev Dependencies

Apart from above mentioned npm modules, Arrow also relies on these two projects

For Arrow Developers

  1. install the arrow globle "sudo npm install yahoo-arrow -g"
  2. clone the recent code to your local directory example: "git clone git@github.com:{yourid}/arrow.git"
  3. set the connection between arrow/arrow_server/arrow_selenium with the recent code sudo rm arrow sudo rm arrow_server sudo rm arrow_selenium sudo ln -s {localgitbase}/arrow/index.js arrow sudo ln -s {localgitbase}/arrow/arrow_server/server.js arrow_server sudo ln -s {localgitbase}/arrow/arrow_selenium/selenium.js arrow_selenium
  4. on your git local box: run "npm install ." to install all the dependencies
  5. bring up the arrow_server by "arrow_server"
  6. install shanghai server by "sudo npm install shanghai-server"
  7. bring up the shanghai server by "cd ./node_modules/shanghai-server" and "node server.js --host="

you can run your unit test/functional test/hybridApp integration test according to the readme file

Something went wrong with that request. Please try again.