A simple client for ReportPortal.io (previously hammertime-reportify).
npm install reportizerReportizer is a TS/JS library for interacting with the Report Portal API.
Works best with cucumber-js.
Use the package manager npm to install reportizer.
``bash`
npm install --save-dev reportizer
Please note, before using this package, you should set up an instance of Report Portal for yourself. A public instance is offered by the Report Portal team for demonstration purposes on their site.
typescript
const reportPortalClient = new ReportPortalClient(baseUrl, launchId, authToken);const itemId = await reportPortalClient.createItem(
'The one where employees get paid.',
'Tests the payment process for employees works.',
'SCENARIO'
);
`ItemType type in this repo.$3
Finishing an item automatically maps a cucumber status to a Report Portal status. Inspect the ReportPortalClient class in this repo if you want to know how the statuses are mapped.`typescript
await reportPortalClient.finishItem(
itemId,
Status.PASSED
);
`
Alternatively, as part of a cucumber After hook:
`typescript
After(async function({ result }) {
await reportPortalClient.finishItem(
itemId,
result.status
);
});
`$3
`typescript
await reportPortalClient.addLogToItem(
itemId,
'info',
'This is a log message!'
);
`
Valid log levels can be seen in the LogLevel` type in this repo.