use of com.android.tools.idea.testartifacts.instrumented.AndroidTestRunConfiguration in project android by JetBrains.
the class AndroidProgramRunner method doExecute.
@Override
protected RunContentDescriptor doExecute(@NotNull final RunProfileState state, @NotNull final ExecutionEnvironment env) throws ExecutionException {
boolean showRunContent = env.getRunProfile() instanceof AndroidTestRunConfiguration;
RunnerAndConfigurationSettings runnerAndConfigurationSettings = env.getRunnerAndConfigurationSettings();
if (runnerAndConfigurationSettings != null) {
runnerAndConfigurationSettings.setActivateToolWindowBeforeRun(showRunContent);
}
RunContentDescriptor descriptor = super.doExecute(state, env);
if (descriptor != null) {
ProcessHandler processHandler = descriptor.getProcessHandler();
assert processHandler != null;
RunProfile runProfile = env.getRunProfile();
int uniqueId = runProfile instanceof RunConfigurationBase ? ((RunConfigurationBase) runProfile).getUniqueID() : -1;
AndroidSessionInfo sessionInfo = new AndroidSessionInfo(processHandler, descriptor, uniqueId, env.getExecutor().getId(), InstantRunUtils.isInstantRunEnabled(env));
processHandler.putUserData(AndroidSessionInfo.KEY, sessionInfo);
}
return descriptor;
}
use of com.android.tools.idea.testartifacts.instrumented.AndroidTestRunConfiguration in project android by JetBrains.
the class AndroidTestAndJUnitConfigurationConflictsTest method testConfigurationsAreDifferent.
// See http://b.android.com/215255
public void testConfigurationsAreDifferent() throws Exception {
loadSimpleApplication();
if (SystemInfo.isWindows) {
// Do not run tests on Windows (see http://b.android.com/222904)
return;
}
RunConfiguration androidTestRunConfiguration = createAndroidTestConfigurationFromDirectory(getProject(), "app/src/androidTest/java");
RunConfiguration jUnitConfiguration = createJUnitConfigurationFromDirectory(getProject(), "app/src/test/java");
assertNotNull(jUnitConfiguration);
assertNotNull(androidTestRunConfiguration);
assertNotSame(androidTestRunConfiguration, jUnitConfiguration);
}
use of com.android.tools.idea.testartifacts.instrumented.AndroidTestRunConfiguration in project android by JetBrains.
the class AndroidTestAndJUnitConfigurationConflictsTest method testDoubleClickRedirection.
public void testDoubleClickRedirection() throws Exception {
String commonTestClassName = "google.testartifacts.ExampleTest";
loadProject(TEST_ARTIFACTS_SAME_NAME_CLASSES);
Executor executor = DefaultRunExecutor.getRunExecutorInstance();
RunConfiguration jUnitConfiguration = createJUnitConfigurationFromDirectory(getProject(), "app/src/test/java");
RunConfiguration androidTestRunConfiguration = createAndroidTestConfigurationFromDirectory(getProject(), "app/src/androidTest/java");
assertNotNull(jUnitConfiguration);
assertNotNull(androidTestRunConfiguration);
SMTRunnerConsoleProperties jUnitProperties = ((AndroidJUnitConfiguration) jUnitConfiguration).createTestConsoleProperties(executor);
SMTRunnerConsoleProperties androidTestProperties = new AndroidTestConsoleProperties(androidTestRunConfiguration, executor);
PsiClass[] jUnitClasses = JavaPsiFacade.getInstance(getProject()).findClasses(commonTestClassName, jUnitProperties.getScope());
PsiClass[] aTestClasses = JavaPsiFacade.getInstance(getProject()).findClasses(commonTestClassName, androidTestProperties.getScope());
assertSize(1, jUnitClasses);
assertSize(1, aTestClasses);
assertNotSame(jUnitClasses[0], aTestClasses[0]);
}
use of com.android.tools.idea.testartifacts.instrumented.AndroidTestRunConfiguration in project android by JetBrains.
the class TestConfigurationTesting method createConfigurationFromPsiElement.
@Nullable
private static RunConfiguration createConfigurationFromPsiElement(@NotNull Project project, @NotNull PsiElement psiElement) {
ConfigurationContext context = createContext(project, psiElement);
RunnerAndConfigurationSettings settings = context.getConfiguration();
if (settings == null) {
return null;
}
RunConfiguration configuration = settings.getConfiguration();
if (configuration instanceof AndroidTestRunConfiguration || configuration instanceof AndroidJUnitConfiguration) {
return configuration;
}
return null;
}
Aggregations