Update documentation for testing CodeQL queries in VS Code

This commit is contained in:
Koen Vlaswinkel 2024-02-28 13:47:11 +01:00
Родитель 7be76405f5
Коммит 5226c77abf
5 изменённых файлов: 11 добавлений и 7 удалений

Просмотреть файл

@ -12,27 +12,31 @@ About testing queries in VS Code
To ensure that your CodeQL queries produce the expected results, you can run tests that compare the expected query results with the actual results.
The CodeQL extension automatically prompts VS Code to install the Test Explorer extension as a dependency. The Test Explorer displays any workspace folders with a name ending in ``-tests`` and provides a UI for exploring and running tests in those folders.
The CodeQL extension automatically registers itself with the **Test Explorer** view. The **Test Explorer** view displays all tests found in your current workspace and provides a UI for exploring and running tests in your workspace.
For more information about how CodeQL tests work, see "`Testing custom queries <https://docs.github.com/en/code-security/codeql-cli/using-the-codeql-cli/testing-custom-queries>`__" in the CLI help.
Testing the results of your queries
-----------------------------------
1. Open the Test Explorer view in the sidebar.
1. Open the **Test Explorer** view in the sidebar.
.. image:: ../images/codeql-for-visual-studio-code/open-test-explorer.png
:width: 350
:alt: Open the Test Explorer view
2. To run a specific test, hover over the file or folder name and click the play button. To run all tests in your workspace, click the play button at the top of the view. If a test takes too long to run, you can click the stop button at the top of the view to cancel the test.
3. The icons show whether a test passed or failed. If it failed, right-click the failed test and click **CodeQL: Show Test Output Differences** to display the differences between the expected output and the actual output.
3. The icons show whether a test passed or failed. If it failed, click the test in the **Test Results** panel to display the differences between the expected output and the actual output.
.. image:: ../images/codeql-for-visual-studio-code/show-test-diff.png
.. image:: ../images/codeql-for-visual-studio-code/test-results-panel.png
:width: 800
:alt: View the Test Results panel
4. Compare the results. If you want to update the test with the actual output, right-click the test in the **Test Explorer** view and click **Accept Test Output**.
.. image:: ../images/codeql-for-visual-studio-code/accept-test-output.png
:width: 400
:alt: Show test output differences
4. Compare the results. If you want to update the test with the actual output, click **CodeQL: Accept Test Output**.
:alt: Acccept test output in the Test Explorer view
Monitoring the performance of your queries
------------------------------------------

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 57 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 52 KiB

После

Ширина:  |  Высота:  |  Размер: 32 KiB

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 59 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 111 KiB