Jakub Chrzanowski 4e802980f2
Webhelp migration (#347)
* [webhelp] Fixes for TXP00152, TXP00002, test build 27 Jul 22:26

* [webhelp] Fixes for Part #4 TXP00010, EXCEPT decimal numbers in section titles

* [webhelp] Fixes for Part #5 TXP00017

* [webhelp] Fixes for Part #4 TXP00010 - removed numbers from page section titles in "Custom Language Support Tutorial" and "Testing a Custom Language Plugin".

* [webhelp] Removed numbers from page section titles in rest of project *.md files.

* [new webhelp] Build #44 changes

* [new webhelp] Maintenance merge from master

* [new webhelp] Add placeholder file for webhelp import.

* [webhelp] Correct redirects for file name changes

* [webhelp] TOC not needed in webhelp

* [format] {:toc} not needed for webhelp

* add {:disable-links} to ensure demo links are not interpreted as real links.

* Put all badges on the same line to simplify composition.

* formatter.md: fix upsource link

* fix some links

* api_changes_list.md: remove note

* migrate to webhelp - initial

* fix GH edit URL

* remove sdkdocs-template setup in VCS config

* remove recently_updated.md

* restore COC/CONTRIBUTING.md

* api_changes_list.md: remove note

* useful_links.md: IPE

Co-authored-by: JohnHake <john.hake@jetbrains.com>
Co-authored-by: Yann Cébron <yann.cebron@jetbrains.com>
2021-01-14 16:07:39 +01:00

3.1 KiB

Plugin tests run in a real, rather than mocked, IntelliJ Platform environment and use real implementations for most application and project components/services.

Loading and initializing all the project components and services for a project to run tests is a relatively expensive operation, and we want to avoid doing it for each test. Dependently on the loading and execution time, we make a difference between heavy tests and light tests available in IntelliJ Platform test framework:

  • Heavy tests create a new project for each test.
  • Light tests reuse a project from the previous test run when possible.

Light and heavy tests use different base classes or fixture classes, as described below.

Because of the performance difference, we recommend plugin developers to write light tests whenever possible.

{type="note"}

Light Tests

The standard way of writing a light test is to extend the following classes:

In 2019.2, LightPlatformCodeInsightFixtureTestCase has been renamed to BasePlatformTestCase and LightCodeInsightFixtureTestCase to LightJavaCodeInsightFixtureTestCase respectively.

{type="note"}

When writing a light test, you can specify the project's requirements that you need to have in your test, such as the module type, the configured SDK, facets, libraries, etc. You do so by extending the LightProjectDescriptor class and returning your project descriptor from getProjectDescriptor(). Before executing each test, the project will be reused if the test case returns the same project descriptor (usually stored in static final field) as the previous one, or recreated if the descriptor is different (equals() = false).

Heavy Tests

If you need to set up a multi-module project for your tests, you must write a heavy test.

{type="note"}

In 2019.3, PlatformTestCase has been renamed to HeavyPlatformTestCase reflecting its "heavy test" characteristics.

{type="note"}

The setup code for a multi-module Java project looks something like that:

final TestFixtureBuilder<IdeaProjectTestFixture> projectBuilder = IdeaTestFixtureFactory.getFixtureFactory().createFixtureBuilder(getName());

// Repeat the following line for each module
final JavaModuleFixtureBuilder moduleFixtureBuilder = projectBuilder.addModule(JavaModuleFixtureBuilder.class);

myFixture = JavaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(projectBuilder.getFixture());