Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Top|Writing Tests for Plugins] {span:class=sep}\|{span} {span:class=text}Writing Tests for Plugins{span}{align} {td}
  {td} {align:right}[Next|Parsing Test] {span:class=sep}\|{span} {span:class=text}Parsing Test{span}{align} {td}
 {tr}
{table}
{div}

1. Create a folder for tests

Open the project with the plugin and create a separate folder "tests". Mark the folder as a test source root via the context menu

Wiki Markup
{span:class=shortcut}Mark Directory As{span}
Wiki Markup
{span:class=shortcut}Test Source Root{span}
.

2. Create a folder for test data

In our tests we will use test data, so we need one more folder "testData" to store these files.

3. Run Configuration Parameters

Since some of our tests will use Java files as test data, we need to mock up the project SDK. IntelliJ IDEA does everything automatically when we use special utility class

Wiki Markup
{span:class=id}com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase{span}
.

All we need to do is to point the working directory of the run configuration to the root of IntelliJ IDEA Community Edition sources and enable the following VM options:

Code Block

-ea -Xbootclasspath/p:../out/classes/production/boot -XX:+HeapDumpOnOutOfMemoryError -Xmx512m -XX:MaxPermSize=320m -Didea.system.path=../test-system -Didea.home.path=../ -Didea.config.path=../test-config -Didea.test.group=ALL_EXCLUDE_DEFINED
Note

Keep in mind that we have changed the working directory, so all the paths in tests extended from

Wiki Markup
{span:class=id}com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase{span}
will use relative path to the source root of IntelliJ IDEA Community Edition.

Wiki Markup
{div:class=navigation}
{table:width=100%}
 {tr}
  {td} {align:left}[Top|Writing Tests for Plugins] {span:class=sep}\|{span} {span:class=text}Writing Tests for Plugins{span}{align} {td}
  {td} {align:right}[Next|Parsing Test] {span:class=sep}\|{span} {span:class=text}Parsing Test{span}{align} {td}
 {tr}
{table}
{div}

 

Redirect
locationhttp://www.jetbrains.org/intellij/sdk/docs/tutorials/writing_tests_for_plugins/tests_prerequisites.html