# xaf-blazor-app-load-testing-example **Repository Path**: mirrors_DevExpress/xaf-blazor-app-load-testing-example ## Basic Information - **Project Name**: xaf-blazor-app-load-testing-example - **Description**: XAF Blazor Server application load testing example - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-07-15 - **Last Updated**: 2026-01-17 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # XAF Blazor load testing on Linux and MySql using Puppeteer and GitHub Actions This repository contains a mid-size XAF Blazor application with several views and high-load test scripts in the [tests](https://github.com/DevExpress/xaf-blazor-app-load-testing-example/tree/main/tests) directory (powered by the [Puppeteer](https://github.com/puppeteer/puppeteer), [puppeteer-cluster](https://github.com/thomasdondorf/puppeteer-cluster), and [GitHub Actions](https://github.com/features/actions) automation tools). These test scripts allow running a lot of concurrent browser instances on a cloud virtual Ubuntu machine with a pre-installed MySql database engine. In addition, we can test end user experience in case of moderate server usage/loading. Since the Blazor Server technology uses WebSocket connection instead of HTTP requests, traditional tools like JMeter are not suitable for this task. ## Getting Started 1. Clone this repository: ``` git clone https://github.com/DevExpress/xaf-blazor-app-load-testing-example.git ``` 2. Build and run the application using Visual Studio or .NET SDK CLI. 3. Go to the project's root directory: ``` cd xaf-blazor-app-load-testing-example ``` 3. Install the Node.JS modules for running test scripts: ``` npm install ``` 4. Launch the test scripts for running an application using the following command. Specify the application url and the number of the concurrent browser instances. ``` node ./tests/index.js localhost:5000 30 ``` ## Test Scripts There are two test script samples in this repo. For example, the [list-view-test.js](/tests/list-view-test.js) script opens List View with 100 records per page and switches between pages: ![List View](/images/list-view.png) ``` const DXGRID = '.dxbs-grid .card'; const NEXT_PAGE_BUTTON = '[data-args="PBN"] div svg'; async function listViewTest(page) { await page.waitForSelector(DXGRID, { timeout: 60000 }); await page.evaluate(() => { window.scrollTo(0, window.document.body.scrollHeight); }); for (let i = 0; i < 19; i++) { await page.waitForSelector(NEXT_PAGE_BUTTON); const nextPageButton = await page.$(NEXT_PAGE_BUTTON); await nextPageButton.click(); await page.waitForTimeout(500); await page.waitForFunction(`document.querySelector(".dxbs-grid .page-link input").value === "${i + 2}"`); await page.waitForTimeout(1000); } } module.exports = listViewTest; ``` The [detail-view-test.js](/tests/detail-view-test.js) script is intended for checking Detail View concurrent loading. ![Detail View](/images/detail-view.png) The [run-tests.js](/tests/run-tests.js) script launches all these tests with predefined concurrency and produces a report with information about successful and failed runs. Also, it can capture a screenshot when the test fails. ![Test Log](/images/test-log.png) ![Test Error](/images/test-error.png) ## GitHub Actions CI Integration In the following example, we use a cloud virtual Ubuntu machine for building and running an application and github-hosted runners for tests. This machine has a pre-installed MySql database engine. You can deploy your app any way you want (local machine, cloud VM, Azure App Service, etc.). The workflow described in the [deploy-app-linux.yaml](/.github/workflows/deploy-app-linux.yaml) file is running manually. It builds and runs an app on the self-hosted runner; then, it triggers another workflow [load-tests-linux.yaml](/.github/workflows/load-tests-linux.yaml), which runs load tests themselves. We use the [aurelien-baudet/workflow-dispatch@v2](https://github.com/marketplace/actions/workflow-dispatch-and-wait). ![Failed task](/images/failed-task-on-CI.png) >**NOTE**: We store GitHub personal access token (PAT) in the PERSONAL_TOKEN secret. You can launch the “Build and Run Application on Linux“ workflow, and it will trigger the “Load Testing”. Besides, you can deploy your app manually (e.g., to Azure App Services) and trigger only a second one with a predefined application url. ![Run tests for deploy](/images/run-with-url.png) ## See Also - [Deploy and scale an XAF Blazor Server app to serve hundreds of users with Azure Kubernetes Service](https://github.com/DevExpress/XAF-Blazor-Kubernetes-example/) - [Deployment Recommendations for XAF Blazor UI Applications](https://docs.devexpress.com/eXpressAppFramework/403362/deployment/deployment-recommendations-blazor) - [XAF ASP.NET WebForms or Blazor Server UI for SaaS with 1000 users](https://supportcenter.devexpress.com/ticket/details/t585727/xaf-asp-net-webforms-or-blazor-server-ui-for-saas-with-1000-users)