testing_faq.md: minor

This commit is contained in:
Yann Cébron 2022-06-22 17:20:56 +02:00
parent 0abaf6631b
commit 8e8ef3c574

View File

@ -54,7 +54,7 @@ Use `Application.invokeLater(runnable, myProject.getDisposed()`.
### How to avoid test failure when using resources? ### How to avoid test failure when using resources?
In some situations, added or changed files (e.g. XML DTDs provided by a plugin) are not refreshed in [VFS](virtual_file_system.md). In some situations, added or changed files (e.g. XML DTDs provided by a plugin) are not refreshed in [](virtual_file_system.md).
In such cases, simply delete <path>test-system/caches</path> in your [sandbox directory](ide_development_instance.md#the-development-instance-sandbox-directory) and try again. In such cases, simply delete <path>test-system/caches</path> in your [sandbox directory](ide_development_instance.md#the-development-instance-sandbox-directory) and try again.
### How to enable DEBUG/TRACE logging? ### How to enable DEBUG/TRACE logging?
@ -114,11 +114,10 @@ Use [`WaitFor`](upsource:///platform/util/src/com/intellij/util/WaitFor.java).
### How to test a JVM language? ### How to test a JVM language?
Plugins supporting a JVM language may require JDK and language standard library to be set up in a test project, so the classes like `java.lang.String` can be correctly resolved during tests. Plugins supporting a JVM language may require JDK and language standard library to be set up in a test project, so that classes like `java.lang.String` can be correctly resolved during tests.
Tests extending [`LightJavaCodeInsightFixtureTestCase`](upsource:///java/testFramework/src/com/intellij/testFramework/fixtures/LightJavaCodeInsightFixtureTestCase.java) use one of the mock JDKs distributed with the [IntelliJ Community project](https://github.com/JetBrains/intellij-community) sources (notice <path>java/mockJDK-$JAVA_VERSION$</path> directories). Tests extending [`LightJavaCodeInsightFixtureTestCase`](upsource:///java/testFramework/src/com/intellij/testFramework/fixtures/LightJavaCodeInsightFixtureTestCase.java) use one of the mock JDKs distributed with the [IntelliJ Community project](https://github.com/JetBrains/intellij-community) sources (notice <path>java/mockJDK-$JAVA_VERSION$</path> directories).
These JAR files are not available in plugin project dependencies, so the IntelliJ Community sources must be checked out to the machine running the tests, and sources' location must be provided to the test framework. These JAR files are not available in plugin project dependencies, so the IntelliJ Community sources must be checked out to the machine running the tests, and sources' location must be provided to the test framework.
It's done by setting the `idea.home.path` system property to the absolute path of the checked out sources. It's done by setting the `idea.home.path` system property to the absolute path of the checked-out sources in the `test` task configuration:
In projects using Gradle it can be done by providing system property in the `test` task configuration:
<tabs> <tabs>
@ -144,7 +143,7 @@ test {
The default JDK version used by the test framework depends on the target platform version and is the latest supported version. The default JDK version used by the test framework depends on the target platform version and is the latest supported version.
The easiest way to change the JDK version to the custom is overriding the `LightJavaCodeInsightFixtureTestCase.getProjectDescriptor()` method and using one of the project descriptors predefined in `LightJavaCodeInsightFixtureTestCase`. The easiest way to change the JDK version to a custom one is by overriding `LightJavaCodeInsightFixtureTestCase.getProjectDescriptor()` and using one of the predefined project descriptors in `LightJavaCodeInsightFixtureTestCase`.
If a project descriptor requires more customizations, its `getSdk()` method can use one of the [`IdeaTestUtil.getMockJdk*()`](upsource:///java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java) methods. If a project descriptor requires more customizations, its `getSdk()` method can use one of the [`IdeaTestUtil.getMockJdk*()`](upsource:///java/testFramework/src/com/intellij/testFramework/IdeaTestUtil.java) methods.
Sometimes, testing a JVM language requires adding standard or other libraries to a test project. Sometimes, testing a JVM language requires adding standard or other libraries to a test project.