From 1ff05cc7f8216eb27ed892f1c0ba1a3ba653486e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Wed, 8 Sep 2021 18:01:06 +0200 Subject: [PATCH] Testing plugins: minor --- .../testing_plugins/test_project_and_testdata_directories.md | 2 ++ topics/basics/testing_plugins/testing_highlighting.md | 2 ++ topics/basics/testing_plugins/testing_plugins.md | 2 +- topics/basics/testing_plugins/writing_tests.md | 4 +++- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/topics/basics/testing_plugins/test_project_and_testdata_directories.md b/topics/basics/testing_plugins/test_project_and_testdata_directories.md index e3c0ae254..6b63857e3 100644 --- a/topics/basics/testing_plugins/test_project_and_testdata_directories.md +++ b/topics/basics/testing_plugins/test_project_and_testdata_directories.md @@ -12,6 +12,8 @@ The test project files exist either in a temporary directory or in an in-memory > If you get an unexpected error after a series of successful runs, **try rerunning the test**, and if that doesn't help, **delete the "system" subdirectory** in your [sandbox directory](ide_development_instance.md#the-development-instance-sandbox-directory). > {type="warning"} + +## Testdata Files In your plugin, you usually store the test data for your tests (such as files on which plugin features will be executed and expected output files) in the testdata directory. This is just a directory under your plugin's content root, but not under a source root. diff --git a/topics/basics/testing_plugins/testing_highlighting.md b/topics/basics/testing_plugins/testing_highlighting.md index 6bc450af6..afd3e8f33 100644 --- a/topics/basics/testing_plugins/testing_highlighting.md +++ b/topics/basics/testing_plugins/testing_highlighting.md @@ -8,6 +8,8 @@ The IntelliJ Platform provides a dedicated utility and markup format for this ta To test the highlighting for the file currently loaded into the in-memory editor, you invoke the `checkHighlighting()` method. The parameters to the method specify which severities should be taken into account when comparing the results with the expected results: errors are always taken into account, whereas warnings, weak warnings, and infos are optional. Alternatively, you can use the `testHighlighting()` method, which loads a testdata file into the in-memory editor and highlights it as a single operation. + +## Inspections If you need to test inspections (rather than generic highlighting provided by a highlighting lexer or annotator), you need to enable inspections that you're testing. This is done by calling `CodeInsightTestFixture.enableInspections()` in the setup method of your test or directly in a test method, before the call to `checkHighlighting()`. diff --git a/topics/basics/testing_plugins/testing_plugins.md b/topics/basics/testing_plugins/testing_plugins.md index 45ba798cb..928ddc257 100644 --- a/topics/basics/testing_plugins/testing_plugins.md +++ b/topics/basics/testing_plugins/testing_plugins.md @@ -27,7 +27,7 @@ We recommend working with real components instead. Please see the dedicated [intellij-ui-test-robot](https://github.com/JetBrains/intellij-ui-test-robot) library. It is fully integrated with Gradle-based setup via `runIdeForUiTests` task. -Please do not use _platform/testGuiFramework_; it is reserved for internal use. +Please do not use platform/testGuiFramework it is reserved for internal use. ## Topics diff --git a/topics/basics/testing_plugins/writing_tests.md b/topics/basics/testing_plugins/writing_tests.md index a7fa3f1f4..65c9fee69 100644 --- a/topics/basics/testing_plugins/writing_tests.md +++ b/topics/basics/testing_plugins/writing_tests.md @@ -14,4 +14,6 @@ However, for many common cases, the framework provides helper methods that can m To compare the results of executing the action with the expected results, you can use the `checkResultByFile()` method. The file with the expected results can also contain [markup](test_project_and_testdata_directories.md#special-markup) to specify the expected caret position or selected text range. -Suppose you're testing an action that modifies multiple files (a project-wide refactoring, for example). In that case, you can compare an entire directory under the test project with the expected output using `PlatformTestUtil.assertDirectoriesEqual()`. \ No newline at end of file +Suppose you're testing an action that modifies multiple files (a project-wide refactoring, for example). In that case, you can compare an entire directory under the test project with the expected output using `PlatformTestUtil.assertDirectoriesEqual()`. + +See [Useful Classes](testing_faq.md#useful-classes) for other common testing functionality. \ No newline at end of file