mtest

Multibrowser test environment

npm install mtest
1 downloads in the last week
24 downloads in the last month

MTest

Multiplatform / Browser testing via node.js servers to communicate over http and open browser sequentially.

Installation

npm install mtest -g

In some Linux distrubutions sudo maybe neccessery for the -g flag.

Configuration

MTest uses mtest.json for configuration:

{
  "page": "http://{{ip/hostname}}:{{port}}",
  "ip": "{{ip of the machine runnig the runner}}",
  "port": 4001,
  "cluster": {
    "{{remote ip}}": ["{{browser}}","{{browser}}",...]
  }
}

Executables

MTest comes with two executables:

  • mtest-runner This is responsible for calling remote machines. This process will exit with 0 for sucess or 1 for failure.
  • mtest-server This is the executable to be run on the servers

Running Tests

When the page opens in the browser it's expected to run the tests and send the results to (POST) http://localhost:400/report with the following json:

{ "failed": #, "passed": #, "skipped": #, "pending": #, "count": #}

Where the # are the counts.

After this request the mtest-server closes the current and opens the next browser in the queue or sends reports to the runner if no browsers are left.

If there is even one failed step in any of the reports the test is considered failed and the mtest-runner will exit with code 1.

IE setup

For IE you will need to add the hostname/ip of the server hosting the test page to your local networks, and maybe lower security in order for the XHR request to reach localhost.

Supported Browsers / Platforms

  • linux: chrome / firefox
  • windows: chrome / firefox / ie
  • mac: chrome / firefox / safari

More browsers will be added in the future.

Currenty the values for the app paths are hard wired, there will be configuration for this in the future

Example Scenario

mtest.json:

{
  "page": "http://192.168.0.1:3000",
  "ip": "192.168.0.1",
  "port": 4001,
  "cluster": {
    "REMOTE1-ip": ["firefox","chrome","safari"],
    "REMOTE2-ip": ["firefox","chrome","ie"]
  }
}
  • Start mtest-server on REMOTE 1
  • Start mtest-server on REMOTE 2
  • Start mtest-runner on 192.168.0.1
  • REMOTE 1 opens firefox with url... sends results to localhost:4000
  • REMOTE 1 opens chrome with url ... sends results to localhost:4000
  • REMOTE 1 opens safari with url ... sends results to localhost:4000
  • REMOTE 1 sends results to 19.168.0.1:4001
  • REMOTE 2 opens firefox with url ... sends results to localhost:4000
  • REMOTE 2 opens chrome with url ... sends results to localhost:4000
  • REMOTE 2 opens ie with url ... sends results to localhost:4000
  • REMOTE 2 sends results to 19.168.0.1:4001
  • mtest-runner exits on 192.168.0.1
npm loves you