Node
Prerequisites
1. Install/update ht-cli npm package
npm install -g @hypertestco/ht-cli --save-exacthtcli --helpGetting Started:
1. Create a Test Configuration File
const requestTypes = {
HTTP: 'HTTP',
GRAPHQL: 'GRAPHQL',
KAFKA: 'KAFKA',
GRPC: 'GRPC',
AMQP: 'AMQP',
};
module.exports = {
htBackendBaseUrl: "", // URL of HyperTest server (Required)
serviceIdentifier: "", // UUID for the service (Required)
requestTypesToTest: [requestTypes.HTTP], // What kind of requests to include in the test
httpCandidateUrl: "", // HTTP URL of App under test (Optional)
// graphqlCandidateUrl: "", // GraphQL URL of App under test (Optional)
appStartCommand: process.platform === 'win32' ? 'npm.cmd' : 'npm', // Command to start the app (Required)
appStartCommandArgs: ["run", "start-app-with-nyc"], // App start command arguments (Required)
appWorkingDirectory: __dirname, // Working directory for the app (default: current working dir) (Optional)
appStartTimeoutSec: 90, // Timeout in seconds for the start command (default: 10) (Optional)
testBatchSize: 50, // Number of concurrent test requests (default: 50) (Optional)
//testRequestsLimit": 10, // Number requests to test (Optional)
//httpReqFiltersArr: [], // "<GET /users>", "<ANY REGEX:^/payments>" (Optional)
htExtraHeaders: { // Object containing additional headers for HyperTest server requests (Optional)
// authorization: 'Basic ' + Buffer.from('USERNAME:PASSWORD').toString('base64')
},
// httpReqsToTest: [], // specific http requests to be tested can be mentioned. Request Id can be taken from "All Requests" page in dashboard.
// graphqlReqsToTest: [], // specific graphql requests to be tested can be mentioned.
// grpcReqsToTest: [], // specific grpc requests to be tested can be mentioned.
// kafkaReqsToTest: [], // specific kafka requests to be tested can be mentioned.
// amqpReqsToTest: [], // specific amqp requests to be tested can be mentioned.
// tags: [{name: '', value: ''}], // requests which contain the mentioned tags will be tested. Refer Tags under "User Guides/Node.js SDK" for more information.
// exitCodeSetter({ testResult }) {
// console.log('==test results==')
// console.log(testResult)
// return 0;
//},
// exclusionStringsForDifferences: [], // e.g., ['01\.02\.03\.04', 'HyPeRtEsT'],
// reservedAppPorts: [], // Ports used by the host application e.g., [3001,4001]
};2. CLI token generation
3. Start new test
4. Update HT Packages
5. Update Code Coverage
6. Adding Hypertest CLI commands as scripts to your app's package.json
7. Test reports

Last updated