Skip to content

Commit 5ba3b97

Browse files
authored
docs: Update test/README.md (#241)
1 parent cd47476 commit 5ba3b97

File tree

1 file changed

+19
-68
lines changed

1 file changed

+19
-68
lines changed

test/README.md

Lines changed: 19 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,93 +1,44 @@
11
# Node.js Toolkit Tests
22

3-
Ensure dependencies are installed
3+
Ensure dependencies are installed by running `npm install` from the project root.
44

5-
From the root of the project run: `npm install`
5+
## Running Tests
66

7-
***NOTE***
8-
9-
Some tests require creating libraries, objects, tables, etc.
10-
11-
A before hook is setup to check for theses objects and create if needed.
12-
13-
These hooks are ran with `idb-pconnector` which requires to be run on IBM i.
14-
15-
In any case, the functional tests test for both transports Db2 and REST.
16-
17-
Using Db2 transport requires `idb-connector` which only runs on IBM i systems.
7+
- Run unit tests with `npm test`.
188

19-
Tests using these hooks will fail on non IBM i systems.
20-
21-
# Running Tests
22-
23-
From the project root
24-
25-
`npm test test/foo`
26-
27-
where foo is the name of subdir such as `unit` or or individual test file.
9+
- Run functional tests with `npm run test-integration`.
2810

2911
***NOTE***
3012

31-
If you experience timeout issue with network calls add
32-
33-
`"test": "./node_modules/mocha/bin/mocha" --timeout Xs `
34-
35-
within `package.json` file, where X is the number of seconds before timeout
13+
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.
3614

37-
# Setup Rest interface
15+
## Setup Rest interface
3816
- view the [README](../README.md#rest)
3917

40-
# Setup SSH interface
18+
## Setup SSH interface
4119
- view the [README](../README.md#ssh)
4220

43-
# Configuring Tests
44-
Each functional test contains an config object that is used to create connections
45-
46-
It is recommend to setup environment variables for these configurations
47-
48-
Instead of hard coding credentials with the test file.
49-
50-
you can set environment varaibales with `export KEY='value'`
51-
52-
53-
For all tests
54-
---
55-
- verbose `TKVERBOSE` enables verbose mode
56-
57-
For idb-connector Tests
58-
---
59-
60-
- user `TKUSER` defaults to ''
61-
62-
- password `TKPASS` defaults to ''
63-
64-
- database `TKDB` defaults to `*LOCAL`
65-
66-
67-
For Rest Tests
68-
---
69-
- host `TKHOST` defaults to `localhost`
21+
## Configuring Tests
7022

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

73-
- password `TKPASS` defaults to ''
25+
- `TKTRANSPORT` - The transport to use. Defaults to use `ssh`.
7426

75-
- port `TKPORT`
27+
- `TKVERBOSE`- Enables verbose output.
7628

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

79-
For SSH Tests
80-
---
31+
- `TKUSER` - The user to connect as.
8132

82-
- host `TKHOST` defaults to `localhost`
33+
- `TKPASS` - The user's password.
8334

84-
- user `TKUSER` defaults to ''
35+
- `TKDB` - The database to connect to. Defaults to `*LOCAL`.
8536

86-
- password `TKPASS` defaults to ''
37+
- `TKPORT` - The port to use to connect.
8738

88-
- port `TKPORT`
39+
- `TKPATH` - The path to xmlcgi. Defaults to `/cgi-bin/xmlcgi.pgm`
8940

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

92-
- passphrase `TKPHRASE`
43+
- `TKPHRASE` - The passphrase to decrypt the private key.
9344

0 commit comments

Comments
 (0)