-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #159 from Vodorok/codechecker_stub
Add CodeChecker stub to the test resources
- Loading branch information
Showing
26 changed files
with
769 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
*.swo | ||
|
||
# Eclipse | ||
bin/ | ||
.idea | ||
*.iml | ||
target/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,5 @@ source.. = src/ | |
output.. = bin/ | ||
bin.includes = META-INF/,\ | ||
.,\ | ||
fragment.xml | ||
fragment.xml,\ | ||
resources/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
tests/org.codechecker.eclipse.rcp.it.tests/src/org/codechecker/eclipse/plugin/AllTests.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package org.codechecker.eclipse.plugin; | ||
|
||
import org.codechecker.eclipse.plugin.utils.GuiUtils; | ||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | ||
import org.junit.BeforeClass; | ||
import org.junit.runner.RunWith; | ||
import org.junit.runners.Suite; | ||
import org.junit.runners.Suite.SuiteClasses; | ||
|
||
/** | ||
* Test Suite for running the gui tests. Add your class to the Suite class list. | ||
*/ | ||
@RunWith(Suite.class) | ||
@SuiteClasses({ PluginTest.class, IndicatorTest.class }) | ||
public class AllTests { | ||
|
||
/** | ||
* Never called. | ||
*/ | ||
private AllTests() {} | ||
|
||
/** | ||
* Import cpp project into workspace, and setup SWTBot. | ||
* | ||
*/ | ||
@BeforeClass | ||
public static void setup() { | ||
//clearWs(); | ||
SWTWorkbenchBot bot = new SWTWorkbenchBot(); | ||
GuiUtils.closeWelcomeIfPresent(bot); | ||
GuiUtils.changePerspectiveTo(GuiUtils.C_CPP_PESPECTIVE, bot); | ||
} | ||
} |
95 changes: 95 additions & 0 deletions
95
...rg.codechecker.eclipse.rcp.it.tests/src/org/codechecker/eclipse/plugin/IndicatorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.codechecker.eclipse.plugin; | ||
|
||
import java.nio.file.Path; | ||
|
||
import org.codechecker.eclipse.plugin.utils.GuiUtils; | ||
import org.codechecker.eclipse.rcp.shared.utils.Utils; | ||
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot; | ||
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException; | ||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCLabel; | ||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; | ||
import org.eclipse.swtbot.swt.finder.widgets.SWTBotText; | ||
import org.hamcrest.core.IsNull; | ||
import org.junit.Before; | ||
import org.junit.BeforeClass; | ||
import org.junit.Rule; | ||
import org.junit.Test; | ||
import org.junit.rules.ExpectedException; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
/** | ||
* CodeChecker plugin preferences indicator tests. | ||
*/ | ||
public class IndicatorTest { | ||
|
||
private static final int SHORT_WAIT_TIME = 500; // in milliseconds | ||
|
||
private static final String CODECHECKER = "CodeChecker"; | ||
|
||
private static SWTWorkbenchBot bot; | ||
|
||
@Rule | ||
public ExpectedException thrown = ExpectedException.none(); | ||
|
||
private SWTBotShell preferencesShell; | ||
|
||
/** | ||
* Import cpp project into workspace, and setup SWTBot. | ||
* | ||
*/ | ||
@BeforeClass | ||
public static void setup() { | ||
bot = new SWTWorkbenchBot(); | ||
} | ||
|
||
/** | ||
* Open preferences, CodeChecker page before every test. | ||
*/ | ||
@Before | ||
public void openPreferences() { | ||
preferencesShell = GuiUtils.getPreferencesTab(CODECHECKER, bot); | ||
} | ||
|
||
/** | ||
* Test that with unconfigured CodeChecker, a warning message is displayed. | ||
*/ | ||
@Test | ||
public void testNoCodeCheckerFound() { | ||
SWTBotCLabel label = null; | ||
try { | ||
label = bot.clabel("CodeChecker package directory is invalid"); | ||
} catch (WidgetNotFoundException e) { | ||
System.out.println(e.getMessage()); | ||
} | ||
assertThat("There was no invalid CodeChecker message displayed", label, is(IsNull.notNullValue())); | ||
|
||
preferencesShell.close(); | ||
} | ||
|
||
/** | ||
* Test that with CodeChecker configured, a confirmation message is displayed. | ||
*/ | ||
@Test | ||
public void testCodeCheckerFound() { | ||
Path ccDir = Utils.prepareCodeChecker(); | ||
|
||
SWTBotText text = bot.textWithLabel("CodeChecker package root directory"); | ||
text.setText(ccDir.toString()); | ||
text.setFocus(); | ||
bot.textWithLabel("Python virtualenv root directory (optional)").setFocus(); | ||
|
||
bot.sleep(SHORT_WAIT_TIME); | ||
|
||
SWTBotCLabel label = null; | ||
try { | ||
label = bot.clabel("CodeChecker package directory is valid"); | ||
} catch (WidgetNotFoundException e) { | ||
System.out.println(e.getMessage()); | ||
} | ||
assertThat("There was no valid CodeChecker message displayed", label, is(IsNull.notNullValue())); | ||
|
||
preferencesShell.close(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.