Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 19 additions & 68 deletions test/README.md
Original file line number Diff line number Diff line change
@@ -1,93 +1,44 @@
# Node.js Toolkit Tests

Ensure dependencies are installed
Ensure dependencies are installed by running `npm install` from the project root.

From the root of the project run: `npm install`
## Running Tests

***NOTE***

Some tests require creating libraries, objects, tables, etc.

A before hook is setup to check for theses objects and create if needed.

These hooks are ran with `idb-pconnector` which requires to be run on IBM i.

In any case, the functional tests test for both transports Db2 and REST.

Using Db2 transport requires `idb-connector` which only runs on IBM i systems.
- Run unit tests with `npm test`.

Tests using these hooks will fail on non IBM i systems.

# Running Tests

From the project root

`npm test test/foo`

where foo is the name of subdir such as `unit` or or individual test file.
- Run functional tests with `npm run test-integration`.

***NOTE***

If you experience timeout issue with network calls add

`"test": "./node_modules/mocha/bin/mocha" --timeout Xs `

within `package.json` file, where X is the number of seconds before timeout
Integration tests require additional setup and configuration. Some tests require objects to preexist on the IBM i. The test case will check if the object exists and log instructions if the object is not found.

# Setup Rest interface
## Setup Rest interface
- view the [README](../README.md#rest)

# Setup SSH interface
## Setup SSH interface
- view the [README](../README.md#ssh)

# Configuring Tests
Each functional test contains an config object that is used to create connections

It is recommend to setup environment variables for these configurations

Instead of hard coding credentials with the test file.

you can set environment varaibales with `export KEY='value'`


For all tests
---
- verbose `TKVERBOSE` enables verbose mode

For idb-connector Tests
---

- user `TKUSER` defaults to ''

- password `TKPASS` defaults to ''

- database `TKDB` defaults to `*LOCAL`


For Rest Tests
---
- host `TKHOST` defaults to `localhost`
## Configuring Tests

- user `TKUSER` defaults to ''
Functional tests can be configured using the following enviornment variables.

- password `TKPASS` defaults to ''
- `TKTRANSPORT` - The transport to use. Defaults to use `ssh`.

- port `TKPORT`
- `TKVERBOSE`- Enables verbose output.

- path `TKPATH` defaults to `/cgi-bin/xmlcgi.pgm`
- `TKHOST` - The hostname. Defaults to `localhost`.

For SSH Tests
---
- `TKUSER` - The user to connect as.

- host `TKHOST` defaults to `localhost`
- `TKPASS` - The user's password.

- user `TKUSER` defaults to ''
- `TKDB` - The database to connect to. Defaults to `*LOCAL`.

- password `TKPASS` defaults to ''
- `TKPORT` - The port to use to connect.

- port `TKPORT`
- `TKPATH` - The path to xmlcgi. Defaults to `/cgi-bin/xmlcgi.pgm`

- privateKey `TKPK`
- `TKPK` - The path to a private key file when using `ssh` transport.

- passphrase `TKPHRASE`
- `TKPHRASE` - The passphrase to decrypt the private key.