diff --git a/docs/en/cli/index.md b/docs/en/cli/index.md index 887b684f316..e668bca730b 100644 --- a/docs/en/cli/index.md +++ b/docs/en/cli/index.md @@ -80,6 +80,7 @@ Here is the list of all available commands before explaining their details: - [generate-razor-page](../cli#generate-razor-page): Generates a page class that you can use it in the ASP NET Core pipeline to return an HTML page. - [generate-jwks](../cli#generate-jwks): Generates an RSA key pair (JWKS public key + PEM private key) for OpenIddict `private_key_jwt` client authentication. - [mcp](../cli#mcp): Runs a local MCP bridge to the ABP.IO MCP service, so AI coding assistants can search the ABP documentation, articles, support questions and source code. +- [test](../cli#test): Runs the ABP Studio UI/UX Test or Security Test of a solution, or sets a GitHub repository up to run them on CI. ### help @@ -1399,6 +1400,55 @@ args = ["mcp"] | `search_source_code` | Searches the indexed ABP source code. | | `list_abp_github_repositories` | Lists the ABP GitHub repositories available to the source code search. | +### test + +Runs the AI-powered [UI/UX Test](../studio/ui-ux-test.md) or [Security Test](../studio/security-test.md) of a solution without the ABP Studio UI, or sets a GitHub repository up to run them on CI. The tests read the same inputs file as ABP Studio (`abp-ui-ux-test.json` or `abp-security.json` in the solution folder). + +> This command needs the ABP Studio agent server: `dotnet tool install -g Volo.Abp.Studio.AgentServer`. The tests use AI, so sign in with `abp login` first (on CI, set `ABP_ACCESS_TOKEN`). + +Usage: + +```bash +abp test ui-ux [options] +abp test security [options] +abp test init-ci [options] +``` + +Options of `ui-ux` and `security`: + +- `--solution` or `-s`: The `.abpsln` file. Default: the one in the current folder. +- `--mode`: `codebase` (reviews the code), `runtime` (tests the running applications) or `both`. Default: the inputs file's mode, else `both`. +- `--url`: The running applications to test, as `Name=[,Name=]`. Default: the `targets` of the inputs file. +- `--start`: Starts the solution's default run profile (containers, tasks, build and applications) before the test, and stops it afterwards. +- `--profile`: The run profile `--start` uses. +- `--changed-since`: Reviews only the code changed since a git ref (`origin/main`), a date (`2026-11-01`) or a time span (`7d`, `2w`). +- `--model`: The model to test with. +- `--output`: The report folder. Default: `TestResults/ui-ux` or `TestResults/security`. +- `--fail-on`: Which findings fail the test. `ui-ux`: `defect` (default), `confirmed`, `high` or `none`. `security`: `high` (default), `any`, `confirmed` or `none`. +- `--verbose`: Writes detailed logs. + +Options of `init-ci`: + +- `--solution` or `-s`: The `.abpsln` file. +- `--repo` or `-r`: The GitHub repository (`owner/name`). Default: the repository of the solution folder. +- `--mode`: `both` (default) starts the applications and tests them with the code; `codebase` reviews the code only. +- `--force`: Replaces an existing workflow file. +- `--show-token`: Prints the CI token when the GitHub CLI (`gh`) is not installed, so you can add the secret yourself. + +Exit codes of `ui-ux` and `security`: `0` passed, `1` findings past `--fail-on`, `2` error, `3` the AI stopped the test, `4` the AI cannot be used. + +Examples: + +```bash +abp test ui-ux --mode both --start +abp test security --url Web=https://localhost:44302 --fail-on confirmed +abp test security --mode codebase --changed-since origin/main +abp test ui-ux --mode codebase --changed-since 7d +abp test init-ci +``` + +See [Running the AI Tests from the CLI and on CI](../studio/ai-testing-on-ci.md) for the details, the reports and the GitHub Actions workflow. + ## See Also - [Examples for the new command](./new-command-samples.md) diff --git a/docs/en/docs-nav.json b/docs/en/docs-nav.json index 0b79368baef..073024c8264 100644 --- a/docs/en/docs-nav.json +++ b/docs/en/docs-nav.json @@ -388,6 +388,27 @@ } ] }, + { + "text": "AI Testing", + "items": [ + { + "text": "Overview", + "path": "studio/ai-testing.md" + }, + { + "text": "UI/UX Test", + "path": "studio/ui-ux-test.md" + }, + { + "text": "Security Test", + "path": "studio/security-test.md" + }, + { + "text": "Running the AI Tests from the CLI and on CI", + "path": "studio/ai-testing-on-ci.md" + } + ] + }, { "text": "Concepts", "path": "studio/concepts.md" diff --git a/docs/en/studio/ai-testing-on-ci.md b/docs/en/studio/ai-testing-on-ci.md new file mode 100644 index 00000000000..b99bc0f7c21 --- /dev/null +++ b/docs/en/studio/ai-testing-on-ci.md @@ -0,0 +1,148 @@ +```json +//[doc-seo] +{ + "Description": "Run the ABP Studio UI/UX Test and Security Test from the ABP CLI with abp test, and set them up on GitHub Actions with abp test init-ci." +} +``` + +# ABP Studio: Running the AI Tests from the CLI and on CI + +````json +//[doc-nav] +{ + "Previous": { + "Name": "Security Test", + "Path": "studio/security-test" + }, + "Next": { + "Name": "Concepts", + "Path": "studio/concepts" + } +} +```` + +The [UI/UX Test](ui-ux-test.md) and the [Security Test](security-test.md) also run without the Studio UI, with the `abp test` command of the [ABP CLI](../cli/index.md). They read the same [inputs files](ai-testing.md#the-inputs-file) as Studio, write their reports to a folder, and end with an exit code, so they can run on a developer machine or on CI. + +## Requirements + +- The ABP CLI and the ABP Studio agent server, which runs the tests: + + ```bash + dotnet tool install -g Volo.Abp.Studio.Cli + dotnet tool install -g Volo.Abp.Studio.AgentServer + ``` + +- A signed-in ABP account with AI access. On a developer machine, sign in with `abp login`. On CI, set the `ABP_ACCESS_TOKEN` environment variable (see [Setting Up GitHub Actions](#setting-up-github-actions)); for an account without two-factor authentication, `ABP_USERNAME` and `ABP_PASSWORD` (and `ABP_ORGANIZATION`) also work. +- For the runtime part, the applications running, or `--start` to start them. +- The test accounts' passwords in the environment variables the inputs file names (`passwordEnv`). + +## Running a Test + +```bash +abp test ui-ux --solution MyCompany.MyProject.abpsln --mode both --start +abp test security --solution MyCompany.MyProject.abpsln --mode both --start +``` + +| Option | Description | +| --- | --- | +| `--solution` | The `.abpsln` file. Default: the one in the current folder. | +| `--mode` | `codebase` (reviews the code), `runtime` (tests the running applications) or `both`. Default: the inputs file's mode, else `both`. | +| `--url Name=[,Name=]` | The running applications to test. Default: the `targets` of the inputs file. | +| `--start` | Starts the solution's default run profile before the test, and stops what it started afterwards. | +| `--profile` | The run profile `--start` uses, instead of the default one. | +| `--changed-since` | Reviews only the code changed since a git ref (`origin/main`), a date (`2026-11-01`) or a time span (`7d`, `2w`, `12h`, `3mo`). | +| `--model` | The model to test with. Default: the inputs file's model, else the default model. | +| `--output` | The report folder. Default: `TestResults/ui-ux` or `TestResults/security`. | +| `--fail-on` | Which findings fail the test (exit code `1`). See below. | +| `--verbose` | Writes detailed logs. | + +`--fail-on` values: + +| Test | Values | Default | +| --- | --- | --- | +| `ui-ux` | `defect` (any defect; improvements never fail the test), `confirmed` (confirmed defects only), `high` (High and Critical defects), `none` | `defect` | +| `security` | `high` (High and Critical findings), `any`, `confirmed` (confirmed findings only), `none` | `high` | + +### Starting the applications + +With `--start`, the test does what the [Solution Runner](running-applications.md) does on a clean machine: it starts the run profile's Docker containers, runs the tasks that prepare the solution (such as the database migration), builds the solution once, then starts the applications in order. If a container, a task, the build or an application fails, the test stops before testing (exit code `2`). Everything it started is stopped when the test ends. + +Free the applications' ports first: an application already holding one is stopped. + +### Testing only the changes + +`--changed-since` limits the code review to the files changed since a point in the history, including uncommitted and untracked files. Findings in other files are not reported. The running applications are still tested in full, since a changed file does not tell which pages it changes. + +| Value | Reviews the files changed | +| --- | --- | +| A branch, tag or commit, such as `origin/main` | since the branch point with that ref, as a pull request shows them | +| A date, such as `2026-11-01` | since the last commit before that date | +| A time span, such as `7d`, `2w`, `12h` or `3mo` | since the last commit before that time (days, weeks, hours, months) | + +A date and a time span are resolved from the git history, so they also work on CI, where the checkout has the full history (`fetch-depth: 0`). The test prints the commit it counted from. + +## Reports + +| Test | Files | +| --- | --- | +| `ui-ux` | `ui-ux-test.json` and `ui-ux-test.md`, with the screenshots beside them | +| `security` | `security-test.json`, `security-test.md` and `security-test.sarif` | + +## Exit Codes + +| Code | Meaning | +| --- | --- | +| `0` | Passed. | +| `1` | Findings past `--fail-on`. | +| `2` | Error: the test could not run or finish (for example, the applications did not start, the sign-in failed, or the code review failed). | +| `3` | The AI stopped the test (for example, no credits left). The report holds what was found until then. | +| `4` | The AI cannot be used: sign in, or check the license. | + +## Setting Up GitHub Actions + +`abp test init-ci` sets a GitHub repository up to run both tests: + +```bash +abp test init-ci --solution MyCompany.MyProject.abpsln +``` + +It: + +1. Creates a token for CI through your browser (two-factor authentication included). Your own sign-in on the machine stays as it is. The command prints the date the token expires; run it again before then. +2. Sets the token as the repository's `ABP_ACCESS_TOKEN` secret with the [GitHub CLI](https://cli.github.com/) (`gh`). +3. Writes `.github/workflows/abp-tests.yml`. Commit it. + +| Option | Description | +| --- | --- | +| `--solution` | The `.abpsln` file. Default: the one in the current folder. | +| `--repo ` | The repository to set the secret on. Default: the repository of the solution folder. | +| `--mode` | `both` (default): the workflow starts the applications and tests them with the code. `codebase`: it reviews the code only. | +| `--force` | Replaces an existing workflow file. Without it, an existing file is not changed. | +| `--show-token` | When `gh` is not installed, prints the token so that you can add the secret yourself. | + +The workflow runs the UI/UX Test and the Security Test as two jobs: + +- **On a pull request**, the code review covers only the files the pull request changes (`--changed-since origin/`). The started applications are tested in full. +- **Weekly** (Monday 03:00 UTC) and **on demand**, the whole code is reviewed. +- The reports are uploaded as build artifacts, and the Security Test's findings are sent to GitHub code scanning, where they show in the pull request and the *Security* tab. Private repositories need GitHub Advanced Security for that. +- Pull requests from forks and from Dependabot are skipped, because GitHub does not give them the repository's secrets. + +Each run uses AI credits of the account behind `ABP_ACCESS_TOKEN`. Remove the `schedule` trigger to run the tests on demand and on pull requests only. + +> With `--mode both`, the workflow builds and starts the applications of the solution's default run profile on the runner. If they need a database or another service the runner does not have, add it to the workflow, or run `abp test init-ci --mode codebase --force` to review the code only. + +To test with test accounts on CI, add each account's password as a repository secret, and set the environment variable the inputs file names in the test step: + +```yaml +- name: UI/UX test + env: + ABP_ACCESS_TOKEN: ${%{{{ secrets.ABP_ACCESS_TOKEN }}}%} + ABP_TEST_ADMIN_PASSWORD: ${%{{{ secrets.ABP_TEST_ADMIN_PASSWORD }}}%} +``` + +## See Also + +- [AI Testing](ai-testing.md) +- [UI/UX Test](ui-ux-test.md) +- [Security Test](security-test.md) +- [ABP CLI](../cli/index.md#test) diff --git a/docs/en/studio/ai-testing.md b/docs/en/studio/ai-testing.md new file mode 100644 index 00000000000..79b78a3db55 --- /dev/null +++ b/docs/en/studio/ai-testing.md @@ -0,0 +1,149 @@ +```json +//[doc-seo] +{ + "Description": "Overview of the AI-powered UI/UX Test and Security Test in ABP Studio: what they check, the inputs they use, the results, and fixing and re-verifying findings." +} +``` + +# ABP Studio: AI Testing + +````json +//[doc-nav] +{ + "Next": { + "Name": "UI/UX Test", + "Path": "studio/ui-ux-test" + } +} +```` + +ABP Studio has two AI-powered tests for the open solution: + +- **[UI/UX Test](ui-ux-test.md)** checks the pages of the running applications and the UI code for broken layouts, accessibility problems, missing translations and pages that do not work as they should. +- **[Security Test](security-test.md)** reviews the code for vulnerabilities and attacks the running applications the way a penetration tester would. + +Both tests are opened from the menu bar, use the same inputs, show their findings the same way, and can send the findings to the [AI Agent](ai-agent.md) to be fixed. They also run without the UI, from the [ABP CLI and on CI](ai-testing-on-ci.md). + +## Codebase and Runtime + +Each test has two parts. Choose one of them or both before starting a test: + +- **Codebase** reviews the solution's source code. It does not need a running application. +- **Runtime** tests the applications that are running in the [Solution Runner](running-applications.md). Tick them under *Apps to Test*. + +If no application is ticked, Studio asks whether to review the code only. + +> The runtime part uses the applications for real. The UI/UX Test clicks buttons and submits forms; the Security Test sends real requests, including writes. Both can change or delete data, so run them on a development or test instance whose data you can lose. + +## Requirements + +- An open solution. +- A working AI connection: an ABP AI plan, or your own model configured in *AI Settings* (see [AI Agent Configuration](ai-agent-configuration.md)). The *Test with* list chooses the model. A test makes many AI calls; with an ABP AI plan, they use its credits. +- For the runtime part, the applications running in the Solution Runner. + +Only one of the two tests (or a re-verification) runs at a time. + +## Starting and Stopping a Test + +1. Click *UI/UX Test* or *Security Test* in the menu bar. +2. Choose the mode: *Codebase + Runtime*, *Codebase* or *Runtime*. +3. Tick the running applications under *Apps to Test*. +4. Optionally pick a model in *Test with*, and click *Configure Inputs* to add test accounts or instructions. +5. Click *Start Test*. + +*Stop Test* ends the test after the step it is on and keeps the findings found so far; the status reads *Stopping…* until then. Clicking *Stop Test* again while it waits, and confirming with *Stop Now*, ends the test at once, and nothing from that run is kept. If the AI can no longer be used (no credits left, a rejected key, or the AI access was lost), the test stops the same way as *Stop Test* and says why. + +With *Incremental* on, the code review covers only the files changed since the last test, and the findings of the other files are carried over. The running applications are always tested in full. + +## Test Inputs + +Click *Configure Inputs* to set: + +![configure-inputs](images/ai-testing/configure-inputs.png) + +- **Test accounts**: up to two user names and passwords. With an account, the test signs in and also checks the pages behind the sign-in. How each test uses a second account is described on its page ([UI/UX Test](ui-ux-test.md#two-test-accounts), [Security Test](security-test.md#runtime)). +- **Login page URL**: only needed if the test cannot find the sign-in page by itself. Use a path on the application, such as `/Account/Login`, or a full `http://` or `https://` address. A value that is not an address (such as a single word) is not used, and a warning is shown under the field. +- **Test instructions**: free text that tells the test what to focus on or what to skip. They are kept in a Markdown file when the inputs are saved to a file; *Use another file…* picks a Markdown file of your own instead. + +### Signing in + +The test signs in through the application's own login page, in a browser. When the login page is on a separate authentication server (for example, a tiered solution or an Angular application), the sign-in starts from the application, so that a single-page application completes its own login and receives its token; if that does not work, the given *Login page URL* is tried once. + +The password is typed into the login form by Studio; it is never sent to the AI. If the application turns the password down, the test does not try it again, so a wrong password cannot lock the test account, and a warning says why the sign-in failed. + +### The inputs file + +*Save to File* writes the inputs to the solution folder, so they come back when the solution is opened again and can be committed: + +- `abp-ui-ux-test.json` for the UI/UX Test, with the instructions in `abp-ui-ux-test.md`. +- `abp-security.json` for the Security Test, with the instructions in `abp-security.md`. + +Passwords are never written to the file. Each account names an environment variable that holds its password; set it where the test runs, or type the password in *Configure Inputs*. + +````json +{ + "mode": "both", + "model": "anthropic/claude-sonnet-5.5", + "targets": [ + { "name": "Web", "url": "https://localhost:44302" } + ], + "loginUrl": "/Account/Login", + "accounts": [ + { "username": "admin", "passwordEnv": "ABP_TEST_ADMIN_PASSWORD" }, + { "username": "viewer", "passwordEnv": "ABP_TEST_VIEWER_PASSWORD" } + ], + "instructionsFile": "abp-ui-ux-test.md" +} +```` + +| Field | Description | +| --- | --- | +| `mode` | `both`, `codeReview` or `runtime`. `codebase` is accepted too, as the CLI names it. | +| `model` | The model to test with. When it is not available, the default model is used. | +| `targets` | The running applications to test (`name` and `url`). Used by the CLI; in Studio, the applications are ticked under *Apps to Test*. | +| `loginUrl` | The login page, as in *Configure Inputs*. | +| `accounts` | Up to two accounts: `username` and `passwordEnv`, the name of the environment variable that holds the password. | +| `instructions` / `instructionsFile` | The test instructions, as text or as a Markdown file inside the solution folder. | +| `viewports` | UI/UX Test only: the screen widths to test the pages at (`360`, `768`, `1280`, `1920`). | + +The Security Test file also holds the test's [policy](security-test.md#policy): `scope`, `suppress` and `severityOverrides`. Saving the inputs from Studio keeps these fields as they are. + +So that a cloned repository cannot send the passwords elsewhere, the `targets` and the `loginUrl` in the file must be local addresses (such as `localhost`), and the instructions file must be inside the solution folder. A file that cannot be read is not overwritten. + +## Results + +The findings are listed with the most severe first. The last results of the open solution are shown again when the test is opened. + +- *View Results* opens the results in a tab of their own. +- *Export Results* saves them as Markdown or JSON. +- *Clear Results* deletes them. + +Each test also shows what it covered, and checks the findings of the AI a second time before reporting them; see [UI/UX Test](ui-ux-test.md#coverage) and [Security Test](security-test.md#findings). Few findings with a large coverage mean the application looks good; few findings with a small coverage mean the test could not reach much of it. + +## Fixing and Re-verifying + +1. Tick the findings to fix, or use *Select All*. +2. Optionally pick the model for the fix in *Fix with*. +3. Click *Fix Selected*. A new [AI Agent](ai-agent.md) session opens with the findings, and the agent changes the code there. +4. When the agent finishes, choose *Re-verify now*, or tick the findings later and click *Re-verify Selected*. + +If some selected findings are unconfirmed, Studio offers to re-verify them before changing any code. + +Re-verification checks the findings again against the code and the running applications. If an application still runs the code from before the fix, Studio offers to restart it first. A finding sent to the agent shows as fixed only after it is re-verified, and a finding seen in a running application can only be re-verified while that application runs: Studio names the application to start, and leaves such findings as they are until then. + +| Test | Re-verification results | +| --- | --- | +| UI/UX Test | Fixed, Still failing, Could not re-verify, Incomplete | +| Security Test | Fixed, Still exploitable, Not exploitable, Could not re-verify, Re-verify interrupted | + +## Troubleshooting + +- **Only the code was reviewed.** No running application was ticked, so the test reviewed the code only. Start the application in the Solution Runner and tick it under *Apps to Test*. +- **Pages behind the sign-in are missing, or the test could not sign in.** Add a test account in *Configure Inputs* and check its password. If the test cannot find the sign-in page, set the *Login page URL* there. + +## See Also + +- [UI/UX Test](ui-ux-test.md) +- [Security Test](security-test.md) +- [Running the AI Tests from the CLI and on CI](ai-testing-on-ci.md) +- [Solution Runner](running-applications.md) diff --git a/docs/en/studio/images/ai-testing/configure-inputs.png b/docs/en/studio/images/ai-testing/configure-inputs.png new file mode 100644 index 00000000000..887945a14fc Binary files /dev/null and b/docs/en/studio/images/ai-testing/configure-inputs.png differ diff --git a/docs/en/studio/images/ai-testing/security-test-statistics.png b/docs/en/studio/images/ai-testing/security-test-statistics.png new file mode 100644 index 00000000000..2834ff0d77c Binary files /dev/null and b/docs/en/studio/images/ai-testing/security-test-statistics.png differ diff --git a/docs/en/studio/images/ai-testing/security-test.png b/docs/en/studio/images/ai-testing/security-test.png new file mode 100644 index 00000000000..e3de1d23406 Binary files /dev/null and b/docs/en/studio/images/ai-testing/security-test.png differ diff --git a/docs/en/studio/images/ai-testing/ui-ux-test-coverage.png b/docs/en/studio/images/ai-testing/ui-ux-test-coverage.png new file mode 100644 index 00000000000..05977a5fa0c Binary files /dev/null and b/docs/en/studio/images/ai-testing/ui-ux-test-coverage.png differ diff --git a/docs/en/studio/images/ai-testing/ui-ux-test.png b/docs/en/studio/images/ai-testing/ui-ux-test.png new file mode 100644 index 00000000000..96dad6c829b Binary files /dev/null and b/docs/en/studio/images/ai-testing/ui-ux-test.png differ diff --git a/docs/en/studio/security-test.md b/docs/en/studio/security-test.md new file mode 100644 index 00000000000..7b8497f4b38 --- /dev/null +++ b/docs/en/studio/security-test.md @@ -0,0 +1,106 @@ +```json +//[doc-seo] +{ + "Description": "Use the ABP Studio Security Test to review the code for vulnerabilities and attack the running applications like a penetration tester, then verify and fix the findings." +} +``` + +# ABP Studio: Security Test + +````json +//[doc-nav] +{ + "Previous": { + "Name": "UI/UX Test", + "Path": "studio/ui-ux-test" + }, + "Next": { + "Name": "Running the AI Tests from the CLI and on CI", + "Path": "studio/ai-testing-on-ci" + } +} +```` + +The Security Test looks for vulnerabilities in the solution. It reviews the source code, attacks the running applications the way a penetration tester would, and then checks each finding against the running applications before reporting it. + +How to start a test, the inputs, the results and fixing are the same for both tests; see [AI Testing](ai-testing.md). + +![security-test](images/ai-testing/security-test.png) + +## What the Test Checks + +### Codebase + +The AI reviews the code for vulnerabilities such as missing authorization, injection, insecure configuration and hardcoded secrets. Which files are reviewed can be narrowed with the [policy](#policy). + +### Runtime + +The test crawls the applications' pages in a browser, finds their HTTP API endpoints, and lets an AI agent attack them with direct HTTP requests. With test accounts it signs in first: + +- The first account is used for the attack, so the endpoints behind the sign-in are tested too. +- With two accounts, it also checks whether one user can reach the other user's data. + +For a single-page application (such as Angular) whose API takes a bearer token instead of a cookie, the test uses the token the application received at sign-in, and renews it before it expires. + +### Verification + +A separate AI agent checks each finding again, against the code and the running applications, and tries to reproduce it. The verification uses the session the test already signed in with, so it does not sign in again for each finding. + +- **Confirmed**: the verification reproduced the finding. +- **Unconfirmed**: the verification could not reproduce it. +- **Incomplete**: the verification could not run, for example because the finding's application was not running. Start the application and re-verify the finding. + +Findings the verification proves false are removed. + +## Findings + +The findings are listed with the most severe first; filter them with *Severity* and *Status*. Each finding shows its severity and CWE, a description, how it can be reached (anonymously or with a signed-in account), the attack path and the remediation. + +A finding of the code review shows its file and line, and opens it in the editor; a finding of the attack on a running application shows the request it was found with. *Checked against* names the application it was verified on. + +*Runtime Test Statistics* shows the pages crawled, the endpoints probed and the account the test was signed in with. *Export Results* can also save the findings as SARIF, for code scanning tools such as GitHub code scanning. + +![security-test-statistics](images/ai-testing/security-test-statistics.png) + +## Policy + +The `abp-security.json` file in the solution folder can also hold the test's policy: which code is reviewed, which findings are accepted, and which severities are changed. ABP Studio has no screen for the policy; edit the file. It applies to the test in Studio, on the CLI and on CI. + +````json +{ + "scope": { + "includeTests": false, + "include": [ "src/**" ], + "exclude": [ "src/**/Samples/**" ] + }, + "suppress": [ + { "cwe": "CWE-327", "path": "src/**/*Fingerprint*.cs", "reason": "Not used for security." } + ], + "severityOverrides": [ + { "cwe": "CWE-200", "severity": "low" } + ] +} +```` + +| Field | Description | +| --- | --- | +| `scope.includeTests` | Reviews the test projects too. Default `false`. | +| `scope.include` | Glob patterns relative to the solution folder. When set, only the matching files are reviewed. | +| `scope.exclude` | Glob patterns to leave out, on top of the defaults (test projects, build output and generated migrations). | +| `suppress` | Findings to drop as accepted. Each entry matches by `rule`, `cwe` and/or `path` (a glob); `reason` is kept for the record. `rule` is the finding's rule id, as the `ruleId` of the SARIF report shows it: its CWE, or a name made from its title when it has none. | +| `severityOverrides` | Findings whose severity is changed. Each entry matches by `rule`, `cwe` and/or `path`, and sets `severity`: `critical`, `high`, `medium`, `low` or `info`. | + +In the glob patterns, `*` matches within a path segment and `**` across segments. The scope applies to the code: findings of the running applications that have no source file are always kept. + +## Troubleshooting + +For the problems both tests share, see [AI Testing](ai-testing.md#troubleshooting). + +- **Findings are Incomplete.** Their application was not running, or the verification did not finish. Start the application and re-verify them. +- **The session expired during the test.** A test account's token could not be renewed, so part of the test ran without a sign-in. Run the test again. + +## See Also + +- [AI Testing](ai-testing.md) +- [UI/UX Test](ui-ux-test.md) +- [Running the AI Tests from the CLI and on CI](ai-testing-on-ci.md) diff --git a/docs/en/studio/ui-ux-test.md b/docs/en/studio/ui-ux-test.md new file mode 100644 index 00000000000..89c10cec41d --- /dev/null +++ b/docs/en/studio/ui-ux-test.md @@ -0,0 +1,95 @@ +```json +//[doc-seo] +{ + "Description": "Use the ABP Studio UI/UX Test to check the pages of running applications and the UI code for broken layouts, accessibility issues, missing translations and pages that do not work." +} +``` + +# ABP Studio: UI/UX Test + +````json +//[doc-nav] +{ + "Previous": { + "Name": "AI Testing", + "Path": "studio/ai-testing" + }, + "Next": { + "Name": "Security Test", + "Path": "studio/security-test" + } +} +```` + +The UI/UX Test checks the solution's user interface the way a test team would. It opens every page of the running applications in a browser at the screen widths you choose, has the AI review and use each page, and reviews the UI code and the localization files. It reports what is broken (defects) and what could be better (improvements). + +How to start a test, the inputs, the results and fixing are the same for both tests; see [AI Testing](ai-testing.md). Before starting this test, open the *Devices* list and pick the screen widths to test the pages at: *Phone* (360 px), *Tablet* (768 px), *Laptop* (1280 px) and *Desktop* (1920 px). + +![ui-ux-test](images/ai-testing/ui-ux-test.png) + +## What the Test Checks + +### Runtime + +The test finds the pages of each application by following its links from the start page, in a headless browser. With a test account, it signs in first. Each page is then checked at every chosen width: + +- **Checks without AI**: + - Layout: content that overflows the screen, clipped text, controls covered by other elements, and touch targets that are too small. + - Text: untranslated localization keys, unrendered templates and raw values shown to the user. + - Errors the page writes to the browser console, and requests that fail. + - Links that are broken, and links shown to the signed-in account that it cannot open (an access-denied page, or a redirect to the home page). +- **AI review**: the AI looks at the whole page, from screenshots and an outline of the page (its controls, form fields, images and text), together with the results of the checks above. It reports usability and accessibility problems, and names the [WCAG](https://www.w3.org/WAI/standards-guidelines/wcag/) criterion or the usability heuristic a finding breaks. A second pass compares the pages of each application for consistency. +- **AI interaction**: the AI uses each page like a tester. It works out the scenarios the page needs and runs them: it opens menus, tabs and dialogs, submits each form empty, with invalid values and with valid values, adds, edits and deletes a record, and searches, filters, sorts and pages through lists. Each scenario ends with a statement of what should be true on the screen, which an independent check decides. A failed scenario becomes a defect with the steps to reproduce it; passed scenarios are listed in the coverage as proof. + +The parts every page shares, such as the main menu, the header and the footer, are tested on the first page at each screen width only. Sign-in pages are never shown to the AI. + +### Codebase + +- **Code review**: the AI reviews the UI source code (pages, components, views and their code-behind files) and verifies what it finds. +- **Localization**: the language files (JSON and `.resx`) are compared with each other, without AI, for keys that are missing in a language. + +With *Incremental* on, only the code review is limited to the changed files; the localization comparison always covers every language file. + +## Two Test Accounts + +With a second test account, the applications are checked again as that account. Every page it reaches gets the checks without AI; only the pages the first account did not see get the AI review and interaction. A finding shows *Seen as* with the accounts that saw it, and re-verification signs in with that account. + +Use a second account with fewer permissions to find pages and links that only such a user sees, for example a menu item that leads to an access-denied page. + +The test does not sign out, and it tells the AI the user name of the account it uses (never the password), so that the AI does not edit, lock or delete that account. If the session ends anyway (for example, after a step changed the account), the test signs in again once per application; if that fails, the remaining pages of that application are listed as not tested. + +## Findings + +Each finding is a **defect** (something does not work, or breaks an accessibility rule) or an **improvement** (a suggestion), with a severity; the list shows them under *Defects* and *Suggestions*. A badge says where the finding was found: *From browser* (on a page of a running application), *From browser console* (an error the page wrote to the browser console) or *From code* (in the code review). A finding shows: + +- The page, the element and the screen widths it was seen at, with a screenshot. +- The steps that led to it, for findings found while using the page. +- What should be true once it is fixed. Every AI defect states this, and a second look checks it: confirmed defects are marked *Confirmed*, defects the second look cannot reproduce become unconfirmed suggestions, and the ones it refutes are dropped. +- **Also in**: the same problem is folded into one finding when it appears on several pages or in one shared component, and the other places are listed. +- **Also reported as**: the other titles the same problem was reported under, folded into this finding. +- The code location, when the code review found the same problem. + +After a fix, re-verification checks the page again at a width where the element is visible, and shows the screenshots before and after. A finding is *Incomplete* when it could not be checked again: its application stopped running during the re-verification, the account that saw it is no longer in the inputs or cannot sign in, the page could not be reached, or the AI stopped. + +## Coverage + +*What Was Checked* shows the code the test read and, for each application: + +- the pages checked out of the pages found, and the screen widths; +- whether the test was signed in, and as which account; +- how many pages the AI reviewed and used, and the scenarios it ran with their outcome; +- the pages and links that were skipped or could not be tested, with the reason. + +![ui-ux-test-coverage](images/ai-testing/ui-ux-test-coverage.png) + +## Troubleshooting + +For the problems both tests share, see [AI Testing](ai-testing.md#troubleshooting). + +- **The session ended during the test.** A step of the test may have changed the account (its user name, password, roles or lock state). Check the account in the application before the next test. + +## See Also + +- [AI Testing](ai-testing.md) +- [Security Test](security-test.md) +- [Running the AI Tests from the CLI and on CI](ai-testing-on-ci.md)