robolectric

SQLException when using Google Analytics with Robolectric (or “Trying to use SQLite3 in Robolectric”)

大城市里の小女人 提交于 2019-12-11 06:03:50
问题 I'm using robolectric to test an activity that makes use of Google Analytics. Unfortunately, whenever I try to start up the activity I get the following exception android.database.SQLException at com.xtremelabs.robolectric.shadows.ShadowSQLiteDatabase.execSQL(ShadowSQLiteDatabase.java:149) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java) at com.google.android.apps.analytics.PersistentEventStore$DataBaseHelper.onCreate(Unknown Source) at com.xtremelabs.robolectric.shadows

Is there a JVM command-line option to change directory?

只谈情不闲聊 提交于 2019-12-11 05:24:51
问题 In short, I want to know, is there a JVM command-line option to change the starting working directory? If it's important, I'm running jdk1.6.0_24. Background: I am using a tool called Robolectric for Eclipse to test Android applications on the host PC without emulation. Robolectric requires a test project be created, but the tests themselves to be run from the Android project under test. This is accomplished by from Eclipse, setting the run configuration to the project under test in the

Robolectric “WARNING: Unable to find path to Android SDK”

此生再无相见时 提交于 2019-12-11 04:58:42
问题 I am using Robolectric without using maven to build, meaning I am using the Robolectric-with-dependencies Jar. I set it up based on instructions on Robolectric's site, yet I am still getting the WARNING: Unable to find path to Android SDK" error. I found this link (the first answer) which mentions where the problem is coming from but doesn't answer how I can fix this problem. I am new and never posted because I can usually find a solution after browsing for awhile, however I had no luck

Sporadic Robolectric test failures when running inside Docker container

雨燕双飞 提交于 2019-12-11 04:39:57
问题 I am trying to move our Android team onto a Cloud-based CI solution. Other departments within the company have completed this task and we have an Enterprise TeamCity License leveraging Linux EC2s with Docker installed. The entire company uses TC so although CircleCI etc are great options, I am exploring using our own TC solution. To date, it has gone well and using Amazon ECR we have hosted our Docker image that has the required Android SDK, Gradle and Java components installed. Our builds

Custom Gradle Test Task For Android

一世执手 提交于 2019-12-11 04:07:57
问题 Problem I want to create a custom gradle test task to only run JUNIT tests and omit Robolectric tests. I am attempting to achieve this task by creating a new test annotation and omitting any tests that include that new annotation. Error JUNIT packages are not included when I run the the gradle task. error: package android.test.suitebuilder.annotation does not exist import android.test.suitebuilder.annotation.SmallTest; Details New Annotation @Retention(RetentionPolicy.RUNTIME) @Target(

Roboelectric, Maven and the plight of the output folder

限于喜欢 提交于 2019-12-11 04:02:47
问题 Dear awesome community, I have decided to bite the bullet and put together some proper TDD/BDD testing infrastructure for my Android application. I am looking to incorporate Roboelectric in my separate test project in order prevent me from having to launch an emulator for anything remotely Android-y. To see what's what I have imported into my (Eclipse ADT 3.8) environment the RoboElectricSample project found here. But I've hit a snag... everything is working swimmingly compilation wise and I

What do I need enable or install to get the annotation @RunWith

我怕爱的太早我们不能终老 提交于 2019-12-11 03:35:02
问题 I want to create a simple test with Robolectric for Android Apps using Android Studio. Ok, it is my build.gradle on root directory: buildscript { repositories { jcenter() } dependencies { classpath 'com.android.tools.build:gradle:1.3.0' } } allprojects { repositories { jcenter() } } And it is my app build.gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 23 buildToolsVersion "23.0.1" sourceSets { androidTest.setRoot('src/test') } defaultConfig { applicationId

Robolectric 3.0-rc2 Hamcrest-core conflict

人走茶凉 提交于 2019-12-11 03:17:22
问题 Hello I'm trying to get ActionBar Activity UnitTests going and I'm using Robolectirc-RC2 , but when i try to sync my android studio I'm getting the following error/warning. Warning:Conflict with dependency org.hamcrest:hamcrest-core . Resolved versions for app and test app differ. Any idea how to resolve it? repositories { maven { url "https://oss.sonatype.org/content/repositories/snapshots" } mavenLocal() mavenCentral() } dependencies { // Unit testing dependencies unitTestCompile('junit

Gradle Android unit tests that depend on an 'aar' for build tool 0.11.+

不问归期 提交于 2019-12-11 01:06:47
问题 I am using gradle build system to run Roboletric tests however I've encountered the problem that was described here Gradle Android unit tests that depend on an 'aar' but the solution only works for build tool version 0.9.+ and not 0.11.+ as I cannot find the exploded-aar directory. Any ideas? Here's the partial build file configurations { testLocalCompile { extendsFrom compile } } sourceSets { testLocal { java.srcDir file('src/test/java') resources.srcDir file('src/test/res') compileClasspath

Robolectric 1.2 : “WARNING: Unable to find path to Android SDK”

吃可爱长大的小学妹 提交于 2019-12-11 00:52:40
问题 I used Robolectric 1.1 jar-with-dependencies in my project and succeed to get it work, however when I changed the jar to 1.2-SNAPSHOT jar-with-dependencies I get the following warning: WARNING: Unable to find path to Android SDK Both jars downloaded from Sonatype (I didn't use maven). I tried the solution from this question and still get the warning. 回答1: After I followed this tutorial, I had the same issue. This is how I solved it on my mac: 1- Add Android sdk dir to the bash_profile, first