-
Notifications
You must be signed in to change notification settings - Fork 3
Performance Test Generator
In order to help developers meet the non-functional requirements, we have developed an extension that allows incorporating a performance testing suite to the service being developed. This extension is integrated in the Theia IDE that SmartCLIDE uses as part of the UI. The extension can be used when developing a backend service based on a RESTful interface, when the interface is documented following the OpenAPI (Swagger) standard, and allows an easy integration of the tests into a GitlabCI pipeline, so that they can be run periodically and frequently. Following the idea of fostering best and modern practices, the plugin foster an "API first" approach for services. It takes an existing API descriptor, written following the OpenAPI standard, and creates a base test suite composed of at least one test case per endpoint described in the document. The tests are generated in plain JavaScript, in an attempt to ease the development, and tied to the performance testing tool called "K6".
The functionality is invoked from the Command Palette, by simply searching for "performance". The complete label of the functionality is "SmartCLIDE: Generate performance test script...".
It will search the workspace for files with extensions JSON or YAML, so that the user can choose the file that contains the API description to be used for the test generation.
Next the user will have to provide a desired output folder for the test file relative to the root folder of the current project. The functionality suggests one by default.
After hitting enter, the functionality will be launched on a terminal and will generate a test script including at least one invocation of each method described in the service descriptor. The developer will have to go into the generated file and adapt its contents to actually fit the real use case by modifying the values sent to the service as well as other parameters related to load generation and/or configuration. Please, refer to K6 documentation (https://k6.io/docs/testing-guides/api-load-testing/) for extended info.
Once the test is ready, the developer has the option to add a default configuration for adding a performance test stage to an existing GitlabCI pipeline descriptor file. To do it, the developer will have to go again to the Command Palette, and repeat the search for “performance”. In the search results, select the option “SmartCLIDE: Add performance tests to pipeline…” as shown in the following figure.
The application will search for suitable files within the opened project/folder, and let the developer choose the appropriate one, in case there are more than one for any reason.
The configuration generated for Gitlab might again need to be adjusted to the needs of the testing environment. Once run, the end results of the test can be seen in the Gitlab merge request page, as indicated by the documentation in the Gitlab page (https://docs.gitlab.com/ee/user/project/merge_requests/load_performance_testing.html)
The source code repository of the Performance Testing Component can be found here: https://github.com/eclipse-researchlabs/smartclide-perftestgen-theia