Skip to content

Commit

Permalink
docs(newman): update readme to match v3
Browse files Browse the repository at this point in the history
  • Loading branch information
delatrie committed Oct 28, 2024
1 parent 4608b8f commit 205d161
Showing 1 changed file with 36 additions and 69 deletions.
105 changes: 36 additions & 69 deletions packages/newman-reporter-allure/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,100 +12,67 @@

---

## Installation

```console
$ npm install -g newman-reporter-allure
```

## Usage

To generate Allure results, specify `allure` in Newman's `-r` or `--reporters` option.
## The documentation and examples

```console
$ newman run <Collection> -e <Environment> -r allure
$ newman run <Collection> -e <Environment> -r allure --reporter-allure-resultsDir <allure-results-out-dir>
```

Use the option `--reporter-allure-collection-as-parent-suite` to use the collection name as the parent suite title under the _Suites_ view. This helps when you run multiple collections and want to aggregate them in a single report.

## Metadata
The docs for Allure Newman are available at [https://allurereport.org/docs/newman/](https://allurereport.org/docs/newman/).

You can add allure labels by passing javascript comments in the test field of postman request declaration
Also, check out the examples at [github.com/allure-examples](https://github.com/orgs/allure-examples/repositories?q=visibility%3Apublic+archived%3Afalse+topic%3Aexample+topic%3Anewman).

### Id
## Installation

```javascript
// @allure.id=228
Intall `newman-reporter-allure` using a package manager of your choice. For example:

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```shell
npm install -D newman-reporter-allure
```

### Label
## Usage

```javascript
// @allure.label.{{labelName}}={{labelValue}}
Enable the `allure` reporter via the CLI:

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```shell
$ newman run "<Collection>" -e "<Environment>" -r allure
```

### Story

```javascript
// @allure.label.story=storyName
You may combine `allure` with other reporters:

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```shell
$ newman run "<Collection>" -e "<Environment>" -r cli,allure
```

### Suite
When the test run completes, the result files will be generated in the `./allure-results` directory.

```javascript
// @allure.label.suite=suiteName
You may select another location, or further customize the reporter's behavior with [the configuration options](https://allurereport.org/docs/newman-configuration/).

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```
### View the report

### Owner
> You need Allure Report to be installed on your machine to generate and open the report from the result files. See the [installation instructions](https://allurereport.org/docs/install/) on how to get it.
```javascript
// @allure.label.owner=ownerName
Generate Allure Report after the tests are executed:

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```bash
allure generate ./allure-results -o ./allure-report
```

### Tag
Open the generated report:

```javascript
// @allure.label.tag=tagName

pm.test("Status code is 200", function () {
pm.response.to.be.ok;
});
```bash
allure open ./allure-report
```

## Generating and Serving Allure report

Allure results will be generated under folder "allure-results" in the root location.
Use allure-commandline to serve the report locally.
## Allure API

```console
$ allure serve
```

Generate the static report web-application folder using allure-commandline
Enhance the report by utilizing the Allure API:

```console
$ allure generate --clean
```js
// @allure.label.epic:Authorization
// @allure.label.feature:BearerAuthorization
// @allure.label.story:ValidBearerToken
// @allure.label.tag:api
// @allure.label.owner:eroshenkoam
pm.test("Test Authentication", function () {
// ...
});
```

Report will be generated under folder "allure-report" in the root location.
More details about the API are available at [https://allurereport.org/docs/newman-reference/](https://allurereport.org/docs/newman-reference/).

0 comments on commit 205d161

Please sign in to comment.