CatJS 0.4.45

Command Line

catjs solution comprised of a few major components, including the command-line tool, an NPM (Node Packaged Module) that is based on nodejs technology.
The command-line tool enable to create the test deployment based on a given application project, as described in the getting started section.

After installing catjs module npm install -g catjs the catcli command will be available in the system path.

arguments

The available arguments that can be passed to the catcli command are described below. Some of the available arguments has flag with default values

--init [name]

Initial a basic catjs project that will prepare the test deployment environment. Prompts will appear along the initial process and it will guide through the project creation.

example:

catcli --init

or using a flag

catcli -i

We have prepared an initial example project that is ready to be execute, described in the getting started section. * example parameter

catcli --init example 

--task [name]

catjs has a built-in task manager that is plugable (similar to Grunt task runner). The tasks are running synchronously since the dependencies are tight.
The system has OOTB tasks that based on plugins, it means that there are the main flow tasks to be used like build, server and such and there are system tasks. We have created flags that represents those tasks.

Internal tasks names has a prefix: "t@" and for internal plugins we have a prefix: "p@" Any custom plugin or task can have any name as long as it's unique.

  • --task t@init --task t@scrap --task t@inject (-b) The -b flag is the short term for running initialization, scrap scanning and injection tasks.

  • --task t@clean (-c) The -c flag stands for cleaning the project, but this is a soft clean for cleaning the test deployment

  • --task t@wipe The wipe task is for cleaning the entire test deployment including the libraries and other environment related resources

  • --task t@server.start (-s) The -s flag stand for running the nodejs server. Currently we are running the server pointing to the test deployment locally by default and the same server is serving as a catjs monitoring service. We are going to change that in the near future, splitting the demo server from the monitoring service.

  • --task t@runner.start (-r) The -r flag stands for executing the runner according to its default configuration, unless an override will be set in the catproject.json file under "runner" property.

      "runner": {
          "run": {
              "devices": [
                  {
                      "disable": false,
                      "type": "localpc",
                      "runner": {
                          "name": "chrome",
                          "address": "/index.html",
                          "options": {
                              "instances": 1
                          }
                      }
                  }        
              ]
          },
          "server": {
              "host": "192.168.137.74",
              "port": "8080"
          }
      }
  • --task t@autotest (-a) The -a flag stands for auto test. This is actually a helper task that can gather all of the scrap names from your code and set it in the cat.json file under the "scenarios" property with no order.

    The JavaScript code not always run in the way the test execution are defined. And because we need to define the scenarios, this is a nice helper for getting all the scrap names into the test project and then it can be edited.

    cat.json scenarios section example:

      "scenarios": {
          "general": {
                "tests": [{
                  "name": "initTest"
                }, {
                  "name": "menuTest"
                }, {
                  "name": "menuItemsAction", "repeat":3
                }]
          }
      }
Applications That Test Themselves