I am currently executing some basic performance tests using the following:
- js with Webdriverio for web elements identification/asserts
- Cucumber for creating steps and execution of feature files/tests
- performanceTotal package for measuring and generating performance reports -> https://webdriver.io/docs/wdio-performancetotal-service/
STATUS: the performanceTotal package generates csv and json results files form where I extract information in order to generate a graph that measures the time it takes for changing a page, for example. The results files are generated ONLY AFTER ALL features/steps (including AfterAll) are executed.
ISSUE: in order to generate long term graphs with the results I am interested in, I plan on running the tests in Jenkins, but I need to upload the results files to S3 (upload request successful!) and since the tests results files are available only at the end of the execution, is there a way of executing the upload command "outside" or after the ending of the run?
Here is a snippet of the AfterAll step, where feat is an Array of the features I am testing and item is an object/feature from the array which is used for generating individual graphs. For example feat may contain: [Login, Logout, NavigationToPage_X, etc.]. result is a JSON with the extracted info from the results files used for graph generation.
AfterAll({timeout: 10 * 60000} ,async () => {
logInfo("Starting generation of charts and upload of json result files to S3");
await Promise.all(feat.map(async item => {
await generatePerformanceChart(item, "line", result);
await uploadResultsToS3(item);
}));
logSuccess("Upload of results files to S3 successful!");
});
But this doesn't work as the results files are generated after the AfterAll step for some reason. I would require something that executes the upload command outside the Cucumber framework.
It looks like you are running it under
AfterAllinside of a Step definition? What you need is to use theonCompleteHook under yourwdio.conf.jsinstead. From WebdriverIO doc: