mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 09:17:50 +08:00
testing_faq.md: ProjectActivity
This commit is contained in:
parent
ad71bc2525
commit
932b3711a0
@ -15,6 +15,9 @@ _Early Access Program_ (EAP) releases of upcoming versions are available [here](
|
|||||||
Dumb-aware intentions and quick-fixes
|
Dumb-aware intentions and quick-fixes
|
||||||
: Mark implementations as enabled during indexing, see [](indexing_and_psi_stubs.md#DumbAwareAPI).
|
: Mark implementations as enabled during indexing, see [](indexing_and_psi_stubs.md#DumbAwareAPI).
|
||||||
|
|
||||||
|
Testing: `ProjectActivity`
|
||||||
|
: Executed asynchronously now during tests, see FAQ entry [](testing_faq.md#how-to-handle-projectactivity).
|
||||||
|
|
||||||
## 2024.1
|
## 2024.1
|
||||||
|
|
||||||
### IntelliJ Platform 2024.1
|
### IntelliJ Platform 2024.1
|
||||||
|
@ -78,6 +78,8 @@ Use _ordered_ collections or [`UsefulTestCase.assertUnorderedCollection()`](%gh-
|
|||||||
Code deferring execution (e.g., via `Application.invokeLater()`) might not run during test execution (and possibly fails in production, too).
|
Code deferring execution (e.g., via `Application.invokeLater()`) might not run during test execution (and possibly fails in production, too).
|
||||||
Use `Application.invokeLater(runnable, myProject.getDisposed())`.
|
Use `Application.invokeLater(runnable, myProject.getDisposed())`.
|
||||||
|
|
||||||
|
When targeting 2024.2 or later, see also [](#how-to-handle-projectactivity).
|
||||||
|
|
||||||
### 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 [](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).
|
||||||
@ -217,4 +219,10 @@ PsiTestUtil.addLibrary(model,
|
|||||||
"internal-library", getTestDataPath(), "internal-library-2.0.jar");
|
"internal-library", getTestDataPath(), "internal-library-2.0.jar");
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### How to handle `ProjectActivity`?
|
||||||
|
|
||||||
|
Since 2024.2, [`ProjectActivity`](%gh-ic%/platform/core-api/src/com/intellij/openapi/startup/StartupActivity.kt) are no longer awaited on project open in tests.
|
||||||
|
If tests depend on some job done in `ProjectActivity` (e.g., automatic project re-import), implement a dedicated [event/listener](messaging_infrastructure.md) and wait for it explicitly.
|
||||||
|
As a workaround, use [`StartupActivityTestUtil.waitForProjectActivitiesToComplete()`](%gh-ic-master%/platform/testFramework/src/com/intellij/testFramework/StartupActivityTestUtil.kt).
|
||||||
|
|
||||||
<include from="snippets.md" element-id="missingContent"/>
|
<include from="snippets.md" element-id="missingContent"/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user