Reportizer 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.
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.
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'
);
Valid item types can be seen in the ItemType
type in this repo.
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.
await reportPortalClient.finishItem(
itemId,
Status.PASSED
);
Alternatively, as part of a cucumber After
hook:
After(async function({ result }) {
await reportPortalClient.finishItem(
itemId,
result.status
);
});
await reportPortalClient.addLogToItem(
itemId,
'info',
'This is a log message!'
);
Valid log levels can be seen in the LogLevel
type in this repo.