postmanlabs / newman

Newman is a command-line collection runner for Postman
https://www.postman.com
Apache License 2.0
6.84k stars 1.16k forks source link

Making newman CLI more interactive #2710

Open yashi12 opened 3 years ago

yashi12 commented 3 years ago

Currently while working with newman, to run a collection we have to provide the command to run a collection, what if we can ask the user whether he wants to give the command by himself or do he want us to ask questions so that he can just fill the details, so that he will no longer have to remember the syntax of flags.

We can ask some for some of the most frequently used options.

We can use (Inquirer) to solve it, and can provide a seamless experience to new users who are not that familiar and cannot get even through -h (help) how to use those to make a request.

nimit2801 commented 3 years ago

@yashi12 this is a great idea, can you elaborate on the syntax of the command or some dummy interaction. Which functionalities of inquirer we can implement here?

yashi12 commented 3 years ago

@nimit2801 We can prompt questions like:

Location of the collection? Environment variables? Postman globals file as JSON file? Number of iterations to run?

We can add these kind of questions , and can even provide a newman.json (similar to package.json) so that while working on a project people can reuse that file and add there test cases to be run in that similar file, and don't have to provide basic details again

yashi12 commented 3 years ago

After having a closer look, I think it would be better if instead of prompting questions, if user seeks for --help we provide him with clickable links, and if he chooses one, the same gets appended to his command in CLI, thus he will not have to type it manually nor will have to remember the commands

Example: Makong all thse options clickable, where User can first open --help option and select all those options he want to include, then if he clicks on --close option he will be getting a template of command where he just needs to change the values. We can add --close option to options which will indicate user has selected all options he desired.

Options: -e, --environment Specify a URL or path to a Postman Environment -g, --globals Specify a URL or path to a file containing Postman Globals -r, --reporters [reporters] Specify the reporters to use for this run (default: ["cli"]) -n, --iteration-count Define the number of iterations to run -d, --iteration-data Specify a data file to use for iterations (either JSON or CSV) --folder Specify the folder to run from a collection. Can be specified multiple times to run multiple folders (default: []) --global-var Allows the specification of global variables via the command line, in a key=value format (default: []) --env-var Allows the specification of environment variables via the command line, in a key=value format (default: []) --export-environment Exports the final environment to a file after completing the run --export-globals Exports the final globals to a file after completing the run --export-collection Exports the executed collection to a file after completing the run --postman-api-key API Key used to load the resources from the Postman API --bail [modifiers] Specify whether or not to gracefully stop a collection run on encountering an error and whether to end the run with an error based on the optional modifier --ignore-redirects Prevents Newman from automatically following 3XX redirect responses -x , --suppress-exit-code Specify whether or not to override the default exit code for the current run --silent Prevents Newman from showing output to CLI --disable-unicode Forces Unicode compliant symbols to be replaced by their plain text equivalents --color Enable/Disable colored output (auto|on|off) (default: "auto") --delay-request [n] Specify the extent of delay between requests (milliseconds) (default: 0) --timeout [n] Specify a timeout for collection run (milliseconds) (default: 0) --timeout-request [n] Specify a timeout for requests (milliseconds) (default: 0) --timeout-script [n] Specify a timeout for scripts (milliseconds) (default: 0) --working-dir Specify the path to the working directory --no-insecure-file-read Prevents reading the files situated outside of the working directory -k, --insecure Disables SSL validations --ssl-client-cert-list Specify the path to a client certificates configurations (JSON) --ssl-client-cert Specify the path to a client certificate (PEM) --ssl-client-key Specify the path to a client certificate private key --ssl-client-passphrase Specify the client certificate passphrase (for protected key) --ssl-extra-ca-certs Specify additionally trusted CA certificates (PEM) --cookie-jar Specify the path to a custom cookie jar (serialized tough-cookie JSON) --export-cookie-jar Exports the cookie jar to a file after completing the run --verbose Show detailed information of collection run and each request sent -h, --help display help for command

@coditva , please look if this approach can help in improving the CLI

coditva commented 3 years ago

@yashi12 This seems like an interesting idea! I'm not entirely sure if this is the direction we want Newman to take. I would wait on @codenirvana for his views on this. 😄

yashi12 commented 3 years ago

@coditva, thanks for looking into it.