Generating an Archive with NexMock

nexploit-cli archive:generate [options] <mockfile> creates HTTP Archive (HAR) files from mock requests generated by unit testing and other local automations. The mock requests are converted into real requests and sent to the target to get real responses. Both requests and responses are saved in HAR format (see the example below).

Supports the latest NexMock API and provides additional features to help you generate HAR files during CI/CD workflows with ease.

In addition, this command has the ability to split NexMock files into multiple HAR files. For this purpose, you can specify the --split option, which accepts the number of pieces into which to split.

For example:

nexploit-cli archive:generate --output archive.har --target url-tested-application --header "Authorization: Bearer my-jwt-authentication-token" --split 4 .nexmock 

The command above creates four .HAR files that comply with following pattern: <basename>(_<number>)?.<extension>. For example, archive.har, archive_2.har and so on.


Argument Description
<mockfile> A NexMock file is obtained from the NexMock Reporters. See the E2E Guide.


Option Description
The path where the new archives are created, relative to the new workspace root.
The target hostname or IP address.
Extra headers to be passed with the NexMock file, which can also be used to remove a header by providing a name without content. For example, -H "Host:".

Warning: Headers set with this option override the archive headers and are set in all requests.
The size of the worker pool. Indicates how many requests Nexploit CLI can perform in parallel.

Default: --pool 250
--timeout=milliseconds The time to wait for a server to send response headers (and start the response body) before aborting the request.

Default: --timeout 5000
The number of the HAR pieces. Enables you to split a NexMock file into multiple HAR files.

Default: --split 1
--config=pathToConfig Specifies the path to the configuration file. By default, the CLI tries to discover the config in package.json in the root directory of your application or a separate file by a specified name in the working directory. For details, see Configuration Files for more information.
Allows setting the level of logs to report. Any logs of a higher level than the one specified are shown. The options to select : 0, 1, 2, 3, 4, "silent", "error", "warn", "notice", "verbose".

Default: 3

Did this page help you?