A different approach to UI5 tests execution

Опубликовано: 15 Октябрь 2024
на канале: UI5
1,991
14

When working with the UI5 framework, the recommendation for testing UI is to use either #QUnit or #OPA5. They only require a browser to execute the tests. Hence the minimal work environment of an UI5 developer is composed of an editor, a browser and a web server.

Once the code is tested, linted and reviewed, it goes to the continuous integration pipeline. In this context, the game is different.
Indeed, to execute the tests, the pipeline needs a tooling that is capable of serving the application, opening a browser, piloting the #TestExecution and consolidating the results. Furthermore, this process is usually the place where the code coverage is measured.

The #UI5Tooling proposes a solution based on #karma. In the current implementation, all the tests are executed sequentially in the same browser window. Unfortunately, on very big projects this model appears to not scale properly. Indeed, the combination of iframes in the OPA5 tests and the extra memory needed to collect the code coverage generates leaks that accumulate over time. This can lead the automated browser to crash.

So I investigated a different approach and enabled the tests execution in an environment where :
By splitting the QUnit tests and the different OPA5 journeys, the tests would be no more sequential but parallel.
By using one browser window per test, it limits the consequences of memory leaks and reduces the risk of crash.

This lecture will present this implementation based on a custom web server.

Event: #UI5conONAIR2021
Speaker: Arnaud Buchholz, SAP
---
Agenda:
00:00 Welcome
00:59 Context
06:23 Demo: Karma tests runner
07:47 Serving an UI5 application
11:25 Demo: Serving an UI5 application with REserve
18:10 Demo: Serving an UI5 application with the platform
20:12 Probing the tests
21:16 Demo: Substituting qunit-redirect.js
22:23 Executing the tests
25:44 Demo: Executing the tests in parallel
28:00 Measuring code coverage
32:11 Demo: Coverage measurement
33:26 ui5-test-runner
35:33 Tips & Tricks
40:35 Questions & Answers
---
Resources:
Slides: http://arnaudbuchholz.github.io/decks...
GitHub repository: https://github.com/ArnaudBuchholz/ui5...