Android Unit Testing Framework

Overview

Build Status GitHub release

Robolectric is the industry-standard unit testing framework for Android. With Robolectric, your tests run in a simulated Android environment inside a JVM, without the overhead of an emulator.

Usage

Here's an example of a simple test written using Robolectric:

@RunWith(AndroidJUnit4.class)
public class MyActivityTest {

  @Test
  public void clickingButton_shouldChangeResultsViewText() throws Exception {
    Activity activity = Robolectric.setupActivity(MyActivity.class);

    Button button = (Button) activity.findViewById(R.id.press_me_button);
    TextView results = (TextView) activity.findViewById(R.id.results_text_view);

    button.performClick();
    assertThat(results.getText().toString(), equalTo("Testing Android Rocks!"));
  }
}

For more information about how to install and use Robolectric on your project, extend its functionality, and join the community of contributors, please visit http://robolectric.org.

Install

Starting a New Project

If you'd like to start a new project with Robolectric tests you can refer to deckard (for either maven or gradle) as a guide to setting up both Android and Robolectric on your machine.

build.gradle:

testImplementation "org.robolectric:robolectric:4.5.1"

Building And Contributing

Robolectric is built using Gradle. Both IntelliJ and Android Studio can import the top-level build.gradle file and will automatically generate their project files from it.

Robolectric supports running tests against multiple Android API levels. The work it must do to support each API level is slightly different, so its shadows are built separately for each. To build shadows for every API version, run:

./gradlew clean assemble testClasses --parallel

Using Snapshots

If you would like to live on the bleeding edge, you can try running against a snapshot build. Keep in mind that snapshots represent the most recent changes on master and may contain bugs.

build.gradle:

repositories {
    maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}

dependencies {
    testImplementation "org.robolectric:robolectric:4.6-SNAPSHOT"
}
Comments
  • Robolectric cannot download artifacts - all tests fail

    Robolectric cannot download artifacts - all tests fail

    Description

    [Robolectric] : sdk=28; resources=BINARY Downloading from maven Downloading: org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.pom from repository sonatype at https://oss.sonatype.org/content/groups/public/ Error transferring file: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [WARNING] Unable to get resource 'org.robolectric:android-all:pom:10-robolectric-5803371' from repository sonatype (https://oss.sonatype.org/content/groups/public/): Error transferring file: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) Downloading: org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.pom from repository central at http://repo1.maven.org/maven2 Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.pom [WARNING] Unable to get resource 'org.robolectric:android-all:pom:10-robolectric-5803371' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.pom Downloading: org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar from repository sonatype at https://oss.sonatype.org/content/groups/public/ Error transferring file: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) [WARNING] Unable to get resource 'org.robolectric:android-all:jar:10-robolectric-5803371' from repository sonatype (https://oss.sonatype.org/content/groups/public/): Error transferring file: java.security.NoSuchAlgorithmException: Error constructing implementation (algorithm: Default, provider: SunJSSE, class: sun.security.ssl.SSLContextImpl$DefaultSSLContext) Downloading: org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar from repository central at http://repo1.maven.org/maven2 Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar [WARNING] Unable to get resource 'org.robolectric:android-all:jar:10-robolectric-5803371' from repository central (http://repo1.maven.org/maven2): Error transferring file: Server returned HTTP response code: 501 for URL: http://repo1.maven.org/maven2/org/robolectric/android-all/10-robolectric-5803371/android-all-10-robolectric-5803371.jar

    Unable to resolve artifact: Missing:

    1. org.robolectric:android-all:jar:10-robolectric-5803371

    Steps to Reproduce

    Create a unit test with RobolectricTestRunner

    Robolectric Version

    4.3.1

    opened by wongk 93
  • Redesign database related shadows

    Redesign database related shadows

    Removes a lot of shadows connected with SQLiteDatabase and Cursor, makes Robolectric behaviour much closer to how real Android behaves.

    Instead of a bunch of removed shadows we introduce implementations of SQLiteConntection and CursorWindow based on sqlite4java. This approach let us drop a lot of shadowing code and use real Android classes. However both implemented classes belong to a hidden Android API, which means we should be careful when add some new Android API level to what is supported by Robolectric (especially adding 2.x APIs).

    Worth to mention in release notes:

    • SQLiteDatabase#openDatabase opens on-disk database until its path parameter is set with ":memory:" value;
    • DatabaseConfig annotation is gone
    • some methods from the shadowed db are gone:
      • in SQLiteDatabase: setThrowOnInsert, hasOpenCursors, getQuerySql, getConnection

    History notes

    Some time ago I faced with some inconsistencies in shadows of cursors and started digging first removing shadow of matrix cursor and then... This request is not a merge candidate right now but rather a proposal.

    I'm playing with removing cursor shadows completely and shadowing only SQLiteConnection and CursorWindow instead (ShadowSQLiteConnection, ShadowCursorWindow).

    I've already made some progress in this direction and have some of database related tests passing. And now I'd like someone from the main team to take a look at the approach and start discussion. Perhaps it's not the way worth to be implemented.

    Currently I have 2 main points that do not allow me to sleep sweetly:

    So please take a look and tell what you think: should I go on or would I rather stop, delete this branch, and forget :).

    opened by roman-mazur 60
  • Apple Silicon support

    Apple Silicon support

    Description

    When perform robolectric test on Apple silicon, following error is raised

        Caused by: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: /private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: dlopen(/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib, 1): no suitable image found.  Did find:
        	/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: no matching architecture in universal wrapper
        	/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: no matching architecture in universal wrapper
        	at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
        	at com.almworks.sqlite4java.SQLite.getSQLiteVersion(SQLite.java:114)
        	at org.robolectric.shadows.util.SQLiteLibraryLoader.loadFromDirectory(SQLiteLibraryLoader.java:90)
        	at org.robolectric.shadows.util.SQLiteLibraryLoader.doLoad(SQLiteLibraryLoader.java:55)
        	at org.robolectric.shadows.util.SQLiteLibraryLoader.load(SQLiteLibraryLoader.java:39)
        	at org.robolectric.shadows.ShadowSQLiteConnection.nativeOpen(ShadowSQLiteConnection.java:73)
        	at org.robolectric.shadows.ShadowSQLiteConnection.nativeOpen(ShadowSQLiteConnection.java:80)
        	at android.database.sqlite.SQLiteConnection.nativeOpen(SQLiteConnection.java)
    
    ....
        Caused by: java.lang.UnsatisfiedLinkError: /private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: dlopen(/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib, 1): no suitable image found.  Did find:
        	/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: no matching architecture in universal wrapper
        	/private/var/folders/xp/t20n_5q54v9d7dz1rt9bk9k40000gp/T/1616114208715-0/libsqlite4java.dylib: no matching architecture in universal wrapper
        	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
        	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2442)
        	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2498)
        	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2694)
        	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2627)
        	at java.base/java.lang.Runtime.load0(Runtime.java:768)
        	at java.base/java.lang.System.load(System.java:1837)
        	at com.almworks.sqlite4java.Internal.tryLoadFromPath(Internal.java:340)
        	at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:110)
        	at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95)
        	... 36 more
    
    

    Robolectric & Android Version

    JVM : Jetbrains Runtime from Intellij IDEA 2020.3.2 ( OpenJDK 64-Bit Server VM JBR-11.0.9.1.11-1145.77-jcef (build 11.0.9.1+11-b1145.77, mixed mode) ) Robolectric : 4.5.1 Android Compile SDK : 30

    opened by ganadist 59
  • Robolectric crashes with new VectorDrawableCompat

    Robolectric crashes with new VectorDrawableCompat

    When AppCompat tries to create a drawable from a given vector, Robolectric tests fail with the following exception:

    Caused by: org.xmlpull.v1.XmlPullParserException: XML file build/intermediates/res/merged/world/debug/drawable-anydpi-v21/abc_ic_ab_back_material.xml line #-1 (sorry, not yet implemented): invalid drawable tag vector
        at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:897)
        at android.graphics.drawable.Drawable.createFromXml(Drawable.java:837)
        at android.content.res.Resources.loadDrawable(Resources.java:2087)
        ... 57 more
    

    Happens regardless of whether or not support vectors are enabled as specified here: http://android-developers.blogspot.com/2016/02/android-support-library-232.html

    // Gradle Plugin 2.0+  
     android {  
       defaultConfig {  
         vectorDrawables.useSupportLibrary = true  
        }  
     }  
    

    Relevant exception higher up:

    Caused by: android.content.res.Resources$NotFoundException: File build/intermediates/res/merged/world/debug/drawable/abc_ic_ab_back_material.xml from drawable resource ID #0x7f020016
        at android.content.res.Resources.loadDrawable(Resources.java:2091)
        at org.robolectric.util.ReflectionHelpers.callInstanceMethod(ReflectionHelpers.java:195)
        at org.robolectric.internal.Shadow.directlyOn(Shadow.java:57)
        at org.robolectric.shadows.ShadowResources.loadDrawable(ShadowResources.java:518)
        at android.content.res.Resources.loadDrawable(Resources.java)
        at android.content.res.Resources.getDrawable(Resources.java:695)
        at android.support.v4.content.ContextCompat.getDrawable(ContextCompat.java:323)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:180)
        at android.support.v7.widget.AppCompatDrawableManager.getDrawable(AppCompatDrawableManager.java:173)
        at android.support.v7.widget.TintTypedArray.getDrawable(TintTypedArray.java:60)
        at android.support.v7.widget.Toolbar.__constructor__(Toolbar.java:254)
        at android.support.v7.widget.Toolbar.<init>(Toolbar.java)
        at android.view.LayoutInflater.createView(LayoutInflater.java:594)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:696)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:755)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:758)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:492)
        at uk.co.chrisjenx.calligraphy.CalligraphyLayoutInflater.inflate(CalligraphyLayoutInflater.java:60)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:397)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
        at android.support.v7.app.AppCompatDelegateImplV7.createSubDecor(AppCompatDelegateImplV7.java:379)
        at android.support.v7.app.AppCompatDelegateImplV7.ensureSubDecor(AppCompatDelegateImplV7.java:300)
        at android.support.v7.app.AppCompatDelegateImplV7.initWindowDecorActionBar(AppCompatDelegateImplV7.java:169)
        at android.support.v7.app.AppCompatDelegateImplBase.getSupportActionBar(AppCompatDelegateImplBase.java:88)
        at android.support.v7.app.AppCompatActivity.getSupportActionBar(AppCompatActivity.java:99)
    

    AppCompat does some working around for vector drawables via its ResourcesWrapper and ContextWrapper classes, I think the solution for this is that Robolectric needs to work with this. See the bottom of https://medium.com/@chrisbanes/appcompat-v23-2-age-of-the-vectors-91cbafa87c88#.hq4q2olt3

    opened by ZacSweers 57
  • OutOfMemoryError PermGen space and hanging builds

    OutOfMemoryError PermGen space and hanging builds

    I have a suite consisting of almost 2000 tests that work with Robolectric 2.4. I have started updating the suite to work with 3.0-rc2 but I can only run about ~700 tests before they fail with an OutOfMemoryError or hang. It seems that once I reach a certain size, the tests will fail. For example I will run X tests successfully, then I will add a few more test classes and the suite will fail. If I leave the newly added classes and remove some of the classes known to be successful, I can get a successful build again.

    The conversion for the majority of tests was just a matter of using the RobolectricGradleTestRunner, adding @Config line and fixing references to Robolectric classes that were moved. Continuing to use RobolectricTestRunner instead of RobolectricGradleTestRunner fails in similar ways.

    The following jvmargs are set in the gradle.properties file. Increasing the memory options does not help: org.gradle.jvmargs=-Xmx1024m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

    There are a few failure scenarios I have seen:

    • Test execution hang with no output

    • "OutOfMemoryError: PermGen space" error followed by gradle stacktrace

    • One of the above or just test failure followed by a different class loading error each time: [ERROR] couldn't load roboguice.activity.RoboActivity in org.robolectric.internal.bytecode.InstrumentingClassLoader@4d0ed336

      [ERROR] couldn't load android.content.Context in org.robolectric.internal.bytecode.InstrumentingClassLoader@3e1cbf2e

      [ERROR] couldn't load org.bouncycastle.jce.provider.BouncyCastleProvider in org.robolectric.internal.bytecode.InstrumentingClassLoader@6243e098

    In all cases, just removing a few test classes will allow the tests to succeed.

    Given I have a suite of testcases that work with 2.4 and work with 3.0-rc2 in batches of ~700 tests, It seems to point to something in the 3.0 changes that are causing these OOM errors.

    defect 
    opened by cameocoder 49
  • Still get java.lang.RuntimeException: Stub! in Robolectric 2.2

    Still get java.lang.RuntimeException: Stub! in Robolectric 2.2

    I have a fairly complicated app that I'm trying to use with Robolectric 2.2. I've added the robolectric jar to the top of my classpath in IntelliJ but I still get:

    Caused by: java.lang.RuntimeException: Stub! at com.amazon.device.messaging.ADMMessageReceiver.(Unknown Source) at com.my.android.push.adm.ADMPushMessageReceiver.(ADMPushMessageReceiver.java:15) ... 31 more

    My classpath is: robolectric junit-4.10 app dependencies

    I've also tried: junit-4.10 robolectric app dependencies

    I use this ivv.xml to retreive my dependencies:

    <ivy-module version="2.0">
        <info organisation="com.my.android" module="unit-test" />
        <configurations>
            <conf name="binaries" description="binary jars" />
        </configurations>
        <dependencies>
            <dependency org="org.robolectric" name="robolectric" rev="2.2" conf="binaries->default" />
            <dependency org="jmock" name="jmock" rev="1.2.0" conf="binaries->default" />
        </dependencies>
    </ivy-module>
    

    and that brings down all of these jars which I add to my class path:

    ant-launcher.jar        commons-codec.jar       maven-artifact-manager.jar  nekohtml.jar            wagon-file.jar
    ant.jar             commons-logging.jar     maven-artifact.jar      objenesis.jar           wagon-http-lightweight.jar
    asm-analysis.jar        fest-reflect.jar        maven-error-diagnostics.jar plexus-container-default.jar    wagon-http-shared.jar
    asm-commons.jar         fest-util.jar           maven-model.jar         plexus-interpolation.jar    wagon-provider-api.jar
    asm-tree.jar            httpclient.jar          maven-plugin-registry.jar   plexus-utils.jar        xercesMinimal.jar
    asm-util.jar            httpcore.jar            maven-profile.jar       robolectric.jar
    asm.jar             jmock.jar           maven-project.jar       sqlite-jdbc.jar
    backport-util-concurrent.jar    junit.jar           maven-repository-metadata.jar   support-v4.jar
    classworlds.jar         maven-ant-tasks.jar     maven-settings.jar      vtd-xml.jar
    

    I'm using Robolectric 2.2 with the latest EAP IntelliJ. I noted that IntelliJ EAP was using the project root as a default for the working dir and have fixed this to use the module dir. Prior to that I could run my test without getting this error but it was having trouble finding resources. Please help!

    opened by cliff76 49
  • Supporting nativeruntime building for Windows

    Supporting nativeruntime building for Windows

    This issue is used to track Windows building support for nativeruntime.

    Previous discussions are here: https://github.com/robolectric/robolectric/issues/6311#issuecomment-942452585 https://github.com/robolectric/robolectric/issues/6311#issuecomment-942479536 https://github.com/robolectric/robolectric/issues/6311#issuecomment-942575846 https://github.com/robolectric/robolectric/issues/6311#issuecomment-950137940 https://github.com/robolectric/robolectric/issues/6311#issuecomment-950179187 https://github.com/robolectric/robolectric/issues/6311#issuecomment-950181749

    opened by utzcoz 48
  • FileNotFoundException when opening AssetFileDescriptor

    FileNotFoundException when opening AssetFileDescriptor

    Description

    One of the functions in my unit tests wants to open an AssetFileDescriptor. I tried to use RuntimeEnvironment.systemContext and ApplicationProvider.getApplicationContext() interchangeably.

    1. Using RuntimeEnvironment.systemContext gives me
      java.io.FileNotFoundException: birds_or_cats_or_whatever
          at org.robolectric.shadows.ShadowArscAssetManager9.nativeOpenAssetFd(ShadowArscAssetManager9.java:722)
          at android.content.res.AssetManager.nativeOpenAssetFd(AssetManager.java)
          at android.content.res.AssetManager.openFd(AssetManager.java:768)
      
    2. Using ApplicationProvider.getApplicationContext() gives me
      java.io.FileNotFoundException: This file can not be opened as a file descriptor; it is probably compressed
          at org.robolectric.shadows.ShadowArscAssetManager9.ReturnParcelFileDescriptor(ShadowArscAssetManager9.java:423)
          at org.robolectric.shadows.ShadowArscAssetManager9.nativeOpenAssetFd(ShadowArscAssetManager9.java:724)
          at android.content.res.AssetManager.nativeOpenAssetFd(AssetManager.java)
          at android.content.res.AssetManager.openFd(AssetManager.java:768)
      

    The latter error was more descriptive. Following the message from the stack-trace, I tried to disable the aapt resource compression for all resources using the following Gradle config but with no luck. Regardless of the compression settings, I am able to open an AssetInputStream to a resource with ApplicationProvider.getApplicationContext() context but unable to open a file descriptor to the same resource.

    android {
      aaptOptions {
        noCompress ''
      }
    }
    

    Steps to Reproduce

    Already covered

    Robolectric & Android Version

    • Android SDK 29
    • Robolectric 4.3.1
    • Tests are targeted for SDK 21 and 28

    Link to a public git repo demonstrating the problem:

    You can play around with this test. It highlights the problem. https://github.com/ashutoshgngwr/noice/blob/refactor/sound-manager/app/src/test/java/com/github/ashutoshgngwr/noice/sound/PlaybackTest.kt

    Links to https://github.com/robolectric/robolectric/issues/4091

    opened by ashutoshgngwr 48
  • ViewPager IllegalStateException

    ViewPager IllegalStateException

    I have a problem similar to https://github.com/robolectric/robolectric/issues/1326

    The stacktrace is the same, but the code is not. In my case I start a Fragment using FragmentTestUtil. That Fragment calls ViewPager.setCurrentItem when it has been started, so I can't use this fix (https://github.com/robolectric/robolectric/issues/1326#issuecomment-68306634).

    opened by eygraber 48
  • Handler doesn't execute Runnables when using Robolectric 3

    Handler doesn't execute Runnables when using Robolectric 3

    Handler for custom background thread (with looper) doesn't execute Runnables when used from inside test class. Looper created successfully for the thread.

    In test class, I'm waiting for async result via CountDownLatch.

    How can I fix that?

    Test class:

    @Config(constants = BuildConfig.class, sdk = 16)
    @RunWith(RobolectricGradleTestRunner.class)
    public class DispatchQueueTest
    {
        @Test
        public void testDispatch() throws InterruptedException
        {
            DispatchQueue queue = new DispatchQueue();
            final CountDownLatch latch = new CountDownLatch(1);
            queue.dispatch(new Runnable()
            {
                @Override
                public void run()
                {
                    latch.countDown();
                }
            });
    
            Assert.assertTrue("queue dispatch timeout", latch.await(1000, TimeUnit.MILLISECONDS));
            queue.close();
        } // testDispatch
    }
    

    Tested class:

    public class DispatchQueue implements Executor
    {
        public static DispatchQueue main = new DispatchQueue(new Handler(Looper.getMainLooper()));
    
        private Handler handler;
    
        public DispatchQueue(Handler handler)
        {
            this.handler = handler;
        }
    
        public DispatchQueue()
        {
            final CountDownLatch latch = new CountDownLatch(1);
    
            Thread thread = new Thread(new Runnable()
            {
                @Override
                public void run()
                {
                    Looper.prepare();
                    ;
    
                    DispatchQueue.this.handler = new Handler();
                    latch.countDown();
    
                    Looper.loop();
    
                    //Logger.debug("DispatchQueue finished");
                }
            });
    
            thread.setDaemon(true);
            thread.start();
    
            try
            {
                latch.await(5, TimeUnit.SECONDS);
            }
            catch(InterruptedException ex)
            {
                Logger.error("Dispatch thread start failed.");
                return;
            }
        } // DispatchQueue()
    
        public void close()
        {
            this.handler.getLooper().quit();
        }
    
        public Handler getHandler()
        {
            return handler;
        }
    
        public void execute(Runnable runnable)
        {
            dispatch(runnable);
        }
    
        public boolean dispatch(Runnable runnable)
        {
            if(handler == null)
                return false;
    
            return handler.post(runnable);
        } // dispatch
    
        public Runnable dispatchAfter(long delayMs, Runnable runnable)
        {
            if(handler == null)
                return runnable;
    
            handler.postDelayed(runnable, delayMs);
    
            return runnable;
        }
    
        public void cancel(Runnable runnable)
        {
            if(handler == null)
                return;
    
            if(runnable == null)
                return;
    
            handler.removeCallbacks(runnable);
        }
    } // DispatchQueue
    
    opened by virl 47
  • Init color array when decode for bitmap

    Init color array when decode for bitmap

    It will try to initialize ShadowBitmap.color when decode those source to try to fix https://github.com/robolectric/robolectric/issues/3743.

    It supports decodeByteArray, decodeFile, decodeResource, decodeStream, and decodeResourceStream.

    cla: yes 
    opened by utzcoz 42
  • Add example for custom shadow with Kotlin

    Add example for custom shadow with Kotlin

    Close: https://github.com/robolectric/robolectric/issues/3976.

    The new module will be used for other Kotlin related compatibility integration tests too.

    opened by utzcoz 0
  • ClickableText offset value posted by compose rule test node click is different (end position) in 4.9.1 (and 4.9.2) than in 4.9 (start position)

    ClickableText offset value posted by compose rule test node click is different (end position) in 4.9.1 (and 4.9.2) than in 4.9 (start position)

    Description

    I have a test for some code in Jetpack compose, including a "androidx.compose.foundation.text.ClickableText" My ClickableText has its text attribute set to an AnnotatedString which consists of several parts. My test finds the relevant text (matches the first part of this AnnotatedString) and clicks on it. So I would expect the offset to be 0 (which it is in Robolectric 4.9). But in 4.9.1 / 4.9.2 the offset is instead "82", which happens to be the full length of the annotated string, so basically the end position of the string.

    Steps to Reproduce

    Prod code:

    @Composable
    fun TestComposable(onLinkClicked: (AnnotatedString.Range<String>) -> Unit) {
        LinkText(
            modifier = Modifier,
            linkTextData = listOf(
                LinkTextData(
                    tag = "not null",
                    annotation = "not null",
                    text = "License agreement",
                    onClick = onLinkClicked,
                ),
                LinkTextData(". "),
                LinkTextData(
                    text = "Please review it and give your consent by checking the checkbox",
                )
            )
        )
    }
    
    @Composable
    private fun LinkText(modifier: Modifier = Modifier, linkTextData: List<LinkTextData>) {
        val annotatedString = createAnnotatedString(linkTextData)
        ClickableText(
            modifier = modifier,
            text = annotatedString,
            onClick = { offset ->
                   if (offset != 0) { 
                       throw IllegalStateException("Bug!")
                   }
                }
            },
        )
    }
    
    data class LinkTextData(
        val text: String,
        val tag: String? = null,
        val annotation: String? = null,
        val onClick: ((str: AnnotatedString.Range<String>) -> Unit)? = null,
    )
    
    // This is a hack to be able to make part of a string clickable, https://stackoverflow.com/a/69549929/1859486
    @Composable
    private fun createAnnotatedString(data: List<LinkTextData>): AnnotatedString {
        return buildAnnotatedString {
            data.forEach { linkTextData ->
                if (linkTextData.tag != null && linkTextData.annotation != null) {
                    pushStringAnnotation(
                        tag = linkTextData.tag,
                        annotation = linkTextData.annotation,
                    )
                    withStyle(
                        style = SpanStyle(
                            color = MaterialTheme.colorScheme.primary,
                            textDecoration = TextDecoration.Underline,
                        ),
                    ) {
                        append(linkTextData.text)
                    }
                    pop()
                } else {
                    append(linkTextData.text)
                }
            }
        }
    }
    

    Test code:

    @Config(sdk = [Build.VERSION_CODES.S])
    @RunWith(AndroidJUnit4::class)
    @LooperMode(LooperMode.Mode.PAUSED)
    class TestClass {
    
       @get:Rule
        val composeTestRule = createComposeRule()
    
        @Test
        fun reproducible() {
            var onLinkClickedClicked = false
            composeTestRule.setContent {
                TestComposable(onLinkClicked = { onLinkClickedClicked = true })
            }
    
            composeTestRule.onAllNodesWithText("License agreement", substring = true)
                .assertCountEquals(1)
            composeTestRule.onNodeWithText("License agreement", substring = true)
                .performClick()
    
            assertTrue(onLinkClickedClicked)
        }
    
    }
    

    Robolectric & Android Version

    • Robolectric 4.9.1 / 4.9.2

    libs.versions.toml:

    [versions]
    androidx-compose-compiler = "1.3.2"
    androidx-compose-material3 = "1.0.1"
    androidx-compose-ui = "1.3.2"
    androidx-compose-runtime = "1.3.2"
    
    [libraries]
    androidxComposeCompiler = { module = "androidx.compose.compiler:compiler", version.ref = "androidx-compose-compiler" }
    androidxComposeRuntimeLivedata = { module = "androidx.compose.runtime:runtime-livedata", version.ref = "androidx-compose-runtime" }
    androidxComposeMaterialMaterial3 = { module = "androidx.compose.material3:material3", version.ref = "androidx-compose-material3" }
    androidxComposeUiTest = { module = "androidx.compose.ui:ui-test-junit4", version.ref = "androidx-compose-ui" }
    androidxComposeUiTooling = { module = "androidx.compose.ui:ui-tooling", version.ref = "androidx-compose-ui" }
    androidxComposeTestManifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "androidx-compose-ui" }
    
    

    Link to a public git repo demonstrating the problem:

    opened by alwa 14
  • RoboCookieManager supports override cookie has the same key

    RoboCookieManager supports override cookie has the same key

    See https://cs.android.com/android/platform/superproject/+/master:frameworks/base/core/java/android/webkit/CookieManager.java;l=120?q=setCookie%5C(&ss=android.

    The current implementation of RoboCookieManager only supports the host name and the key name of the Cookie. But it doesn't support path of the cookie. So this CL only compares the host name and the key name for the Cookie.

    Fixes: https://github.com/robolectric/robolectric/issues/3464.

    opened by utzcoz 0
  • Unit tests 100x slower with Roboelectric (50ms to 3s)

    Unit tests 100x slower with Roboelectric (50ms to 3s)

    Description

    We have have many unit tests that depend on small parts of the SDK. The most common one being Uri.parse. We are currently static mocking those methods but it would be more robust to use Roboelectric.

    Unfortunately our testing has shown that the default Roboelectric test runner adds up to 3s of startup time to our tests.

    Most of our unit tests run in ~50ms without Roboelectric, but around 3s with it. Which makes it frustrating for quick test iterations.

    Is there an alternative test runner that would initialize less or do it lazily at least? (aka only pay for what you use). A good target would be 200ms startup time for tests only using Uri.parse or other static methods not using Activity or Context.

    Steps to Reproduce

    Run a test consisting of AssertNull(Uri.parse("")). Observe that it passes in 5ms. Run, with Roboelectric AssertNotNull(Uri.parse("")). Observe that it passes in 3s.

    Robolectric & Android Version

    Roboelectric 4.9, junit 4.13, android 33

    Link to a public git repo demonstrating the problem:

    Happy to create one if needed, but the default empty activity project in Android studio is enough to reproduce.

    opened by krocard 4
  • Updated an access modifier of an object decleration in Sandbox.java

    Updated an access modifier of an object decleration in Sandbox.java

    Overview

    I spotted a todo comment that specified to not have the access specifier of the object classHandler (declaration) in line 23 as public. Therefore I resolved it by changing the access modifier to private. I hope this is valid (I'm new), thank you!

    Proposed Changes

    - public ClassHandler classHandler; // todo not public
    + private ClassHandler classHandler;
    
    opened by sandeshShahapur 3
Releases(robolectric-4.9.2)
  • robolectric-4.9.2(Dec 27, 2022)

    Robolectric 4.9.2 is a minor release that primarily fixes https://github.com/robolectric/robolectric/issues/7879, which was an issue using native SQLite with older Linux machines.

    It also includes:

    • A fix for ShadowSpeechRecognizer in SDK <= 28 (0df34bf0cb5423afb64d7f4340c95e741ba26aa6, thanks @utzcoz)
    • Some fixes for instrumenting Jacoco-instrumented classes (7534d628fd69caab623b1ed31bf2096fd3c914db and 4e6047d88f7e8d9c83b13842a0d584d7eccd068a). Note there are still known issues with running Robolectric instrumentation on Jacoco-instrumented classes which should hopefully be fixed in 4.10.

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.9.1...robolectric-4.9.2

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.9.1(Dec 19, 2022)

    Robolectric 4.9.1 is a minor release that fixes several issues:

    • Fixes sdk levels in ShadowAppOpsManager (50e2cfa4294c5dcfb7127f51f355a366f947c89a, thanks @paulsowden)
    • Fixes an issue loading the native runtime on concurrent threads (0b4e996c27b85f05f7f52f75bc9d5109be7ef767)
    • Fixes some uses of LineBreaker and StaticLayout in Compose (ed2d7d3d600972090de29bcf9ad37d65a4d7ef47, thanks @samliu000)
    • Added proxy settings for fetching artifacts (bed3ca5a4ea314f730a9d58331b0099ca4c0abeb, thanks @sebastienrussell)
    • Avoid referring to Android S TelephonyCallback (d43ae9ad7b74512dbf89518247769ca5c2c4128c, thanks @styluo)
    • Fix data race in ShadowPausedLooper (cb231c8c133b6f2ed4e46148d1a4f551fdd52dd2)
    • Add shadow for LocaleManager#getSystemLocales (24d49f41227c35e0e3ce8564e404a39481c312e6, thanks @utzcoz)
    • Use uninterruptibly acquire for ResTable's lock (a221f6829110fd40b124527bde5317123f1737d9, thanks @utzcoz)
    • Update androidx.test dependencies to latest stable releases (0bdf89b884ac7c50c0e4d7a2b2fff848d795bf16, thanks @utzcoz)
    • Support zip files where EOCD's offset to central dir is -1 (9b36bc6b013db9e9eef5c509b2471cc8b0a7395a)

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.9...robolectric-4.9.1

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.9(Sep 30, 2022)

    Robolectric 4.9 adds support for Android T (API level 33).

    This release removes shadows supportv4 module fully.

    It also installs the Conscrypt as the primary Security provider. See http://robolectric.org/blog/2022/09/06/Umesh-GSoC-on-ConscryptMode/ for details.

    4.9 also turns on NATIVE sqlite mode by default for Mac and Linux. Windows will continue to use the LEGACY SQLite mode.

    What's Changed

    • Enable integration_tests:sparsearray tests by @utzcoz in https://github.com/robolectric/robolectric/pull/7006
    • Enable CI when PRs are made to the 'google' branch by @hoisie in https://github.com/robolectric/robolectric/pull/7164
    • Add triggerOnReadyForSpeech() to ShadowSpeechRecognizer. https://github.com/robolectric/robolectric/pull/7163
    • Bump gradle-versions-plugin to 0.42.0 by @utzcoz in https://github.com/robolectric/robolectric/pull/6970
    • Clean up tests.yml by @utzcoz in https://github.com/robolectric/robolectric/pull/7161
    • Block UiController#loopMainThreadUntilIdle on registered idling resources being idle. https://github.com/robolectric/robolectric/pull/7148
    • Return non-zero pointer from nCreateTextureLayer https://github.com/robolectric/robolectric/pull/7166
    • Correctly register all idling resources https://github.com/robolectric/robolectric/pull/7167
    • Update README.md to declare Robolectric supports SDK 32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7169
    • Indicate windows are visible by default (flag enabled) https://github.com/robolectric/robolectric/pull/7179
    • Add documentation to run tests on Emulator by @utzcoz in https://github.com/robolectric/robolectric/pull/7162
    • Restore accidentally deleted link to building Robolectric https://github.com/robolectric/robolectric/pull/7183
    • Ensure getNetworkCountryIso & getSimCountryIso return lowercase only, to match the actual APIs. https://github.com/robolectric/robolectric/pull/7184
    • Update RoboLocationRequest equals() and toString(). https://github.com/robolectric/robolectric/pull/7186
    • Centralize the Injector logic to load the native runtime https://github.com/robolectric/robolectric/pull/7198
    • Fixed PFD testGetFd_canRead test failed on macOS. by @ZSmallX in https://github.com/robolectric/robolectric/pull/7202
    • Optimize CI a bit by @Goooler in https://github.com/robolectric/robolectric/pull/7195
    • Clean up ctesque by @utzcoz in https://github.com/robolectric/robolectric/pull/7145
    • Clean up ShadowDefaultRequestDirectorTest.java by @utzcoz in https://github.com/robolectric/robolectric/pull/7208
    • Bump Gradle to 7.4.2 by @utzcoz in https://github.com/robolectric/robolectric/pull/7207
    • Remove unused Exception from example in README.md by @utzcoz in https://github.com/robolectric/robolectric/pull/7206
    • Error prone and google format fix annotation module by @hellosagar in https://github.com/robolectric/robolectric/pull/7154
    • Update CI to use JDK 11.0.14 by @hoisie in https://github.com/robolectric/robolectric/pull/7213
    • Support Canvas#drawRect with RectF by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7210
    • Remove maxSdk restrition for ShadowBiometricManager#canAuthenticate implementation by @utzcoz in https://github.com/robolectric/robolectric/pull/7211
    • Switch to run tests on Emulator with SDK 29,32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7170
    • Support JDK 1.8 in ShadowWrangler invokespecial logic https://github.com/robolectric/robolectric/pull/7219
    • build: bump errorprone plugin version from 1.3.0 to 2.0.2 by @hellosagar in https://github.com/robolectric/robolectric/pull/7218
    • Bring integration_tests to API 32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7217
    • Add method expectLogMessagePatternWithThrowableMatcher to ExpectedLogMessagesRule so that users can check for a Throwable, as well as a log message pattern. https://github.com/robolectric/robolectric/pull/7221
    • Add javadoc for DefaultShadowPicker by @hoisie in https://github.com/robolectric/robolectric/pull/7222
    • Add SdkSuppress to some tests in ThemeTest and MotionEventTest by @hoisie in https://github.com/robolectric/robolectric/pull/7227
    • Removed targetSdk from AndroidManifest.xml by @Umesh-01 in https://github.com/robolectric/robolectric/pull/7232
    • Add getCurrentSyncs() in ShadowContentResolver by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7225
    • Make deep copy of mPointerProperties for NativeInput#copyFrom by @utzcoz in https://github.com/robolectric/robolectric/pull/7251
    • Remove empty ShadowTextPaint by @utzcoz in https://github.com/robolectric/robolectric/pull/7250
    • Migrate compileSdkVersion to compileSdk by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7253
    • Ensure ShadowActivity can work with project targetSdk less than S by @utzcoz in https://github.com/robolectric/robolectric/pull/7254
    • Deprecate is___Intent methods of ShadowPendingIntent https://github.com/robolectric/robolectric/pull/7276
    • Invoke the real View.draw(Canvas) from ShadowView.draw(Canvas) https://github.com/robolectric/robolectric/pull/7279
    • Add looper mode assertions to ShadowChoreographer methods https://github.com/robolectric/robolectric/pull/7278
    • Inline ShadowBitmapFactory#decodeByteArray by @utzcoz in https://github.com/robolectric/robolectric/pull/7285
    • Skip to generate shadowOf for ShadowBackdropFrameRenderer by @utzcoz in https://github.com/robolectric/robolectric/pull/7284
    • Add voice interactions support to ShadowVoiceInteractor https://github.com/robolectric/robolectric/pull/7299
    • Bump guava to 31.1-jre by @utzcoz in https://github.com/robolectric/robolectric/pull/7288
    • Improve the friendliness of code names for Util.java by @utzcoz in https://github.com/robolectric/robolectric/pull/7296
    • Add shadows for createOnDeviceSpeechRecognizer and isOnDeviceRecognitionAvailable. https://github.com/robolectric/robolectric/pull/7303
    • Deprecated Util#intArrayToList by @utzcoz in https://github.com/robolectric/robolectric/pull/7307
    • Add Shadow implementation for ShadowApplicationPackageManager.getGroupOfPlatformPermission https://github.com/robolectric/robolectric/pull/7313
    • Add support for changing NetworkSpecifier in NetworkCapabilities by @bacecek in https://github.com/robolectric/robolectric/pull/7298
    • Migrate testRuntime to testRuntimeOnly by @utzcoz in https://github.com/robolectric/robolectric/pull/7314
    • Add several new methods to ShadowPaint by @bacecek in https://github.com/robolectric/robolectric/pull/7309
    • Fix non-determinism in ShadowContentResolverTest by @hoisie in https://github.com/robolectric/robolectric/pull/7315
    • Tweak some tests in EspressoTest by @hoisie in https://github.com/robolectric/robolectric/pull/7316
    • Remove deprecated ShadowPackageManager.getPackageInfoForTesting https://github.com/robolectric/robolectric/pull/7318
    • Add baseline test cases for successfully expecting error and warn level logs using ExpectedLogMessagesRuleTest. https://github.com/robolectric/robolectric/pull/7330
    • Implements methods isVoicemailNumber() and getVoicemailNumber() of ShadowTelecomManager. https://github.com/robolectric/robolectric/pull/7331
    • Print log when skipping test because of legacy resource mode from P by @utzcoz in https://github.com/robolectric/robolectric/pull/7334
    • Change the top level project name from parent to robolectric by @hellosagar in https://github.com/robolectric/robolectric/pull/7347
    • Remove deprecated shadows/support-v4 by @utzcoz in https://github.com/robolectric/robolectric/pull/7339
    • Use compat-target module to test compatibility from SDK 28 by @utzcoz in https://github.com/robolectric/robolectric/pull/7100
    • [utils module] [Test conversion] Scheduler test by @hellosagar in https://github.com/robolectric/robolectric/pull/7235
    • [utils module] [Test conversion] Pref stats collector test by @hellosagar in https://github.com/robolectric/robolectric/pull/7237
    • [utils module] [Test conversion] Temp Directory test by @hellosagar in https://github.com/robolectric/robolectric/pull/7236
    • [utils module] [Test conversion] Plugin finder test by @hellosagar in https://github.com/robolectric/robolectric/pull/7238
    • [utils module] [Test conversion] Service finder adapter test by @hellosagar in https://github.com/robolectric/robolectric/pull/7239
    • Extract auto-service version to gradle.properties by @utzcoz in https://github.com/robolectric/robolectric/pull/7352
    • Removed NO_REBUILD option by @Umesh-01 in https://github.com/robolectric/robolectric/pull/7355
    • Update ShadowView.setLayerType to call the real underlying implementation https://github.com/robolectric/robolectric/pull/7356
    • Support test methods that have parameters https://github.com/robolectric/robolectric/pull/7358
    • Use API level int for equality and hashing https://github.com/robolectric/robolectric/pull/7361
    • Set Bitmap default density to qualifiers value https://github.com/robolectric/robolectric/pull/7372
    • Replace Bouncycastle arrays with Java arrays by @akhilrm in https://github.com/robolectric/robolectric/pull/7364
    • Use JDK 11 instead of 11.0.14 for CI by @utzcoz in https://github.com/robolectric/robolectric/pull/7365
    • Prototype GMD configuration with plugin by @utzcoz in https://github.com/robolectric/robolectric/pull/7349
    • Migrate ARTIFACT_FORMAT to ARTIFACT_TYPE_ATTRIBUTE by @utzcoz in https://github.com/robolectric/robolectric/pull/7385
    • Inline me inliner warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7382
    • [warning] Equals get class warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7381
    • [warning] Empty catch warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7379
    • [warning] Byte buffer backing array warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7368
    • Fix simulating window focus on android T. https://github.com/robolectric/robolectric/pull/7389
    • [warning] Do not call suggester warning suppress by @hellosagar in https://github.com/robolectric/robolectric/pull/7377
    • [Warning] Bad import warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7373
    • Migrate *SdkVersion to *Sdk by @utzcoz in https://github.com/robolectric/robolectric/pull/7398
    • Migrate ActivityTestRule to ActivityScenario by @akhilrm in https://github.com/robolectric/robolectric/pull/7407
    • Adds CameraInfo#canDisableShutterSound to the set of values returned from ShadowCamera#getCameraInfo(). https://github.com/robolectric/robolectric/pull/7409
    • [warning] InlineMeSuggester warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7386
    • Clean up ExpectedLogMessagesRuleTest by @utzcoz in https://github.com/robolectric/robolectric/pull/7419
    • Fix code formatting for some SQLite tests by @utzcoz in https://github.com/robolectric/robolectric/pull/7417
    • Run runConfigureICU with sh explicitly on Windows by @utzcoz in https://github.com/robolectric/robolectric/pull/7418
    • Restructure androidx_test with sharedTest pattern by @utzcoz in https://github.com/robolectric/robolectric/pull/6948
    • Bump Espresso to 3.5.0-alpha07 by @utzcoz in https://github.com/robolectric/robolectric/pull/7429
    • chore: Set permissions for GitHub actions by @naveensrinivasan in https://github.com/robolectric/robolectric/pull/7425
    • chore: Included githubactions in the dependabot config by @naveensrinivasan in https://github.com/robolectric/robolectric/pull/7430
    • [warning] ThreadLocalUsage warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7406
    • [warning] StringSplitter warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7405
    • [warning] UnnecessaryParentheses warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7403
    • Add SuppressWarnings for a few NewApi warnings by @JuliaSullivanGoogle in https://github.com/robolectric/robolectric/pull/7433
    • Add a test for TileService.requestListeningState https://github.com/robolectric/robolectric/pull/7437
    • Implement UsbManager#openDevice and UsbManager#hasPermission(UsbAccessory) https://github.com/robolectric/robolectric/pull/7445
    • Rollback of ShadowUsbRequest and ShadowUsbDeviceConnection https://github.com/robolectric/robolectric/pull/7448
    • Implements ShadowUsbRequest and ShadowUsbDeviceConnection https://github.com/robolectric/robolectric/pull/7451
    • Implement missing ShadowNativeSQLiteConnection.nativeClose https://github.com/robolectric/robolectric/pull/7454
    • Add Bundle options to ShadowPendingIntent by @adaext in https://github.com/robolectric/robolectric/pull/7458
    • Respect permissions granted by ShadowContextWrapper.grantPermissions() when sending broadcasts to receivers with permissions. https://github.com/robolectric/robolectric/pull/7463
    • Conscrypt Testing - to run all of the tests on VMs by @Umesh-01 in https://github.com/robolectric/robolectric/pull/7450
    • Avoid calling reflector as part of object finalization https://github.com/robolectric/robolectric/pull/7465
    • Update ActivityScenario.launch() to remove BootstrapActivity https://github.com/robolectric/robolectric/pull/7264
    • Rollback update ActivityScenario.launch() to remove BootstrapActivity https://github.com/robolectric/robolectric/pull/7468
    • Remove '@Ignore' from EspressoTest by @hoisie in https://github.com/robolectric/robolectric/pull/7470
    • Fix sharedTest pattern configuration for androidx_test by @utzcoz in https://github.com/robolectric/robolectric/pull/7431
    • [warning] MissingSummary warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7399
    • [warning] InvalidInlineTag warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7392
    • Prepare to block explicit intents if they don't match intent filters on T+. https://github.com/robolectric/robolectric/pull/7486
    • Retry connectedCheck on CI maximum three time by @utzcoz in https://github.com/robolectric/robolectric/pull/7474
    • Add setSessionActiveState and getAllSessionCallbacks API to ShadowPackageInstaller. https://github.com/robolectric/robolectric/pull/7491
    • Bump spotless to 6.9.1 by @utzcoz in https://github.com/robolectric/robolectric/pull/7498
    • Fix ActivityNotFoundException in ActivityScenario in API 33 https://github.com/robolectric/robolectric/pull/7534
    • Redo update ActivityScenario.launch() to remove BootstrapActivity https://github.com/robolectric/robolectric/pull/7536
    • Post call to recreate activity https://github.com/robolectric/robolectric/pull/7535
    • Implement ShadowUiAutomation#setRotation https://github.com/robolectric/robolectric/pull/7537
    • Add support for the onTopResumedActivityChanged in ActivityController https://github.com/robolectric/robolectric/pull/7539
    • Make ResolveInfo generated by the shadow not crash on toString(). https://github.com/robolectric/robolectric/pull/7540
    • Add shadow method for VMRuntime.getNotifyNativeInterval https://github.com/robolectric/robolectric/pull/7541
    • Add shadow methods for {g,s}etActiveDevice for BluetoothHeadset and BluetoothA2dp https://github.com/robolectric/robolectric/pull/7542
    • Use the new getDeclaredField helper in more parts of ReflectionHelpers https://github.com/robolectric/robolectric/pull/7544
    • Conscrypt as default Security Provider [Updated] by @Umesh-01 in https://github.com/robolectric/robolectric/pull/7492
    • Idle main looper in AndroidX Fragment memory leak test https://github.com/robolectric/robolectric/pull/7547
    • Added simulateSynthesizeToFileResult to support testing success, error and queued states. https://github.com/robolectric/robolectric/pull/7548
    • Avoid calling the real DisplayManagerGlobal constructor in RNG https://github.com/robolectric/robolectric/pull/7549
    • Store CallAudioState in FakeTelecomServer, instead of storing across various Shadow classes. https://github.com/robolectric/robolectric/pull/7550
    • Change calls to Truth.assertThat(java.lang.Boolean) that ignore the result to call isTrue() on it instead. https://github.com/robolectric/robolectric/pull/7553
    • Fix kotlinVersion typo by @utzcoz in https://github.com/robolectric/robolectric/pull/7554
    • Implement ShadowBluetoothDevice#getBatteryLevel for O_MR1+ https://github.com/robolectric/robolectric/pull/7555
    • Make ValueCallbacks in RoboCookieManager nullable by @tinsukE in https://github.com/robolectric/robolectric/pull/7473
    • [warning] UnusedMethod warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7402
    • [warning] UnnecessaryLambda warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7404
    • [warning] InvalidBlockTag warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7393
    • [warning] VariableNameSameAsType warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7401
    • Fix logspam in RobolectricTestRunnerMultiApiTest by @hoisie in https://github.com/robolectric/robolectric/pull/7563
    • [warning] Catch and print stack trace warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7370
    • Reorder if statements in ShadowRegion.equals by @hoisie in https://github.com/robolectric/robolectric/pull/7566
    • Remove unused test code by @hoisie in https://github.com/robolectric/robolectric/pull/7568
    • Fix Javadoc for BackgroundTestRule by @hoisie in https://github.com/robolectric/robolectric/pull/7569
    • [warning] DefaultCharset warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7376
    • [warning] Unused variable warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7374
    • [warning] JavaLangClash warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7394
    • [warning] EmptyBlockTag warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7391
    • Add support for FontFamily.getFont https://github.com/robolectric/robolectric/pull/7574
    • GitHub Workflows security hardening by @sashashura in https://github.com/robolectric/robolectric/pull/7573
    • [Warning] Eliminated AlmostJavadoc warnings across project by @hellosagar in https://github.com/robolectric/robolectric/pull/7354
    • [warning] JavaUtilDate warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7395
    • Revert some method signature updates for Android T https://github.com/robolectric/robolectric/pull/7580
    • Update Robolectric to be compiled against Android T by @hoisie in https://github.com/robolectric/robolectric/pull/7582
    • Add support for two GNSS APIs to ShadowLocationManager. https://github.com/robolectric/robolectric/pull/7584
    • Add test for RoboCookieManager#setCookie with null callback by @utzcoz in https://github.com/robolectric/robolectric/pull/7587
    • [warning] RethrowReflectiveOperationExceptionAsLinkageError warning fix by @hellosagar in https://github.com/robolectric/robolectric/pull/7400
    • Suppress RethrowReflectiveOperationExceptionAsLinkageError for Danger11Plus by @utzcoz in https://github.com/robolectric/robolectric/pull/7589
    • Bump AGP to 7.2.2 by @utzcoz in https://github.com/robolectric/robolectric/pull/7499
    • Add support for DevicePolicyManager in Android T https://github.com/robolectric/robolectric/pull/7592
    • Parse idx and offset correctly from sparse resource entries https://github.com/robolectric/robolectric/pull/7594
    • Deprecate and un-shadow ShadowScanResult class. https://github.com/robolectric/robolectric/pull/7603
    • Bump AGP to 7.3 by @utzcoz in https://github.com/robolectric/robolectric/pull/7384
    • Remove dead code that uses Plan based instrumentation (ClassHandler.Plan) https://github.com/robolectric/robolectric/pull/7610
    • Run SDK 33 tests on CI by @utzcoz in https://github.com/robolectric/robolectric/pull/7613
    • Bump maximum API for GMD to SDK 33 by @utzcoz in https://github.com/robolectric/robolectric/pull/7614
    • Remove use-sdk from androidx_test/sharedTest/AndroidManifest.xml by @utzcoz in https://github.com/robolectric/robolectric/pull/7615
    • [Warning] Eliminated AnnotateFormatMethod warnings by @hellosagar in https://github.com/robolectric/robolectric/pull/7353
    • Remove 0x prefix for string format log by @utzcoz in https://github.com/robolectric/robolectric/pull/7617
    • Bump compile/targetSdk to 33 by @utzcoz in https://github.com/robolectric/robolectric/pull/7616
    • Remove unused Exception for ShadowActivityTest by @utzcoz in https://github.com/robolectric/robolectric/pull/7618
    • Support Activity setShowWhenLocked() and setTurnScreenOn() by @utzcoz in https://github.com/robolectric/robolectric/pull/7438
    • Exclude kotlin-stdlib dependency from utils generated .pom by @utzcoz in https://github.com/robolectric/robolectric/pull/7607
    • Move dependencies of shadows/framework to gradle.properties by @utzcoz in https://github.com/robolectric/robolectric/pull/7627
    • Bump ASM to 9.3 by @utzcoz in https://github.com/robolectric/robolectric/pull/7626
    • Add the ability to deploy specific preinstrumented jars to maven by @hoisie in https://github.com/robolectric/robolectric/pull/7602
    • Combine exceptions for ReflectionHelpers#getDeclaredField by @utzcoz in https://github.com/robolectric/robolectric/pull/7634
    • Clean up ShadowAccountManager by @utzcoz in https://github.com/robolectric/robolectric/pull/7636
    • Migrate Gradle dependencies to dependencies.gradle by @utzcoz in https://github.com/robolectric/robolectric/pull/7635
    • Add alternative to Unsafe.defineAnonymousClass by @utzcoz in https://github.com/robolectric/robolectric/pull/7633
    • Support all authentication results for BiometricManager by @charlesng in https://github.com/robolectric/robolectric/pull/7427
    • Bump bcprov-jdk15on from 1.68 to 1.70 by @dependabot in https://github.com/robolectric/robolectric/pull/7638
    • Bump constraintlayout from 2.1.3 to 2.1.4 by @dependabot in https://github.com/robolectric/robolectric/pull/7640
    • Reuse bytecode of ClassWriter for ProxyMaker by @utzcoz in https://github.com/robolectric/robolectric/pull/7643
    • Migrate instance calling in ReflectionHelpers to lambda by @utzcoz in https://github.com/robolectric/robolectric/pull/7644
    • Bump compile-testing from 0.18 to 0.19 by @dependabot in https://github.com/robolectric/robolectric/pull/7645
    • Bump apiCompatVersion from 4.7 to 4.8.2 by @dependabot in https://github.com/robolectric/robolectric/pull/7647
    • Bump gson from 2.8.6 to 2.9.1 by @dependabot in https://github.com/robolectric/robolectric/pull/7646
    • Bump core from 1.5.0 to 1.9.0 by @dependabot in https://github.com/robolectric/robolectric/pull/7649

    New Contributors

    • @Goooler made their first contribution in https://github.com/robolectric/robolectric/pull/7195
    • @hellosagar made their first contribution in https://github.com/robolectric/robolectric/pull/7154
    • @Akshay2131 made their first contribution in https://github.com/robolectric/robolectric/pull/7210
    • @Umesh-01 made their first contribution in https://github.com/robolectric/robolectric/pull/7232
    • @bacecek made their first contribution in https://github.com/robolectric/robolectric/pull/7298
    • @akhilrm made their first contribution in https://github.com/robolectric/robolectric/pull/7364
    • @naveensrinivasan made their first contribution in https://github.com/robolectric/robolectric/pull/7425
    • @adaext made their first contribution in https://github.com/robolectric/robolectric/pull/7458
    • @tinsukE made their first contribution in https://github.com/robolectric/robolectric/pull/7473
    • @sashashura made their first contribution in https://github.com/robolectric/robolectric/pull/7573
    • @charlesng made their first contribution in https://github.com/robolectric/robolectric/pull/7427
    • @dependabot made their first contribution in https://github.com/robolectric/robolectric/pull/7638

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.8...robolectric-4.9-alpha-1

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.9-alpha-1(Sep 16, 2022)

  • robolectric-4.8.2(Aug 22, 2022)

    This is a minor release that fixes a number of issues, including:

    • https://github.com/robolectric/robolectric/issues/7413, an issue closing SQLite databases.

    • https://github.com/robolectric/robolectric/issues/7479, an initialization error in CountDownTimer.

    Use Robolectric 4.8.2:

    testCompile "org.robolectric:robolectric:4.8.2"
    
    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.8.1(May 3, 2022)

  • robolectric-4.8(Apr 28, 2022)

    Robolectric 4.8 adds support for Android S V2 (API level 32). It also contains many bug fixes and API enhancements.

    What's Changed

    • Turn off Gradle's fs watching during tests by @hoisie in https://github.com/robolectric/robolectric/pull/6849
    • Remove unused resources.arsc file by @hoisie in https://github.com/robolectric/robolectric/pull/6855
    • Fix name for macOS tasks to rename and upload binary files by @utzcoz in https://github.com/robolectric/robolectric/pull/6856
    • Shadow Build.VERSION#MEDIA_PERFORMANCE_CLASS in https://github.com/robolectric/robolectric/pull/6836
    • Support overriding Icon loading executor from Icon#loadDrawableAsync. in https://github.com/robolectric/robolectric/pull/6828
    • Update Android code search link to the public version in https://github.com/robolectric/robolectric/pull/6850
    • Remove unnecessary TimePickerDialog constructor shadow in https://github.com/robolectric/robolectric/pull/6838
    • Remove inaccessible Google issue tracker links in https://github.com/robolectric/robolectric/pull/6854
    • Use Activity's member Instrumentation in ActivityController in https://github.com/robolectric/robolectric/pull/6860
    • Fix UnsupportedOperationException if a leaked Activity.recreate is called in https://github.com/robolectric/robolectric/pull/6862
    • Add ActivityController.close that transitions Activity to destroyed state in https://github.com/robolectric/robolectric/pull/6864
    • Fix SDK version check for onPageFinished() call. It should be available for all SDK versions instead. See https://developer.android.com/reference/android/webkit/WebViewClient#onPageFinished(android.webkit.WebView,%20java.lang.String) in https://github.com/robolectric/robolectric/pull/6865
    • Limit instrumentation on interfaces in https://github.com/robolectric/robolectric/pull/6866
    • Bump to version 3 of preinstrumented jars by @hoisie in https://github.com/robolectric/robolectric/pull/6867
    • Migrate ShadowAccessibilityNodeInfo to reflector in https://github.com/robolectric/robolectric/pull/6868
    • Add perf stat for applying styles in binary resources in https://github.com/robolectric/robolectric/pull/6869
    • Refine methods: getYear(), getMonthOfYear(), getDayOfMonth() and getOnDateSetListenerCallback(). in https://github.com/robolectric/robolectric/pull/6841
    • Add onConnectionEvent() to ShadowInCallService. in https://github.com/robolectric/robolectric/pull/6870
    • Fix theme native object collection in Android S in https://github.com/robolectric/robolectric/pull/6873
    • Use a self-hosted Mac M1 runner for the build_nativeruntime task by @hoisie in https://github.com/robolectric/robolectric/pull/6871
    • Use 'processResources' task instead of 'jar' task for nativeruntime by @hoisie in https://github.com/robolectric/robolectric/pull/6874
    • Remove unused Exception from test methods for dependency-on-stubs by @utzcoz in https://github.com/robolectric/robolectric/pull/6876
    • Add solution log for unhandled PNG file by @utzcoz in https://github.com/robolectric/robolectric/pull/6829
    • Remove instrumentedPackages workaround by @hoisie in https://github.com/robolectric/robolectric/pull/6875
    • Remove unused org.robolectric.annotation.Config imports by @hoisie in https://github.com/robolectric/robolectric/pull/6879
    • Only using AttributionSource for compile sdk 31 and above by @utzcoz in https://github.com/robolectric/robolectric/pull/6884
    • Clear InputMethodManager.sInstance for SDK > P in https://github.com/robolectric/robolectric/pull/6880
    • Adding VcnManagementService to ShadowSystemServices for VCN-related tests. in https://github.com/robolectric/robolectric/pull/6881
    • Check Window flags when selecting root view in LocalUiController. #6741 in https://github.com/robolectric/robolectric/pull/6745
    • Cleanup of AndroidManifest Activity references. in https://github.com/robolectric/robolectric/pull/6878
    • Fix broken GitHub CI when running tests by @hoisie in https://github.com/robolectric/robolectric/pull/6893
    • Fix some lint errors in Target29CompatibilityTest by @hoisie in https://github.com/robolectric/robolectric/pull/6891
    • Avoid re-running ICU ./configure if Makefile exists by @hoisie in https://github.com/robolectric/robolectric/pull/6889
    • Remove redundant SKIP_ICU_BUILD environment variable by @hoisie in https://github.com/robolectric/robolectric/pull/6890
    • Remove unnecessary DatePickerDialog constructor shadow in https://github.com/robolectric/robolectric/pull/6897
    • Add matrix computation support to ShadowRenderNode implementations in https://github.com/robolectric/robolectric/pull/6775
    • Add support for building Robolectric's nativeruntime with gcc/g++ in https://github.com/robolectric/robolectric/pull/6900
    • Switch to Ninja for building the native runtime in https://github.com/robolectric/robolectric/pull/6904
    • Close android.database.Cursor objects in tests in https://github.com/robolectric/robolectric/pull/6905
    • Fix remaining CloseGuard warnings in Robolectric tests in https://github.com/robolectric/robolectric/pull/6906
      1. Adds ShadowVibrator#addSupportedPrimitives to enable in https://github.com/robolectric/robolectric/pull/6907
    • Use real Android code for ContentProviderClient.release in https://github.com/robolectric/robolectric/pull/6908
    • Update platformStrError to work in Windows in https://github.com/robolectric/robolectric/pull/6910
    • Add setIsUniqueDeviceAttestationSupported and isUniqueDeviceAttestationSupported support to ShadowDevicePolicyManager in https://github.com/robolectric/robolectric/pull/6909
    • Add custom JNI_INCLUDE_DIRS for Windows only by @utzcoz in https://github.com/robolectric/robolectric/pull/6914
    • Use runner.arch when calculating ICU cache keys by @hoisie in https://github.com/robolectric/robolectric/pull/6894
    • Add test ShadowPackageManagerTest#packageInstallerAndGetPackageInfo by @utzcoz in https://github.com/robolectric/robolectric/pull/6898
    • fix for NPE when ShadowLegacyAssetManager is used by @kenyee in https://github.com/robolectric/robolectric/pull/6918
    • Remove specific clang/clang++ env for build_native_runtime.yml by @utzcoz in https://github.com/robolectric/robolectric/pull/6924
    • Support nativeruntime building for Windows by @utzcoz in https://github.com/robolectric/robolectric/pull/6801
    • Handle more values in ShadowSystemProperties.getBoolean in https://github.com/robolectric/robolectric/pull/6915
    • Update the windowConfiguration bounds when updating the display metrics in https://github.com/robolectric/robolectric/pull/6922
    • Add shadows for UwbManager and RangingSession. in https://github.com/robolectric/robolectric/pull/6926
    • Make two small improvements to ShadowMatrixTest in https://github.com/robolectric/robolectric/pull/6929
    • Remove ServiceFinder in https://github.com/robolectric/robolectric/pull/6931
    • Bump AGP to 7.1.0-beta05 by @utzcoz in https://github.com/robolectric/robolectric/pull/6927
    • Bump SDK to 31 for integration_tests if possible by @utzcoz in https://github.com/robolectric/robolectric/pull/6928
    • Remove explicit binary mode declaration for affected test modules by @utzcoz in https://github.com/robolectric/robolectric/pull/6943
    • Remove specific clang/clang++ env for tests.yml by @utzcoz in https://github.com/robolectric/robolectric/pull/6945
    • Creating ShadowVcnManager for vcn-related testing. in https://github.com/robolectric/robolectric/pull/6932
    • Add READ_PHONE_STATE permission check to ShadowTelephonyManager.getVoiceNetworkType in https://github.com/robolectric/robolectric/pull/6935
    • Update ShadowAppOpsManager to allow for multiple invocations of startWatching for a single listener. in https://github.com/robolectric/robolectric/pull/6936
    • Add shadows for ImageReader and SurfaceTexture. Invoke updates from Surface to linked clients. in https://github.com/robolectric/robolectric/pull/6937
    • Fix typo in https://github.com/robolectric/robolectric/pull/6938
    • Add CI job to build nativeruntime for Windows by @utzcoz in https://github.com/robolectric/robolectric/pull/6923
    • Intercept native Font states at Java level for Android S by @utzcoz in https://github.com/robolectric/robolectric/pull/6954
    • Add regression test for mockito spy by @utzcoz in https://github.com/robolectric/robolectric/pull/6942
    • Remove unused Exception from test methods for XmlResourceParserImplTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6946
    • Merge defaultConfig for ctesque build.gradle by @utzcoz in https://github.com/robolectric/robolectric/pull/6949
    • Use guavaJREVersion from gradle.properties for some modules by @utzcoz in https://github.com/robolectric/robolectric/pull/6952
    • Use version from gradle.properties for shadows:playservices by @utzcoz in https://github.com/robolectric/robolectric/pull/6951
    • Call onSaveInstanceState after onStop from API P by @utzcoz in https://github.com/robolectric/robolectric/pull/6940
    • Add perf stats for loading plugins and loading the native runtime in https://github.com/robolectric/robolectric/pull/6947
    • Add two S-specific test cases for ShadowDevicePolicyManager in https://github.com/robolectric/robolectric/pull/6956
    • Fix class description. in https://github.com/robolectric/robolectric/pull/6957
    • Support NotificationManager.addAutomaticZenRule that could add AutomaticZenRule without owner,but has configurationActivity. in https://github.com/robolectric/robolectric/pull/6958
    • Add plumbing for source resource id getter in https://github.com/robolectric/robolectric/pull/6959
    • Add ShadowConnection that records the last event sent through Connection.sendConnectionEvent. in https://github.com/robolectric/robolectric/pull/6964
    • Bump AGP to 7.1.0-rc01 by @utzcoz in https://github.com/robolectric/robolectric/pull/6955
    • Remove unused exception from tests for SQLiteLibraryLoaderTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6968
    • Clean up androidx_test by @utzcoz in https://github.com/robolectric/robolectric/pull/6969
    • set createdFromBytes also when using decodeByteArray with options by @edwinvanderham in https://github.com/robolectric/robolectric/pull/6972
    • Move ShadowWranglerIntegrationTest.ShadowFooParent to sandbox testing package in https://github.com/robolectric/robolectric/pull/6973
    • Use invokespecial when invoking shadow constructors in https://github.com/robolectric/robolectric/pull/6979
    • Add a ShadowCloseGuard and CloseGuardRule for verifying all CloseGuards have been closed in https://github.com/robolectric/robolectric/pull/6980
    • Trigger listeners for ServiceState in TelephonyManager.listen in https://github.com/robolectric/robolectric/pull/6981
    • Tweak precondition check in NotificationManager.updateAutomaticZenRule by @hoisie in https://github.com/robolectric/robolectric/pull/7003
    • Makes sparse array implement the set() method for all api levels by adding the byte code for it in the ClassInstrumentor. by @JuliaSullivanGoogle in https://github.com/robolectric/robolectric/pull/6963
    • Intercept the getInt$() and setInt$(int) functions on FileDescriptor by @hoisie in https://github.com/robolectric/robolectric/pull/7002
    • Simplify SparseArray.set instrumentation by @hoisie in https://github.com/robolectric/robolectric/pull/7004
    • Retain outer class assignment in the constructor in https://github.com/robolectric/robolectric/pull/6984
    • Add FileDescriptor transform to ShadowMediaMetadataRetriever. in https://github.com/robolectric/robolectric/pull/6985
    • Add shadow method for WifiManager.isStaApConcurrencySupported in https://github.com/robolectric/robolectric/pull/6986
    • Update ShadowVcnManager to support VcnConfig setting and subscription group (ParcelUuid) setting. in https://github.com/robolectric/robolectric/pull/6987
    • Fix signature for ShadowPausedMessageQueue 'enqueueMessage' reflector in https://github.com/robolectric/robolectric/pull/6988
    • Allows calling clearVcnConfig() when the vcnConfig being cleared is not set. in https://github.com/robolectric/robolectric/pull/6992
    • Enable realistic View matrix calculations by default in https://github.com/robolectric/robolectric/pull/6996
    • Add unregisterStats(path) method in ShadowStatsFs in https://github.com/robolectric/robolectric/pull/7001
    • Bump icu4j to 70.1 by @utzcoz in https://github.com/robolectric/robolectric/pull/6993
    • Bump apiCompatVersion to 4.7 by @utzcoz in https://github.com/robolectric/robolectric/pull/6994
    • Bump AGP to 7.1.0 by @utzcoz in https://github.com/robolectric/robolectric/pull/7007
    • Added JDK prerequisites in README, for contributors to build project. by @ZSmallX in https://github.com/robolectric/robolectric/pull/7009
    • Remove deprecated supportv4 shadows by @utzcoz in https://github.com/robolectric/robolectric/pull/7031
    • Change ShadowAppWidgetManager to use AppWidgetHostView instead of FrameLayout to support ListView / remote collections testing. in https://github.com/robolectric/robolectric/pull/7008
    • Reformat AndroidInterceptors in https://github.com/robolectric/robolectric/pull/7010
    • Add shadow for SurfaceControl#nativeCreate in https://github.com/robolectric/robolectric/pull/7012
    • Changes ShadowActivity to use reflector instead of using direct reflection to call certain methods by @JuliaSullivanGoogle in https://github.com/robolectric/robolectric/pull/7040
    • Add a test case for spying on a shadowed object in https://github.com/robolectric/robolectric/pull/7013
    • Trigger an asynchronous broadcast of scan results in WifiManager.startScan in https://github.com/robolectric/robolectric/pull/7015
      1. Stores VibrationAttributes in ShadowVibrator and exposes a getter getVibrationAttributesFromLastVibration to get VibrationAttributes for the last vibration. in https://github.com/robolectric/robolectric/pull/7018
    • Make loading the native runtime extensible in https://github.com/robolectric/robolectric/pull/7021
    • Return null for external files directory if external storage is unavailable in https://github.com/robolectric/robolectric/pull/7022
    • Fix touch event dispatch to not go to out of bounds non touch modal windows in https://github.com/robolectric/robolectric/pull/7025
    • Add getShareTitle() and getShareDescription() to ShadowBugreportManager, set in https://github.com/robolectric/robolectric/pull/7024
    • Add shadow for CompanionDeviceManager in https://github.com/robolectric/robolectric/pull/7030
    • Add support for new S ProviderProperties APIs. in https://github.com/robolectric/robolectric/pull/7029
    • Make deprecation comment in RuntimeEnvironment.application refer to RuntimeEnvironment.getApplication() instead of androidx.test.core.app.ApplicationProvider#getApplicationContext in https://github.com/robolectric/robolectric/pull/7033
    • Added register/unregister callback shadows for CameraManager. in https://github.com/robolectric/robolectric/pull/7035
    • Return Number from ShadowSurfaceControl#nativeCreate to support sdk 18/19 in https://github.com/robolectric/robolectric/pull/7027
    • Fix some lint warnings in https://github.com/robolectric/robolectric/pull/7016
    • Change ShadowBluetoothAdapter to cache getRemoteDevice instances. In android, the state for a given device (uniquely identified by its address) is global. When you have two instances of BluetoothDevice and mutate one, the other will reflect it, even though they are not the same java object. in https://github.com/robolectric/robolectric/pull/7038
    • Add support for touch mode in https://github.com/robolectric/robolectric/pull/7011
    • Return Number from ShadowSurfaceControl#nativeCreate to support sdk 18/19 by @JuliaSullivanGoogle in https://github.com/robolectric/robolectric/pull/7042
    • Added more prerequisites for robolectic building and testing in README by @ZSmallX in https://github.com/robolectric/robolectric/pull/7079
    • Added junit dependency in README. by @ZSmallX in https://github.com/robolectric/robolectric/pull/7085
    • Migrate AndroidJUnit4 to ext version for ctesque by @utzcoz in https://github.com/robolectric/robolectric/pull/7037
    • Add a task to fetch nativeruntime artifacts from a GitHub CI run by @hoisie in https://github.com/robolectric/robolectric/pull/6895
    • Add integration tests for mokito-kotlin's regression by @ZSmallX in https://github.com/robolectric/robolectric/pull/7086
    • Remove ShadowsPlugin from supportv4/build.gradle by @hoisie in https://github.com/robolectric/robolectric/pull/7092
    • Bump massive dependencies for androidx and androidx_test by @utzcoz in https://github.com/robolectric/robolectric/pull/7093
    • Optimizes getFd and close behaviors for ParcelFileDescriptor by @ZSmallX in https://github.com/robolectric/robolectric/pull/7101
    • Add support for Build.setSerial in ShadowBuild in https://github.com/robolectric/robolectric/pull/7043
    • Add DragEventBuilder helper in https://github.com/robolectric/robolectric/pull/7044
    • Flesh out support for GNSS APIs. in https://github.com/robolectric/robolectric/pull/7039
    • Reduce visibility of ShadowActivity.isFinishing in https://github.com/robolectric/robolectric/pull/7047
    • create ShadowActivity#simulateGetDirectActions for testing assistant requesting DirectAction from an Activity in https://github.com/robolectric/robolectric/pull/7045
    • Add shadow implementations for source resource id getters in https://github.com/robolectric/robolectric/pull/7046
    • Adds a Robolectric property to allow users to build Robolectric without the preinstrumented jars to allow for better testing of new features. in https://github.com/robolectric/robolectric/pull/7000
    • Adds shadow for DisplayHashManager. in https://github.com/robolectric/robolectric/pull/7050
    • Remove enableMatrix=true properties, default is now true in https://github.com/robolectric/robolectric/pull/7051
    • Add interceptor for Reference.refersTo. in https://github.com/robolectric/robolectric/pull/7052
    • Speed up ShadowRcsUceAdapterSTest. in https://github.com/robolectric/robolectric/pull/7056
    • Run google-java-format on ShadowMatrixTest in https://github.com/robolectric/robolectric/pull/7058
    • Make ShadowPackageManager generatePackageInfo extensible. in https://github.com/robolectric/robolectric/pull/7059
    • Removing the onStatusChanged() invoke when VcnStatusCallback is registered. in https://github.com/robolectric/robolectric/pull/7061
    • Sets github's test gradle usePreinstrumentedJars value to false by default. in https://github.com/robolectric/robolectric/pull/7062
    • Add ShadowWindowManagerGlobal#getLastDragClipData method in https://github.com/robolectric/robolectric/pull/7019
    • Update SQLiteConnection shadows to support Android T changes in https://github.com/robolectric/robolectric/pull/7063
    • Update ShadowActivityThread for T in https://github.com/robolectric/robolectric/pull/7064
    • Add T-specific logic for ActivityController.windowFocusChanged in https://github.com/robolectric/robolectric/pull/7065
    • Prepare to adjust for changed BluetoothAdapter.setScanMode signature. in https://github.com/robolectric/robolectric/pull/7066
    • Return the original method's test name in https://github.com/robolectric/robolectric/pull/7067
    • Support new API registerReceiver(BroadcastReceiver receiver, IntentFilter filter, int flags) after O in https://github.com/robolectric/robolectric/pull/7068
    • Add shadows for Settings.Secure.getIntForUser. in https://github.com/robolectric/robolectric/pull/7071
    • ShadowImageReaderTest: Move Config setting to class level since its common for all tests. in https://github.com/robolectric/robolectric/pull/7072
    • Pass through openInputStream calls if a provider for the authority is registered. in https://github.com/robolectric/robolectric/pull/7073
    • Fix for potential race condition in ShadowMediaCodec async mode. in https://github.com/robolectric/robolectric/pull/7074
    • Enable WebView.createWebMessageChannel shadow. in https://github.com/robolectric/robolectric/pull/7070
    • Bump the runtime SDK of shadows:httpclient tests to S in https://github.com/robolectric/robolectric/pull/7075
    • Add new VibrationAttributesBuilder in https://github.com/robolectric/robolectric/pull/7077
    • Add support for new constructor in StorageVolumeBuilder in https://github.com/robolectric/robolectric/pull/7078
    • Create new RangingSessionBuilder in https://github.com/robolectric/robolectric/pull/7076
    • Mimic actual MediaCodec creation logic. in https://github.com/robolectric/robolectric/pull/7082
    • Add unregisterSessionCallback implementation in the PackageInstaller. in https://github.com/robolectric/robolectric/pull/7084
    • Make the ShadowPausedSystemClock thread safe in https://github.com/robolectric/robolectric/pull/7083
    • Add support for new field in DisplayManager BrightnessConfiguration APIs in https://github.com/robolectric/robolectric/pull/7088
    • Make TestParcelable* classes public in https://github.com/robolectric/robolectric/pull/7087
    • Add getThermalStatusListeners() to return registered listener for shadow power manager. in https://github.com/robolectric/robolectric/pull/7091
    • Add USB signaling API override support to ShadowDevicePolicyManager in https://github.com/robolectric/robolectric/pull/7098
    • Remove robolectric.rendernode.enableMatrix flag in https://github.com/robolectric/robolectric/pull/7099
    • Update check_java_formatting action to use Google Java Format 1.15 by @hoisie in https://github.com/robolectric/robolectric/pull/7113
    • Open LocationRequest methods up down to Kitkat when they were first added. in https://github.com/robolectric/robolectric/pull/6761
    • Add getTotalSize, setTotalSize, getBytesSoFar and setBytesSoFar for DownloadManager.Request in ShadowDownloadManager. in https://github.com/robolectric/robolectric/pull/7104
    • Add nCreateTextureLayer to ShadowHardwareRenderer in https://github.com/robolectric/robolectric/pull/7106
    • Add some concurrency tests for ShadowPausedSystemClockTest in https://github.com/robolectric/robolectric/pull/7090
    • Add a test for ActivityNotFoundExceptions in Espresso intents by @hoisie in https://github.com/robolectric/robolectric/pull/7115
    • Add support for getInstallSourceInfo in ShadowPackageManager. The behaviour is independent of existing getInstallerPackage support. in https://github.com/robolectric/robolectric/pull/7103
    • Apply style/lint fixes to mockito-kotlin test code by @hoisie in https://github.com/robolectric/robolectric/pull/7116
    • Use ktfmt to format kotlin code by @utzcoz in https://github.com/robolectric/robolectric/pull/7125
    • Skip ShadowSQLiteConnection test on M1 by @utzcoz in https://github.com/robolectric/robolectric/pull/7054
    • Update minimum requirement toolchain version by @utzcoz in https://github.com/robolectric/robolectric/pull/7131
    • Add implementation for shadows of AccessibilityManagers StateChangeListener by @MichaelEvans in https://github.com/robolectric/robolectric/pull/7094
    • Fix format problem of ShadowAccessibilityManager by @utzcoz in https://github.com/robolectric/robolectric/pull/7137
    • Have ShadowApplicationPackageManager#getPackageArchiveInfo call super() when apiLevel >= T in https://github.com/robolectric/robolectric/pull/7118
    • Fix setTouchExplorationEnabled() not calling onTouchExplorationStateChanged() on the TouchExplorationStateChangeListeners in https://github.com/robolectric/robolectric/pull/7120
    • Adding an overload method to registerReceiver to include flags when registering a receiver with a broadcast permission in https://github.com/robolectric/robolectric/pull/7121
    • Fix bitmap mutable, premutliplied, and alpha properties. in https://github.com/robolectric/robolectric/pull/7122
    • Add @Implementation where missing in Robolectric's shadows in https://github.com/robolectric/robolectric/pull/7119
    • Run google-java-format on ShadowTime in https://github.com/robolectric/robolectric/pull/7133
    • Add support for ColorSpace to ShadowBitmap in https://github.com/robolectric/robolectric/pull/7134
    • Add support for Android S V2 in Robolectric by @hoisie in https://github.com/robolectric/robolectric/pull/7132
    • Add a "default" list of system features to ShadowPackageManager in https://github.com/robolectric/robolectric/pull/7135
    • Update ShadowBluetoothDevice to throw an exception if the BLUETOOTH_CONNECT permission isn't granted. in https://github.com/robolectric/robolectric/pull/7117
    • Don't decode image bytes as utf-8 encoded string in https://github.com/robolectric/robolectric/pull/7139
    • Improve support for low-power idle modes in ShaddowAlarmManager in https://github.com/robolectric/robolectric/pull/7138
    • Add support for shadowing TaskInfo#isVisible. in https://github.com/robolectric/robolectric/pull/7142
    • Migrate from strongly discouraged @Test(expected = ...) to assertThrows(...). in https://github.com/robolectric/robolectric/pull/7143
    • Adding ShadowContentCaptureManager to Q+ in https://github.com/robolectric/robolectric/pull/7144
    • Add support for save/restore in ShadowCanvas in https://github.com/robolectric/robolectric/pull/7146
    • Fix TouchExplorationStateChangeListener trigger logic for SDK < O in https://github.com/robolectric/robolectric/pull/7147
    • Migrate ShadowTaskInfo to a builder in https://github.com/robolectric/robolectric/pull/7149
    • Bump preinstrumented jars to version 4 by @hoisie in https://github.com/robolectric/robolectric/pull/7156
    • Re-enable nativeruntime building for Windows by @hoisie in https://github.com/robolectric/robolectric/pull/7157
    • Disable shadowOf generation for DisplayHashManager by @hoisie in https://github.com/robolectric/robolectric/pull/7159
    • Enable integration_tests:sparsearray tests by @utzcoz in https://github.com/robolectric/robolectric/pull/7006
    • Enable CI when PRs are made to the 'google' branch by @hoisie in https://github.com/robolectric/robolectric/pull/7164
    • Add triggerOnReadyForSpeech() to ShadowSpeechRecognizer. in https://github.com/robolectric/robolectric/pull/7163
    • Bump gradle-versions-plugin to 0.42.0 by @utzcoz in https://github.com/robolectric/robolectric/pull/6970
    • Clean up tests.yml by @utzcoz in https://github.com/robolectric/robolectric/pull/7161
    • Block UiController#loopMainThreadUntilIdle on registered idling resources being idle. in https://github.com/robolectric/robolectric/pull/7148
    • Return non-zero pointer from nCreateTextureLayer in https://github.com/robolectric/robolectric/pull/7166
    • Correctly register all idling resources in https://github.com/robolectric/robolectric/pull/7167
    • Update README.md to declare Robolectric supports SDK 32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7169
    • Indicate windows are visible by default (flag enabled) in https://github.com/robolectric/robolectric/pull/7179
    • Add documentation to run tests on Emulator by @utzcoz in https://github.com/robolectric/robolectric/pull/7162
    • Restore accidentally deleted link to building Robolectric in https://github.com/robolectric/robolectric/pull/7183
    • Ensure getNetworkCountryIso & getSimCountryIso return lowercase only, to match the actual APIs. in https://github.com/robolectric/robolectric/pull/7184
    • Update RoboLocationRequest equals() and toString(). in https://github.com/robolectric/robolectric/pull/7186
    • Centralize the Injector logic to load the native runtime in https://github.com/robolectric/robolectric/pull/7198
    • Fixed PFD testGetFd_canRead test failed on macOS. by @ZSmallX in https://github.com/robolectric/robolectric/pull/7202
    • Optimize CI a bit by @Goooler in https://github.com/robolectric/robolectric/pull/7195
    • Clean up ctesque by @utzcoz in https://github.com/robolectric/robolectric/pull/7145
    • Clean up ShadowDefaultRequestDirectorTest.java by @utzcoz in https://github.com/robolectric/robolectric/pull/7208
    • Bump Gradle to 7.4.2 by @utzcoz in https://github.com/robolectric/robolectric/pull/7207
    • Remove unused Exception from example in README.md by @utzcoz in https://github.com/robolectric/robolectric/pull/7206
    • Error prone and google format fix annotation module by @hellosagar in https://github.com/robolectric/robolectric/pull/7154
    • Update CI to use JDK 11.0.14 by @hoisie in https://github.com/robolectric/robolectric/pull/7213
    • Support Canvas#drawRect with RectF by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7210
    • Remove maxSdk restrition for ShadowBiometricManager#canAuthenticate implementation by @utzcoz in https://github.com/robolectric/robolectric/pull/7211
    • Switch to run tests on Emulator with SDK 29,32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7170
    • Support JDK 1.8 in ShadowWrangler invokespecial logic in https://github.com/robolectric/robolectric/pull/7219
    • build: bump errorprone plugin version from 1.3.0 to 2.0.2 by @hellosagar in https://github.com/robolectric/robolectric/pull/7218
    • Bring integration_tests to API 32 by @utzcoz in https://github.com/robolectric/robolectric/pull/7217
    • Add method expectLogMessagePatternWithThrowableMatcher to ExpectedLogMessagesRule so that users can check for a Throwable, as well as a log message pattern. in https://github.com/robolectric/robolectric/pull/7221
    • Add javadoc for DefaultShadowPicker by @hoisie in https://github.com/robolectric/robolectric/pull/7222
    • Add SdkSuppress to some tests in ThemeTest and MotionEventTest by @hoisie in https://github.com/robolectric/robolectric/pull/7227
    • Removed targetSdk from AndroidManifest.xml by @Umesh-01 in https://github.com/robolectric/robolectric/pull/7232
    • Add getCurrentSyncs() in ShadowContentResolver by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7225
    • Make deep copy of mPointerProperties for NativeInput#copyFrom by @utzcoz in https://github.com/robolectric/robolectric/pull/7251
    • Remove empty ShadowTextPaint by @utzcoz in https://github.com/robolectric/robolectric/pull/7250
    • Migrate compileSdkVersion to compileSdk by @Akshay2131 in https://github.com/robolectric/robolectric/pull/7253
    • Ensure ShadowActivity can work with project targetSdk less than S by @utzcoz in https://github.com/robolectric/robolectric/pull/7254

    New Contributors

    • @kenyee made their first contribution in https://github.com/robolectric/robolectric/pull/6918
    • @edwinvanderham made their first contribution in https://github.com/robolectric/robolectric/pull/6972
    • @JuliaSullivanGoogle made their first contribution in https://github.com/robolectric/robolectric/pull/6963
    • @ZSmallX made their first contribution in https://github.com/robolectric/robolectric/pull/7009
    • @MichaelEvans made their first contribution in https://github.com/robolectric/robolectric/pull/7094
    • @Goooler made their first contribution in https://github.com/robolectric/robolectric/pull/7195
    • @hellosagar made their first contribution in https://github.com/robolectric/robolectric/pull/7154
    • @Akshay2131 made their first contribution in https://github.com/robolectric/robolectric/pull/7210
    • @Umesh-01 made their first contribution in https://github.com/robolectric/robolectric/pull/7232

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.7.3...robolectric-4.8

    Use Robolectric:

    testCompile "org.robolectric:robolectric:4.8"
    
    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.8-alpha-1(Mar 21, 2022)

  • robolectric-4.7.3(Dec 1, 2021)

    This is a minor release that fixes #6883, a NoClassDefError that can occur if the compileSdk < 31. Thanks for @ninniuz for reporting and @utzcoz for the fix (#6884).

    It also fixes a minor case of test pollution, where a single Activity could leak across tests (see 5a1f02aaf37f425f8938ae41df5d7aa1b72bba9c for details).

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.7.2(Nov 20, 2021)

    This is a minor release that fixes a memory leak of Theme objects in binary resources for Android S (#6872). Thanks @calvarez-ov for the report and helping debug.

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.7.1(Nov 18, 2021)

    This is a minor release that fixes #6858. In that issue, certain Android classes could not be mocked by Mockito due to some changes to Robolectric instrumentation performed on interfaces.

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.7(Nov 12, 2021)

    Robolectric 4.7 adds support for Android S (API level 31).

    Another big feature is support for Apple Silicon (Mac M1). Robolectric 4.7 now contains its own native implementation of the android.database.sqlite package. For Mac M1 machines, this SQLite mode is the default. For other OS's and architecture, use @SQLiteMode(NATIVE) to enable it. This new mode is currently only available for Mac and Linux. Native SQLite should be significantly faster, around 50-90% faster for SQLite operations, than the LEGACY SQLite mode. There were also several other performance improvements made for SQLite operations -- #6687, #6690, and #6711 (thanks @al-broco!).

    The support v4 shadows are also deprecated at this release, and they will be removed at Robolectric 4.8.

    Robolectric 4.7 also supports JDK 17.

    What's Changed

    • Clear cookies after test finished for CookieManagerTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6581
    • Only using ApplicationExitInfo for compile sdk 30 and above by @utzcoz in https://github.com/robolectric/robolectric/pull/6590
    • Rebase PR 4064 - Fix NPE during saving state of WebView by @utzcoz in https://github.com/robolectric/robolectric/pull/6597
    • Converting the String version of directlyOn(...) to @Direct with reflector(...). by @hoisie in https://github.com/robolectric/robolectric/pull/6598
    • Add ITelephonyRegistry to ShadowServiceManager https://github.com/robolectric/robolectric/pull/6605
    • Implement new #startActivity methods for ShadowCrossProfileApps. https://github.com/robolectric/robolectric/pull/6601
    • Add ShadowMediaExtractor. https://github.com/robolectric/robolectric/pull/6592
    • Converting onVsync calls from ReflectionHelpers to use @Direct with reflector(...) instead. https://github.com/robolectric/robolectric/pull/6602
    • Update ShadowDisplayEventReceiver to support S https://github.com/robolectric/robolectric/pull/6609
    • Converting the proxy version of directlyOn(...) to @Direct with reflector(...). by @hoisie in https://github.com/robolectric/robolectric/pull/6610
    • Fix Robolectric camera shadows to work with newer SDK versions. https://github.com/robolectric/robolectric/pull/6611
    • Converting recycleUnchecked calls to use @Direct with reflector(...) in place of ReflectionHelpers. https://github.com/robolectric/robolectric/pull/6603
    • Cleaning up unnecessary @Direct annotations in DirectActivityReflector. https://github.com/robolectric/robolectric/pull/6616
    • Fixing the incorrect method signature in AssetManagerReflector that breaks GitHub CI. https://github.com/robolectric/robolectric/pull/6612
    • No longer automatically log everything in ShadowLog if stream is specified https://github.com/robolectric/robolectric/pull/6617
    • Support IntBuffer with copyPixelsFromBuffer https://github.com/robolectric/robolectric/pull/6613
    • Suppress missing /system/etc/fonts.xml log noise for SDK 27 https://github.com/robolectric/robolectric/pull/6618
    • Add perf stats for reflector class definition https://github.com/robolectric/robolectric/pull/6624
    • Use Object to replace GnssAntennaInfo.Listener at ShadowLocationManager by @utzcoz in https://github.com/robolectric/robolectric/pull/6623
    • Trimming the localrepository string. by @Squadella in https://github.com/robolectric/robolectric/pull/6653
    • Merging the the separate Reflector interfaces for Message into one main interface. https://github.com/robolectric/robolectric/pull/6619
    • Remove OldClassInstrumentor https://github.com/robolectric/robolectric/pull/6621
    • Remove unnecessary ShadowLegacyMessage.isInUse https://github.com/robolectric/robolectric/pull/6626
    • Converting directlyOn(...) to @Direct with reflector(...) in ShadowWindow and ShadowPhoneWindow. https://github.com/robolectric/robolectric/pull/6625
    • Intercept calls to methods in {@link Socket} not present in the OpenJDK. https://github.com/robolectric/robolectric/pull/6622
    • Use bulk operations in copyPixels{to,from}Buffer https://github.com/robolectric/robolectric/pull/6628
    • Improve reflector caching using a regular HashMap https://github.com/robolectric/robolectric/pull/6629
    • Add shadow method ShadowLauncherApps#getShortcutConfigActivityList. https://github.com/robolectric/robolectric/pull/6631
    • Add OnPermissionChangedListener implementation to ShadowPackageManager. https://github.com/robolectric/robolectric/pull/6627
    • Update minSdkVersion to 14 in some integration_test manifests https://github.com/robolectric/robolectric/pull/6630
    • Merge InvokeDynamicClassInstrumentor into ClassInstrumentor https://github.com/robolectric/robolectric/pull/6632
    • Add a shadow method for PackageManager#getText which gets a String associated with package name and resource id. https://github.com/robolectric/robolectric/pull/6634
    • Pass through openInputStream calls for SCHEME_ANDROID_RESOURCE https://github.com/robolectric/robolectric/pull/6636
    • Names thread used by ShadowFileObserver to match behavior of FileObserver. https://github.com/robolectric/robolectric/pull/6640
    • Migrate from AnnotationValue#toString to auto-common's AnnotationValues.toString. https://github.com/robolectric/robolectric/pull/6638
    • Fix fidelity issue with Cursor.getBlob on a String column https://github.com/robolectric/robolectric/pull/6641
    • Remove InvokeDynamic perf stats https://github.com/robolectric/robolectric/pull/6644
    • Fix SQLiteDatabaseTest foreign key test to match Android behavior https://github.com/robolectric/robolectric/pull/6643
    • Add cardId support for ShadowEuiccManager. https://github.com/robolectric/robolectric/pull/6642
    • Add OnUidImportanceListener implementation to ShadowActivityManager and SCREEN_ON/SCREEN_OFF broadcasts to ShadowPowerManager. https://github.com/robolectric/robolectric/pull/6639
    • Instrument default interface methods https://github.com/robolectric/robolectric/pull/6645
    • Support Object array and Iterable as return type for single parameter by @utzcoz in https://github.com/robolectric/robolectric/pull/6696
    • Rebase PR 6265: Bounds check the correct variable. by @utzcoz in https://github.com/robolectric/robolectric/pull/6706
    • Remove allocation in ShadowCursorWindow.Data init by @al-broco in https://github.com/robolectric/robolectric/pull/6711
    • internal https://github.com/robolectric/robolectric/pull/6654
    • Add perfstats for ShadowSQLiteConnection https://github.com/robolectric/robolectric/pull/6659
    • Add support for startWatchingMode() with flags. https://github.com/robolectric/robolectric/pull/6661
    • Make isOpActive() public, so it can be used in tests below Android R. https://github.com/robolectric/robolectric/pull/6662
    • Add a sqlite test using LIKE ? ESCAPE ? https://github.com/robolectric/robolectric/pull/6666
    • Throw an exception if a query is performed using SQLiteDatabase.execSQL https://github.com/robolectric/robolectric/pull/6672
    • Add isAutoRevokeWhitelisted implementation to ShadowPackageManager. https://github.com/robolectric/robolectric/pull/6673
    • Add support for setting smart replies on ShadowRanking object, so getSmartRanking method can be used in tests. https://github.com/robolectric/robolectric/pull/6667
    • Use full class name in the SQLiteConnection shadow https://github.com/robolectric/robolectric/pull/6679
    • Improve NFC testability: https://github.com/robolectric/robolectric/pull/6587
    • Add experimental sqlite shadows derived from AOSP SQLite https://github.com/robolectric/robolectric/pull/6670
    • Exclude built-in config from being reloaded in Configuration registry https://github.com/robolectric/robolectric/pull/6680
    • Make legacy ShadowSQLiteConnection implementation methods protected https://github.com/robolectric/robolectric/pull/6681
    • Newly added shadow class for MediaStore is exposed to open source rebolectric library https://github.com/robolectric/robolectric/pull/6665
    • Update ShadowAppWidgetManager to better handle RemoteViews with multiple layouts https://github.com/robolectric/robolectric/pull/6677
    • Add shadow functionality for removing bonds(systemAPi) https://github.com/robolectric/robolectric/pull/6682
    • Add support for NetworkInfo.extraInfo to ShadowNetworkInfo https://github.com/robolectric/robolectric/pull/6683
    • Update default SQLite synchronous and journal modes https://github.com/robolectric/robolectric/pull/6687
    • Add a null check to ShadowCursorWindow.put{Blob,String} https://github.com/robolectric/robolectric/pull/6675
    • Add parameterized test name method to the test runner https://github.com/robolectric/robolectric/pull/6686
    • Add ability to uninstall app widgets to ShadowAppWidgetManager.java https://github.com/robolectric/robolectric/pull/6693
    • Add ShadowInetAddressUtil class https://github.com/robolectric/robolectric/pull/6694
    • Add @InlineMe to deprecated ShadowLooper APIs. https://github.com/robolectric/robolectric/pull/6689
    • Add @InlineMe to deprecated, inlineable APIs. https://github.com/robolectric/robolectric/pull/6455
    • Add setAnchor to ShadowAccessibilityWindowInfo https://github.com/robolectric/robolectric/pull/6699
    • Fix an ArrayIndexOutOfBoundsException in ByteBucketArray https://github.com/robolectric/robolectric/pull/6700
    • Add missing implementation for __android_log_assert https://github.com/robolectric/robolectric/pull/6701
    • Remove mocking from FragmentControllerTest https://github.com/robolectric/robolectric/pull/6703
    • Add API to retrieve Intent used to start SpeechRecognizer https://github.com/robolectric/robolectric/pull/6692
    • Update default SQLite synchronous mode when WAL is enabled https://github.com/robolectric/robolectric/pull/6690
    • Fix formatting in ShadowSQLiteConnectionsTest https://github.com/robolectric/robolectric/pull/6712
    • Add a SQLite mode that enables the new native Android SQLite shadows https://github.com/robolectric/robolectric/pull/6709
    • Use offset from BufferInfo instead of ByteBuffer for ShadowMediaMuxer#writeSampleData by @utzcoz in https://github.com/robolectric/robolectric/pull/6695
    • Support to open fd for uncompressed file in asset by @utzcoz in https://github.com/robolectric/robolectric/pull/6649
    • Update gradle wrapper to 7.2 by @utzcoz in https://github.com/robolectric/robolectric/pull/6738
    • Improve resetter for NfcAdapter and CardEmulation by @utzcoz in https://github.com/robolectric/robolectric/pull/6749
    • Remove debug print statement https://github.com/robolectric/robolectric/pull/6714
    • Fixes WindowInfo children not cloned in ShadowAccessibilityWindowInfo https://github.com/robolectric/robolectric/pull/6718
    • Clarify ShadowLooper.idle message when test fails. https://github.com/robolectric/robolectric/pull/6719
    • Skip ErrorProne on GitHub CI runs https://github.com/robolectric/robolectric/pull/6728
    • Migrate off deprecated mockito APIs https://github.com/robolectric/robolectric/pull/6729
    • Remove CircleCI metadata https://github.com/robolectric/robolectric/pull/6730
    • Fix ShadowMediaPlayer#prepare() to invoke prepared listener on handler instead of executing directly on calling thread. https://github.com/robolectric/robolectric/pull/6731
    • Delete ShadowBaseLooper https://github.com/robolectric/robolectric/pull/6733
    • Include stack trace in System.log[WE] calls. https://github.com/robolectric/robolectric/pull/6735
    • Implemented startForeground(int, Notification, int). https://github.com/robolectric/robolectric/pull/6717
    • Fix spurious CloseGuard errors in Surface and SurfaceControl https://github.com/robolectric/robolectric/pull/6739
    • Specify LEGACY SQLite mode for ShadowSQLiteConnectionTest https://github.com/robolectric/robolectric/pull/6746
    • Add CMake build for SQLite native artifacts by @hoisie in https://github.com/robolectric/robolectric/pull/6720
    • Deprecate ShadowSwipeRefreshLayout. by @utzcoz in https://github.com/robolectric/robolectric/pull/6710
    • Add CI job to check aggregateDocs by @utzcoz in https://github.com/robolectric/robolectric/pull/6748
    • Deprecate the supportv4 shadows as mentioned in #6185 by @alsutton in https://github.com/robolectric/robolectric/pull/6194
    • Rework api classification and enforcement. https://github.com/robolectric/robolectric/pull/6755
    • Add toString to ShadowApplication.Wrapper https://github.com/robolectric/robolectric/pull/6736
    • Use more conventional name for the native runtime library https://github.com/robolectric/robolectric/pull/6764
    • Add setWifiApConfiguration & getWifiApConfiguration to ShadowWifiManager https://github.com/robolectric/robolectric/pull/6763
    • Make IntentsTest work on device without browser. https://github.com/robolectric/robolectric/pull/6765
    • Merging HardwareRendererCompat fixes into one branch by @dmeng in https://github.com/robolectric/robolectric/pull/6773
    • Don't use HARDWARE bitmaps in Bitmap#createBitmap. https://github.com/robolectric/robolectric/pull/6766
    • Fix missing imports when building on Mac OSX. https://github.com/robolectric/robolectric/pull/6771
    • Update ShadowInCallService so that onCallAudioStateChanged callback is invoked when the audio route is changed. https://github.com/robolectric/robolectric/pull/6758
    • Reduce usage for this$0 by @utzcoz in https://github.com/robolectric/robolectric/pull/6760
    • Update nativeruntime CMake build to support Mac M1 by @hoisie in https://github.com/robolectric/robolectric/pull/6774
    • Use the display ID in the provided ActivityOptions when launching activities, instead of always using the default display. https://github.com/robolectric/robolectric/pull/6697
    • Add ctesque common tests to androidTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6570
    • Create a separate task to prefetch non-instrumented SDKs by @hoisie in https://github.com/robolectric/robolectric/pull/6778
    • Clarify error message if the SQLite submodule is missing by @hoisie in https://github.com/robolectric/robolectric/pull/6786
    • Make implementation classes protected on ShadowRenderNode by @hoisie in https://github.com/robolectric/robolectric/pull/6818
    • Support self notification callbacks for AppOpsManager https://github.com/robolectric/robolectric/pull/6788
    • Add a ShadowPackageBackwardCompatibility class to handle when multiple APIs are on the classpath https://github.com/robolectric/robolectric/pull/6790
    • Always look for tzdata in the corresponding android-all jar instead of the classpath https://github.com/robolectric/robolectric/pull/6789
    • Fix NPE when calling Path.arcTo with an invalid arc https://github.com/robolectric/robolectric/pull/6797
    • Add support to system flags on ShadowWindow https://github.com/robolectric/robolectric/pull/6792
    • Synchronize BinderService.getBinder https://github.com/robolectric/robolectric/pull/6807
    • Add a binder service for TELEPHONY_SERVICE in ShadowServiceManager. https://github.com/robolectric/robolectric/pull/6808
    • Add support for Android S https://github.com/robolectric/robolectric/pull/6776
    • Add a test for getting and setting the global animation duration https://github.com/robolectric/robolectric/pull/6809
    • Add supports of addOnActiveSessionsChangedListener with 3-arguments for ShadowMediaSessionManager. https://github.com/robolectric/robolectric/pull/6813
    • Bump AGP to 7.1.0-beta02 by @utzcoz in https://github.com/robolectric/robolectric/pull/6815
    • Default to native Android SQLite on the Mac M1 https://github.com/robolectric/robolectric/pull/6819
    • Update ShadowRenderNodeAnimator to direct reflector https://github.com/robolectric/robolectric/pull/6821
    • Turn off shadowOf generation for RoleControllerManager https://github.com/robolectric/robolectric/pull/6822
    • Deprecate the proxy version of directlyOn https://github.com/robolectric/robolectric/pull/6823
    • Update ShadowApplicationPackageManager.getPackageArchiveInfo to use reflector https://github.com/robolectric/robolectric/pull/6825
    • Migrate supportv4 shadows from directlyOn proxy to reflector https://github.com/robolectric/robolectric/pull/6826
    • Ensure that ShadowAccessibilityRecord fields are preserved during AccessibilityEvent copy. https://github.com/robolectric/robolectric/pull/6820
    • Migrate to use platform InstrumentationRegistry for LocalActivityInvoker by @utzcoz in https://github.com/robolectric/robolectric/pull/6787
    • Use direct reflector for AcccessibiltyRecord.init in https://github.com/robolectric/robolectric/pull/6831
    • Add ShadowTimePickerDialog.getIs24HourView in https://github.com/robolectric/robolectric/pull/6805
    • Add libicu as a git submodule by @hoisie in https://github.com/robolectric/robolectric/pull/6833
    • Disable the universal library for Mac OS by @hoisie in https://github.com/robolectric/robolectric/pull/6845
    • Bump asm to 9.2 by @utzcoz in https://github.com/robolectric/robolectric/pull/6844
    • Add workflow that builds native runtime and uploads artifacts by @hoisie in https://github.com/robolectric/robolectric/pull/6827

    New Contributors

    • @Squadella made their first contribution in https://github.com/robolectric/robolectric/pull/6653
    • @al-broco made their first contribution in https://github.com/robolectric/robolectric/pull/6711
    • @dmeng made their first contribution in https://github.com/robolectric/robolectric/pull/6773

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.6.1...robolectric-4.7

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.7-alpha-2(Nov 8, 2021)

  • robolectric-4.7-alpha-1(Nov 5, 2021)

  • robolectric-4.6.1(Jul 4, 2021)

    This is a minor release that fixes #6589, in which ShadowActivityManager contained a reference to android.app.ApplicationExitInfo, introduced in SDK 30, in public method. This caused shadowOf to fail if the target SDK was < 30. Thanks to @utzcoz for the fix and @jankowskib for reporting the issue.

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.6(Jul 2, 2021)

    Robolectric 4.6

    The highlights of this release are:

    • Uses preinstrumented jars by default, significantly decreasing startup time.
    • Massive fidelity improvements for Bitmap and BitmapFactory.
    • Tons of bug fixes and fidelity improvements.

    What's Changed

    • Add ShadowMagnificationController for N+ in https://github.com/robolectric/robolectric/pull/6140
    • Add ShadowSoftKeyboardController for N+ in https://github.com/robolectric/robolectric/pull/6138
    • Move debug class dump logic from ClassInstrumentor to SandboxClassLoader in https://github.com/robolectric/robolectric/pull/6162
    • Tweak ShadowTextToSpeech OnInitListener API in https://github.com/robolectric/robolectric/pull/6165
    • Lay the groundwork to use preinstrumented android-all jars in Robolectric. in https://github.com/robolectric/robolectric/pull/6163
    • Platform compatibility enhancements in https://github.com/robolectric/robolectric/pull/6166
    • Upgrade google-java-format to 1.9 by @utzcoz in https://github.com/robolectric/robolectric/pull/6172
    • Added gradle dependency version checker to the build by @alsutton in https://github.com/robolectric/robolectric/pull/6173
    • Update android support libraries to v28.0.0 by @alsutton in https://github.com/robolectric/robolectric/pull/6174
    • Synchronize Truth version being used to be v1.1.2 by @alsutton in https://github.com/robolectric/robolectric/pull/6175
    • ShadowInCallService and ShadowPhone offer a method addCall() which adds a call in https://github.com/robolectric/robolectric/pull/6160
    • Deprecate RoboExecutorService. in https://github.com/robolectric/robolectric/pull/6170
    • Revert some recently added native method logic in ClassInstrumentor in https://github.com/robolectric/robolectric/pull/6168
    • Remove debug print statements from AndroidInterceptors in https://github.com/robolectric/robolectric/pull/6177
    • Consistently use reflection for accessing the "DURATIONS" array. in https://github.com/robolectric/robolectric/pull/6180
    • Deprecate TextLayoutMode. in https://github.com/robolectric/robolectric/pull/6181
    • Remove use of deprecated and redundant TextLayoutMode.REALISTIC,as its now the default behavior. in https://github.com/robolectric/robolectric/pull/6182
    • Fix deleting temp directories in https://github.com/robolectric/robolectric/pull/6187
    • Call ShadowBackupManager's getAvailableRestoreToken instead of framework's one as we already have implementation of that method in the shadow under the method: getPackageRestoreToken() in https://github.com/robolectric/robolectric/pull/6190
    • Add Support for startAsyncSection and endAsyncSection to ShadowTrace in https://github.com/robolectric/robolectric/pull/6184
    • Move AndroidConfigurer and AndroidInterceptors to sandbox project in https://github.com/robolectric/robolectric/pull/6183
    • Add visibility to ShadowTrace.AsyncTraceSection in https://github.com/robolectric/robolectric/pull/6192
    • Disable instrumenting AndroidX classes by default in https://github.com/robolectric/robolectric/pull/6188
    • Migrate CI checks from CircleCI to GitHub actions by @LitterSun in https://github.com/robolectric/robolectric/pull/6178
    • Fix typo and run tests on SDK 30 by @hoisie in https://github.com/robolectric/robolectric/pull/6196
    • Remove publish_test_results job by @hoisie in https://github.com/robolectric/robolectric/pull/6198
    • Fix some errorprone warnings by @utzcoz in https://github.com/robolectric/robolectric/pull/6204
    • Create a new ShadowFileObserver that implements (some of) FileObserver functionality for Robolectric in https://github.com/robolectric/robolectric/pull/6200
    • Make ShadowPackageManager.getPackageArchiveInfo extendable in https://github.com/robolectric/robolectric/pull/6202
    • Add a method to StreamConfigurationMapBuilder shadow class to support cameraX testing. in https://github.com/robolectric/robolectric/pull/6199
    • platform support in https://github.com/robolectric/robolectric/pull/6206
    • Shadow tone generator that implements a static state tracking mechanism for all played tones in https://github.com/robolectric/robolectric/pull/6208
    • update robolectric build.gradles to use latest androidx.test artifacts in https://github.com/robolectric/robolectric/pull/6207
    • Update ShadowBugreportManager with additional functionality: in https://github.com/robolectric/robolectric/pull/6213
    • Move overriding PolicyManager.makeNewWindow to ShadowPolicyManager in https://github.com/robolectric/robolectric/pull/6218
    • Add opt-in lazy loading of application+instrumentation in Robolectric in https://github.com/robolectric/robolectric/pull/6191
    • [LazyLoad] Explicitly make method config default to class config, and class config default to package config in https://github.com/robolectric/robolectric/pull/6214
    • Check framework jar path before calling AssetManager from ShadowResources in https://github.com/robolectric/robolectric/pull/6216
    • Add check to AndroidTestEnvironment.installAndCreateApplication to ensure that it is only called from the main thread in https://github.com/robolectric/robolectric/pull/6217
    • Fix syntax warning of build.gradle by @utzcoz in https://github.com/robolectric/robolectric/pull/6220
    • Restore JarInstrumentor in https://github.com/robolectric/robolectric/pull/6212
    • Clean up test code under shadows by @utzcoz in https://github.com/robolectric/robolectric/pull/6223
    • make ShadowContentResolver lazy load friendly in https://github.com/robolectric/robolectric/pull/6222
    • Make ShadowApplication.getInstance call RE.getApplication. in https://github.com/robolectric/robolectric/pull/6221
    • Switch to using preinstrumented android-all jars by default in https://github.com/robolectric/robolectric/pull/6227
    • Fix MavenDependencyResolverTest in restricted test environments in https://github.com/robolectric/robolectric/pull/6228
    • Move wakelock and dialog recording storage from ShadowApplication to their respective shadows. in https://github.com/robolectric/robolectric/pull/6229
    • Add setCounter functionality to ShadowTrace in https://github.com/robolectric/robolectric/pull/6226
    • Remove maxSdk=R config from test code in https://github.com/robolectric/robolectric/pull/6219
    • Ensure Bitmap.Config is set on the output after Bitmap.createBitmap in https://github.com/robolectric/robolectric/pull/6231
    • Robolectric ShadowCall: Adds hasSentRttRequest and hasRespondedToRttRequest functionality to the shadow. in https://github.com/robolectric/robolectric/pull/6232
    • Ensure Bitmap.Config is set on the output after Bitmap.createScaledBitmap in https://github.com/robolectric/robolectric/pull/6233
    • Slightly improve the fidelity of comparing scaled bitmaps in https://github.com/robolectric/robolectric/pull/6239
    • Add implementation for packageManager.getPermissionFlags and packageManager.updatePermissionFlags in https://github.com/robolectric/robolectric/pull/6235
    • Always return the result of BitmapFactory.finishDecode for SDK < 19 in https://github.com/robolectric/robolectric/pull/6241
    • Make RuntimeEnvironment.getActivityThread and ShadowDisplayManagerGlobal lazy load friendly in https://github.com/robolectric/robolectric/pull/6236
    • Move call to getApplicationContext() outside the runnable so that we don't try to load the application from a separate thread when lazy loading in https://github.com/robolectric/robolectric/pull/6244
    • Explicitly instantiate the application for the stub tests where we will assert on app state in https://github.com/robolectric/robolectric/pull/6243
    • Add support for setting-getting RatingType in ShadowMediaController in https://github.com/robolectric/robolectric/pull/6245
    • Create a shadow implementation of NotificationListenerService. in https://github.com/robolectric/robolectric/pull/6250
    • Add showSession to ShadowVoiceInteractionService in https://github.com/robolectric/robolectric/pull/6247
    • Init color array when decode for bitmap by @utzcoz in https://github.com/robolectric/robolectric/pull/6147
    • Init color array for decode file descriptor by @utzcoz in https://github.com/robolectric/robolectric/pull/6272
    • Migrate to preferred BugCheckerRefactoringTestHelper.newInstance overload in https://github.com/robolectric/robolectric/pull/6253
    • Propagate Bitmap.Options.isMutable to bitmap in https://github.com/robolectric/robolectric/pull/6249
    • Make dataChangeCount part of BackupManagerServiceState. in https://github.com/robolectric/robolectric/pull/6266
    • Upgrade ErrorProne and fix ErrorProne related build errors in https://github.com/robolectric/robolectric/pull/6267
    • Update FrameMetricsBuilder to explicitly set TOTAL_DURATION in https://github.com/robolectric/robolectric/pull/6257
    • Execute google-java-format-diff.py directly on CI machines in https://github.com/robolectric/robolectric/pull/6268
    • Clear ShadowBitmap description when eraseColor is called in https://github.com/robolectric/robolectric/pull/6254
    • Make Activity.getCallingPackage() and Activity.getCallingActivity() consistent. in https://github.com/robolectric/robolectric/pull/6256
    • Add basic implementation of Canvas.drawRect(Rect, Paint) in https://github.com/robolectric/robolectric/pull/6263
    • Improve the fidelity Canvas.drawBitmap(Bitmap, float, float, Paint) in https://github.com/robolectric/robolectric/pull/6261
    • Improve fidelity of ImageView.draw(Canvas) in https://github.com/robolectric/robolectric/pull/6264
    • Fix ShadowBitmapFactoryTest in non-Gradle environments by @hoisie in https://github.com/robolectric/robolectric/pull/6276
    • Keep ubuntu to ubuntu-18.04 on CI by @utzcoz in https://github.com/robolectric/robolectric/pull/6279
    • add test around ShadowDisplayManagerGlobal.getInstance in https://github.com/robolectric/robolectric/pull/6270
    • Use bulk api to set pixels by @utzcoz in https://github.com/robolectric/robolectric/pull/6299
    • Set lastAbandonedAudioFocusListener for AudioManager.abandonAudioFocusRequest and set OnAudioFocusChangeListener in AudioFocusRequest constructor. in https://github.com/robolectric/robolectric/pull/6275
    • Add ShadowBugreportManager.requestBugreport(). in https://github.com/robolectric/robolectric/pull/6274
    • Add implementation for getInstalledProvidersForPackage() to ShadowAppWidgetManager in https://github.com/robolectric/robolectric/pull/6240
    • Fix several NPEs in ShadowXMLBlock in https://github.com/robolectric/robolectric/pull/6294
    • Update ShadowLocationManager with intent broadcast behavior. in https://github.com/robolectric/robolectric/pull/6282
    • Always load application at start of RuntimeEnvironment.setQualifiers in https://github.com/robolectric/robolectric/pull/6285
    • Add a width and height check in Bitmap.createScaledBitmap in https://github.com/robolectric/robolectric/pull/6296
    • Directly use FrameMetrics.SWAP_BUFFERS_DURATION for the value of TOTAL_DURATION in https://github.com/robolectric/robolectric/pull/6290
    • Implement getPackagesForOps methods for ShadowAppOpsManager. by @hoisie in https://github.com/robolectric/robolectric/pull/6314
    • Add check for stride when calling bulk ShadowBitmap.getPixels in https://github.com/robolectric/robolectric/pull/6300
    • Make the Bitmap returned by Bitmap.createScaledBitmap mutable in https://github.com/robolectric/robolectric/pull/6303
    • Significantly improve the performance of BitmapFactory.decode* operations in https://github.com/robolectric/robolectric/pull/6291
    • Deprecate all public ShadowBitmapFactory methods in https://github.com/robolectric/robolectric/pull/6295
    • Remove the main thread check in installAndCreateApplication, as we don't see any problems when tests create from a background thread in https://github.com/robolectric/robolectric/pull/6304
    • Added missing overload for ShadowInstrumentation.execStartActivity. in https://github.com/robolectric/robolectric/pull/6307
    • Add ShadowPowerManager#setAdaptivePowerSaveEnabled. in https://github.com/robolectric/robolectric/pull/6312
    • Populate streamType and durationHint for AudioFocusRequest. in https://github.com/robolectric/robolectric/pull/6305
    • Add setUserRestriction() for ShadowUserManager in https://github.com/robolectric/robolectric/pull/6302
    • Return null from the old API for getPackagesForOps, to match it to what the real API does. in https://github.com/robolectric/robolectric/pull/6301
    • Add ShadowActivityThread.setCompatConfiguration to use instead of in https://github.com/robolectric/robolectric/pull/6306
    • Add option to not allow invalid image data in BitmapFactory.decode methods in https://github.com/robolectric/robolectric/pull/6310
    • Add the following to ShadowActivityThread in https://github.com/robolectric/robolectric/pull/6284
    • Add method that consumes and returns all service Intents. in https://github.com/robolectric/robolectric/pull/6252
    • Add mutable checking for ShadowBitmap.setPixels by @utzcoz in https://github.com/robolectric/robolectric/pull/6288
    • Add ShadowSensorManager#removeSensor by @utzcoz in https://github.com/robolectric/robolectric/pull/6318
    • Make RobolectricTestRunner#getConfiguration private by @utzcoz in https://github.com/robolectric/robolectric/pull/6319
    • Update ShadowBitmap to be backed by Java's BufferedImage in https://github.com/robolectric/robolectric/pull/6313
    • Use master thread scheduler to control legacy system clock directly, instead of going through ShadowApplication in https://github.com/robolectric/robolectric/pull/6315
    • Rename LazyLoadApplication to LazyApplication and update all references accordingly in https://github.com/robolectric/robolectric/pull/6316
    • Add a global view action listener system to ShadowView for the performClick() and performLongClick() functions. in https://github.com/robolectric/robolectric/pull/6269
    • fix one more LazyLoadApplication -> LazyApplication in https://github.com/robolectric/robolectric/pull/6322
    • Add test case for getting the outer object using reflector in https://github.com/robolectric/robolectric/pull/6328
    • Remove CachedDependencyResolver and CachedMavenDependencyResolver in https://github.com/robolectric/robolectric/pull/6323
    • Migrate jcenter to mavenCentral by @utzcoz in https://github.com/robolectric/robolectric/pull/6325
    • Change max sdk to R for ShadowIntrumentation#execStartActivityAsCaller by @utzcoz in https://github.com/robolectric/robolectric/pull/6320
    • Revert "Change max sdk to R for ShadowIntrumentation#execStartActivityAsCaller" by @hoisie in https://github.com/robolectric/robolectric/pull/6330
    • Udpate gradle dependencies by @utzcoz in https://github.com/robolectric/robolectric/pull/6341
    • Adds triggerOnEndOfSpeech to ShadowSpeechRecognizer. in https://github.com/robolectric/robolectric/pull/6336
    • Add deprecated tags to methods in SupportFragmentTestUtil. in https://github.com/robolectric/robolectric/pull/6334
    • Update ShadowLocationManager with R APIs. in https://github.com/robolectric/robolectric/pull/6340
    • Decouple Robolectric.getForegroundThreadScheduler from ShadowApplication in https://github.com/robolectric/robolectric/pull/6335
    • Add better concurrency support ShadowTypeface in https://github.com/robolectric/robolectric/pull/6348
    • Add support for two additional Bitmap.createBitmap methods in https://github.com/robolectric/robolectric/pull/6352
    • Fix ShadowResources.getSystem to fully update configuration/displayMetrics when the application is not yet loaded (@LazyApplication) in https://github.com/robolectric/robolectric/pull/6349
    • ShadowAppWidgetManager: Added support for setting appWidgetOptions Bundle in https://github.com/robolectric/robolectric/pull/6354
    • Explicitly load the application from the test rule if the test will run from a background thread in https://github.com/robolectric/robolectric/pull/6343
    • Consolidate some Bitmap.createBitmap @Implementation methods in https://github.com/robolectric/robolectric/pull/6355
    • Add PerfStats around installAndCreateApplication in https://github.com/robolectric/robolectric/pull/6356
    • ShadowAppWidgetManager added implementation for isRequestPinAppWidgetSupported. in https://github.com/robolectric/robolectric/pull/6358
    • Add setImportance and getImportance in ShadowNotificationManager in https://github.com/robolectric/robolectric/pull/6360
    • Adding UserManager support for getSerialNumbersOfUsers on N+. in https://github.com/robolectric/robolectric/pull/6362
    • Skip staged resources in the legacy resource system in https://github.com/robolectric/robolectric/pull/6364
    • Extend shadow of RoleManager (Android Q+) to support IsRoleAvailable() in https://github.com/robolectric/robolectric/pull/6365
    • Add perf stat for defining ProxyMaker classes in https://github.com/robolectric/robolectric/pull/6371
    • Lazily create the WebViewFactoryProvider proxy in ShadowWebView in https://github.com/robolectric/robolectric/pull/6368
    • Ensure that the Bitmap returned by Bitmap.extractAlpha is mutable in https://github.com/robolectric/robolectric/pull/6366
    • Allow ShadowSmsManager to be extended in https://github.com/robolectric/robolectric/pull/6370
    • Allow ShadowNotificationListenerService.addActiveNotification on given StatusBarNotification objects directly in https://github.com/robolectric/robolectric/pull/6375
    • Avoid shadowing a constructor to get a Context object by @hoisie in https://github.com/robolectric/robolectric/pull/6378
    • Use BufferedImage to scale bitmap by @utzcoz in https://github.com/robolectric/robolectric/pull/6280
    • Improve naming of a ShadowAppWidgetManager shadow API method in https://github.com/robolectric/robolectric/pull/6384
    • Run Java formatting on RoboCookieManager in https://github.com/robolectric/robolectric/pull/6386
    • Expose the number of times NotificationListenerService#requestUnbind() is called. in https://github.com/robolectric/robolectric/pull/6385
    • Make synchronization in ShadowContentResolver finer-grained to avoid a potential deadlock in https://github.com/robolectric/robolectric/pull/6374
    • Fix a memory leak when destroying an activity. in https://github.com/robolectric/robolectric/pull/6379
    • Use the stored Context in ShadowActivityManager in https://github.com/robolectric/robolectric/pull/6394
    • Allow ShadowUsageStatsManager to record events happening at the same timestamp. in https://github.com/robolectric/robolectric/pull/6390
    • Prefer the stored Application and Instrumentation in ShadowActivityThread in https://github.com/robolectric/robolectric/pull/6396
    • Update MemoryLeaksTest to be extendable in https://github.com/robolectric/robolectric/pull/6388
    • Use the stored Context in ShadowContentResolver in https://github.com/robolectric/robolectric/pull/6392
    • Add a way to set ValueAnimator duration scales in https://github.com/robolectric/robolectric/pull/6401
    • Decouple legacy background thread scheduler from ShadowApplication in https://github.com/robolectric/robolectric/pull/6399
    • Add support for AppOpsManager.checkOp in ShadowAppOpsManager in https://github.com/robolectric/robolectric/pull/6405
    • Allow expecting non-deterministic log messages using a regular expression pattern. in https://github.com/robolectric/robolectric/pull/6391
    • Fix potential NPE in RequestMatcherBuilder in https://github.com/robolectric/robolectric/pull/6400
    • Change @LazyApplication package to explicitly mark it as still experimental in https://github.com/robolectric/robolectric/pull/6403
    • Added support for requestPinAppWidget to ShadowAppWidgetManager. in https://github.com/robolectric/robolectric/pull/6395
    • Support custom futures in ShadowLegacyAsyncTask subclasses in https://github.com/robolectric/robolectric/pull/6410
    • Add perf stat around ProxyMaker instance creation in https://github.com/robolectric/robolectric/pull/6413
    • Add PhoneStateListner callback in setServerState. in https://github.com/robolectric/robolectric/pull/6416
    • Add shadow implementation for BluetoothAdapter.getLeMaximumAdvertisingDataLength in https://github.com/robolectric/robolectric/pull/6419
    • Update ShadowImsMmTelManager.createForSubscriptionId to call real impl in https://github.com/robolectric/robolectric/pull/6422
    • Use internal system API Builder in BrightnessChangeEventBuilder in https://github.com/robolectric/robolectric/pull/6423
    • Update ShadowAccessibilityButtonControllerTest to attach the service in https://github.com/robolectric/robolectric/pull/6427
    • Update StorageVolumeBuilder for upcoming platform changes in https://github.com/robolectric/robolectric/pull/6428
    • Prepare for upcoming platform changes in FrameMetricsBuilder in https://github.com/robolectric/robolectric/pull/6426
    • Add support for registerCallbackWithEventMask in ShadowDisplayManagerGlobal in https://github.com/robolectric/robolectric/pull/6425
    • Make ShadowTelecomManager#createLaunchEmergencyDialerIntent resilient to internal platform in https://github.com/robolectric/robolectric/pull/6432
    • Set maxSdk in ShadowLauncherAppsTest.testGetActivityList to R in https://github.com/robolectric/robolectric/pull/6434
    • Temporarily make WifiUsabilityStatsEntryBuilder extensible. in https://github.com/robolectric/robolectric/pull/6424
    • Allow use of ShadowSystemVibrator.recordVibratePattern for subclasses. in https://github.com/robolectric/robolectric/pull/6431
    • Add platform dependent features/implementations to ShadowRangingResult in https://github.com/robolectric/robolectric/pull/6408
    • Add a test for ShadowFontBuilder in https://github.com/robolectric/robolectric/pull/6440
    • Make ShadowAudioManager.createAudioPlaybackConfiguration extendable in https://github.com/robolectric/robolectric/pull/6429
    • Update ShadowUsageStatsManager to @AutoValue. in https://github.com/robolectric/robolectric/pull/6393
    • Use the real implementation of BlueoothAdapter.getDefaultAdapter in https://github.com/robolectric/robolectric/pull/6417
    • Convert ShadowAsyncTaskBridge to reflector in https://github.com/robolectric/robolectric/pull/6404
    • Save the last PendingIntent.onFinished callback passed to send in in https://github.com/robolectric/robolectric/pull/6414
    • Use ShadowBluetoothAdapter state to implement enable/disable/isEnabled in https://github.com/robolectric/robolectric/pull/6421
    • Prepare for Activity handling changes in platform. in https://github.com/robolectric/robolectric/pull/6435
    • Add a getter and setter for CreateManageBlockedNumbersIntent in ShadowTelecomManager in https://github.com/robolectric/robolectric/pull/6444
    • create ShadowVoiceInteractor for android.app.VoiceInteractor in robolectric shadows in https://github.com/robolectric/robolectric/pull/6430
    • Add PerfStats to ShadowChoreographer.doFrame by @hoisie in https://github.com/robolectric/robolectric/pull/6446
    • Use real Android framework code to create BluetoothLeScanner objects in https://github.com/robolectric/robolectric/pull/6437
    • Update ShadowPhone to use the call list in Phone in https://github.com/robolectric/robolectric/pull/6373
    • Include image data in the result of Bitmap.createBitmap with a source Bitmap in https://github.com/robolectric/robolectric/pull/6381
    • Initialize the background thread scheduler from the main thread in https://github.com/robolectric/robolectric/pull/6406
    • Remove redundant integration test. in https://github.com/robolectric/robolectric/pull/6382
    • Adds a getId() method to ShadowCall. in https://github.com/robolectric/robolectric/pull/6372
    • Support to handle emoji in xml by @utzcoz in https://github.com/robolectric/robolectric/pull/6456
    • Don't call real TelephonyManager#requestCellInfoUpdate. in https://github.com/robolectric/robolectric/pull/6449
    • Make RoboMonitoringInstrumentation inherit from Instrumentation directly in https://github.com/robolectric/robolectric/pull/6398
    • getUserProfiles should return associated profiles when called from profile itself in https://github.com/robolectric/robolectric/pull/6450
    • Update ShadowRangingResult for S in https://github.com/robolectric/robolectric/pull/6442
    • Add ability to dump ProxyMaker generated classes in https://github.com/robolectric/robolectric/pull/6448
    • Shadow additional ShortcutManager methods to prevent NPEs. in https://github.com/robolectric/robolectric/pull/6453
    • Internal in https://github.com/robolectric/robolectric/pull/6457
    • Simplify and future proof ShadowSpeechRecognizer#startListening. in https://github.com/robolectric/robolectric/pull/6461
    • Add basic Robolectric support for EGL14 in https://github.com/robolectric/robolectric/pull/6454
    • Use real method for BluetoothAdapter#getBluetoothLeAdvertiser. in https://github.com/robolectric/robolectric/pull/6464
    • Migrate from deprecated JsonParser APIs to their replacements. in https://github.com/robolectric/robolectric/pull/6466
    • Separate properties of ShadowLog with new lines (instead of commas) in toString() to make it easier to see boundaries of the message and throwable message + other misc cleanups. in https://github.com/robolectric/robolectric/pull/6463
    • Add enableCarMode(priority, flags) to ShadowUIModeManager. in https://github.com/robolectric/robolectric/pull/6445
    • Remove ShadowBluetoothAdapter.getBluetoothLeAvertiser in https://github.com/robolectric/robolectric/pull/6472
    • Remove usage of InstrumentationProvider in AndroidTestEnvironment in https://github.com/robolectric/robolectric/pull/6467
    • Use setup prepared fields for ShadowActivityManagerTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6447
    • Migrate tests from ShadowResourcesTest to ResourcesTest by @utzcoz in https://github.com/robolectric/robolectric/pull/6473
    • Bump bouncycastle to 1.68 by @utzcoz in https://github.com/robolectric/robolectric/pull/6509
    • Fixes an error when mocking a generic method with Mockk by @ogolberg in https://github.com/robolectric/robolectric/pull/6516
    • Eagerly instantiate ActivityThread's main handler in https://github.com/robolectric/robolectric/pull/6470
    • Shadow nativeGetTagsEnabled in https://github.com/robolectric/robolectric/pull/6468
    • Migrate from deprecated Assert.assertThat([String, ]T, Matcher<T>) to MatcherAssert.assertThat([String, ]T, Matcher<T>). in https://github.com/robolectric/robolectric/pull/6465
    • Change access of ShadowUIModeManager methods from public to protected. in https://github.com/robolectric/robolectric/pull/6474
    • Update shadow implementation for ActivityManager.getHistoricalProcessExitReasons() in https://github.com/robolectric/robolectric/pull/6451
    • Avoid a deadlock when an exception is thrown from an IdlingRunnable in https://github.com/robolectric/robolectric/pull/6483
    • Add a few missing override implementations for startOpNoThrow and noteProxyOpNoThrow to ShadowAppOpsManager. in https://github.com/robolectric/robolectric/pull/6471
    • Prepare for upcoming platform changes in BluetoothGatt in https://github.com/robolectric/robolectric/pull/6487
    • Add name to ShadowSqliteConnection worker in https://github.com/robolectric/robolectric/pull/6476
    • Include full exception stack trace in LogItem toString() in https://github.com/robolectric/robolectric/pull/6485
    • Exit Looper.loop() when paused loopers are quit from their own thread. in https://github.com/robolectric/robolectric/pull/6484
    • Update ShadowPaintTest to avoid Shadow.newInstanceOf in https://github.com/robolectric/robolectric/pull/6486
    • Prepare for upcoming platform changes in Activity in https://github.com/robolectric/robolectric/pull/6488
    • Add github action wrapper-validation-action by @utzcoz in https://github.com/robolectric/robolectric/pull/6164
    • Bump buildSrc AGP to 4.1.3 by @utzcoz in https://github.com/robolectric/robolectric/pull/6494
    • Remove ShadowIntrumentation#execStartActivityAsCaller by @utzcoz in https://github.com/robolectric/robolectric/pull/6332
    • Fix and update the ShadowBluetoothAdapter resetter in https://github.com/robolectric/robolectric/pull/6495
    • Add requestNetwork overloaded methods to ConnectivityManager in https://github.com/robolectric/robolectric/pull/6492
    • Update ShadowLocationManager with R APIs. in https://github.com/robolectric/robolectric/pull/6479
    • Allow createNotificationChannel(NotificationChannel) to update an existing channel in https://github.com/robolectric/robolectric/pull/6505
    • Fixed issue of Robolectric tests failing with x11 error. in https://github.com/robolectric/robolectric/pull/6489
    • Prepare for platform changes to WifiUsabilityStatsEntry in https://github.com/robolectric/robolectric/pull/6497
    • Prepare for platform changes in PendingIntent in https://github.com/robolectric/robolectric/pull/6511
    • Include ITetheringConnector as a service; otherwise TetheringManager creates a thread that polls forever looking for it. in https://github.com/robolectric/robolectric/pull/6510
    • Update Bootstrap display configs in setQualifiers if the application isn't already loaded in https://github.com/robolectric/robolectric/pull/6490
    • Move Robolectric-only resource tests back to ShadowResourcesTest by @hoisie in https://github.com/robolectric/robolectric/pull/6518
    • Upgrade AndroidX Test dependency to 1.4.0-beta01 by @hoisie in https://github.com/robolectric/robolectric/pull/6520
    • Restore test resources shortcuts.xml by @hoisie in https://github.com/robolectric/robolectric/pull/6519
    • Shadow BluetoothAdapter#setScanMode with duration in SDK 30 by @jselbo in https://github.com/robolectric/robolectric/pull/6524
    • Fix broken ShadowCookieManagerTest in https://github.com/robolectric/robolectric/pull/6535
    • Add test failure diagnostics as suppressed exceptions, rather than throwing a new exception. in https://github.com/robolectric/robolectric/pull/6496
    • Add count stats collection to reflection method calls in ReflectionHelpers in https://github.com/robolectric/robolectric/pull/6515
    • Implement isNotificationListenerAccessGranted(ComponentName componentName). in https://github.com/robolectric/robolectric/pull/6512
    • Updating error for unsupported background operations. in https://github.com/robolectric/robolectric/pull/6506
    • Modifying ShadowDisplayEventReceiver to avoid CloseGuard warning in tests. in https://github.com/robolectric/robolectric/pull/6504
    • Add capability to ShadowCameraManager to simulate disconnection events. in https://github.com/robolectric/robolectric/pull/6523
    • Support a fluent API in StorageVolumeBuilder in https://github.com/robolectric/robolectric/pull/6530
    • Update LazyApplication javadoc to remove references to Instrumentation in https://github.com/robolectric/robolectric/pull/6526
    • Modifying ShadowInputEventReceiver to avoid CloseGuard warnings during tests. in https://github.com/robolectric/robolectric/pull/6522
    • Add access to messages sent in ShadowContextHubClient in https://github.com/robolectric/robolectric/pull/6499
    • Add a Builder for PreciseDataConnectionState in https://github.com/robolectric/robolectric/pull/6538
    • Attempt #2 at properly propagating qualifiers when lazy loading in https://github.com/robolectric/robolectric/pull/6508
    • Prevent setting multiple cookies in a single call to RoboCookieManager#setCookie by @utzcoz in https://github.com/robolectric/robolectric/pull/6517
    • Squelch FragmentManager logging in BaseMemoryLeaksTest in https://github.com/robolectric/robolectric/pull/6536
    • Add the implementation of ShadowInputMethodManager#getInputMethodList(). in https://github.com/robolectric/robolectric/pull/6539
    • Restore LocaleList default after BootstrapTest.testUpdateDisplayResourcesWithDifferentLocale in https://github.com/robolectric/robolectric/pull/6540
    • Don't cause NPE because of sorting null package names. in https://github.com/robolectric/robolectric/pull/6537
    • Use a factory builder method in PreciseDataConnectionStateBuilder in https://github.com/robolectric/robolectric/pull/6544
    • Fix memory leaks that can occur with lazy loading enabled in https://github.com/robolectric/robolectric/pull/6543
    • Adding support for @Direct to replace directlyOn. in https://github.com/robolectric/robolectric/pull/6542
    • Remove dead code in RobolectricTest.java in https://github.com/robolectric/robolectric/pull/6551
    • Annotate tests requiring legacy looper with @LooperMode(LEGACY) instead of using assume(...) in https://github.com/robolectric/robolectric/pull/6550
    • Allows expecting certain tags with length > 23. in https://github.com/robolectric/robolectric/pull/6529
    • Add the implementation of ShadowInputMethodManager#sendAppPrivateCommand(). in https://github.com/robolectric/robolectric/pull/6549
    • Automated formatting for DisplayConfig and ShadowDisplay. in https://github.com/robolectric/robolectric/pull/6556
    • Use real constructor for ViewConfiguration in https://github.com/robolectric/robolectric/pull/6558
    • Add setPlaybackInfo() and implemented getPlaybackInfo() to ShadowMediaController.java. in https://github.com/robolectric/robolectric/pull/6553
    • Move test activities from integration_tests/ctesque into testapp in https://github.com/robolectric/robolectric/pull/6557
    • Fix ShadowBluetoothLeScanner support for nullable parameters. in https://github.com/robolectric/robolectric/pull/6547
    • Add display cutout to ShadowDisplay. in https://github.com/robolectric/robolectric/pull/6555
    • Refactor the ChoreographerReflector to use @Direct for the doFrame reflector call in https://github.com/robolectric/robolectric/pull/6561
    • Added RollbackInfoBuilder and PackageRollbackInfoBuilder to make rollback manager testing possible. in https://github.com/robolectric/robolectric/pull/6563
    • Refresh BuildCompatTest in https://github.com/robolectric/robolectric/pull/6565
    • Reset static LocaleList state after each test in https://github.com/robolectric/robolectric/pull/6560
    • Reset CameraManager related state after each test in https://github.com/robolectric/robolectric/pull/6566
    • Add a ctesque test for CookieManager in https://github.com/robolectric/robolectric/pull/6562
    • Adding support for @ReflectorObject. in https://github.com/robolectric/robolectric/pull/6533
    • Make ShadowWindowManagerGlobal.getWindowManagerService return the "real" service in https://github.com/robolectric/robolectric/pull/6571
    • Add more shadow methods for BluetoothManager to make testing possible in https://github.com/robolectric/robolectric/pull/6564
    • Add missed imports for testapp test Activity by @utzcoz in https://github.com/robolectric/robolectric/pull/6574
    • Use UTC time zone explicitly for isEpoch test by @utzcoz in https://github.com/robolectric/robolectric/pull/6575
    • Simplify PackageRollbackInfoBuilder build logic for SDK > Q in https://github.com/robolectric/robolectric/pull/6577
    • Simplify ShadowBluetoothLeScanner APIs related to getting scan params in https://github.com/robolectric/robolectric/pull/6573
    • Avoid reflection when constructing PorterDuffColorFilter objects in https://github.com/robolectric/robolectric/pull/6580
    • Avoid reflection when constructing Event objects in ShadowEventLog in https://github.com/robolectric/robolectric/pull/6579
    • Reset the locale to the initial value after each test in https://github.com/robolectric/robolectric/pull/6578
    • Add a shadow for InputMethodManager.getCurrentInputMethodSubtype in https://github.com/robolectric/robolectric/pull/6569
    • Remove deprecated ShadowBuild.Q in https://github.com/robolectric/robolectric/pull/6572
    • suppress RobolectricSystemContext violations in https://github.com/robolectric/robolectric/pull/6584
    • Add IIpSecService to the ShadowServiceManager. in https://github.com/robolectric/robolectric/pull/6582
    • Update to androidx.test 1.4.0 + espresso 3.4.0 in https://github.com/robolectric/robolectric/pull/6583
    • Running Google formatting on ShadowArscAssetManager files. by @hoisie in https://github.com/robolectric/robolectric/pull/6588
    • Add StatsLog Shadow. in https://github.com/robolectric/robolectric/pull/6585
    • Migrate the remainder of ActivityController to reflector in https://github.com/robolectric/robolectric/pull/6586

    New Contributors

    • @ogolberg made their first contribution in https://github.com/robolectric/robolectric/pull/6516

    Full Changelog: https://github.com/robolectric/robolectric/compare/robolectric-4.5.1...robolectric-4.6

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.6-alpha-2(Jun 11, 2021)

  • robolectric-4.6-alpha-1(May 9, 2021)

  • robolectric-4.5.1(Feb 2, 2021)

    This is a minor release that fixes a regression in 4.5 and removes some superfluous print statements. See https://github.com/robolectric/robolectric/pull/6187 and https://github.com/robolectric/robolectric/pull/6177 respectively for more details.

    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.5(Jan 22, 2021)

    Robolectric 4.5 adds support for Android API 30 (R final) and contains many bug fixes and other enhancements.

    More detailed release notes are forthcoming.

    For all changes view the comparison to 4.4.

    Use Robolectric:

    testCompile "org.robolectric:robolectric:4.5"
    
    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.5-beta-1(Jan 17, 2021)

  • robolectric-4.5-alpha-3(Nov 16, 2020)

  • robolectric-4.5-alpha-2(Nov 1, 2020)

  • robolectric-4.5-alpha-1(Sep 30, 2020)

  • robolectric-4.4(Aug 24, 2020)

    Robolectric 4.4 is a massive release in terms of improvements to Android compatibility. The most noticeable item in the release is that the new PAUSED looper mode is now the default. You can read about the PAUSED looper in more detail here: http://robolectric.org/blog/2019/06/04/paused-looper/.

    Note:

    1. Not all changes are listed in the release notes. There were many other minor changes (such as dependency version bumps) that weren't included in this list for brevity. For all changes view the comparison to 4.3.1.
    2. Some of the pull requests in this release may contain duplicate changes from other pull requests in this release. We apologize for this messy history, it was the result of some misconfigured code sync tool. We’ve taken measures to ensure it doesn’t happen any more.

    Use Robolectric:

    testCompile "org.robolectric:robolectric:4.4"
    

    SDK/JVM support

    • Add support for Android Q final (#5289, #5292)
    • Support running on Java 11 (#5479, #5805)
    • Support running on Java 13 (#5550, #5786, #5805, #5819)

    Deprecations

    • Deprecate LooperMode LEGACY in favor of PAUSED (#5490), and default to PAUSED looper mode (#5491)
    • Accessibility checking is now deprecated and has been moved into a separate maven artifact org.robolectric:plugin-accessibility-deprecated. Accessibility checking will be removed entirely from Robolectric 4.5. Please switch to Espresso for accessibility checking. (#5547)
    • Deprecate ShadowContentResolver shadow API because they do not work with ContentProviderClient (#5376)
    • Deprecate ShadowLocationManager.getLocationUpdateListeners and ShadowLocationManager.getLocationUpdateListeners (#5150)
    • Make it an error to run on Q with an unsupported java version instead of just silently skipping tests (#5290)
    • Deprecate Robolectric's custom cursor implementation (#5613)
    • The BouncyCastle security provider is now considered deprecated due to the incompatibility with Java 9+ (#5849, #5850). This was preventing Robolectric tests (and Robolectric itself) from making HTTPS network requests on Java 9+. Long term the plan is to switch to Conscrypt.

    Android support / Robolectric test API improvements

    • Fix bug in ShadowImageDecoder.decodeBitmap (#4966)
    • Use real setting for WIFI_SCAN_ALWAYS_AVAILABLE (#4968)
    • Add a shadow for Font.Builder (#4993)
    • Add killProcess implementation to ShadowProcess (#4985)
    • Add a shadow for CallLog.Calls (#4996)
    • Add a shadow for CallScreeningService (#4997)
    • Add several shadows for camera2 classes (#4874)
    • Add option to avoid calling ShadowApplication.onServiceDisconnected in ShadowApplication.unbindService (#4979)
    • Add ability to simulate Bluetooth unavailable in ShadowBluetoothAdapter (#5002)
    • Implement ShadowApplicationPackageManager.getApplicationIcon(ApplicationInfo) (#5005)
    • Add ability to simulate SecurityExceptions in bindService (#4980)
    • Add ability to simulate enabled/disabled networks in ShadowWifiManager (#4974)
    • Add ability to simulate wifi usability system APIs in ShadowWifiManager (#5168)
    • Add null check in ShadowWifiManager.addNetwork (#5014)
    • Add shadow implementation of ShadowTelephonyManager#getDataState (#5003)
    • Fall back to Android's implementation of getResourcesForApplication (#4969)
    • Implement ShadowTypeface.equals and ShadowTypeface.hashCode (#4992)
    • Add ability to make ShadowContentResolver.registerContentObserver throw an exception (#4988)
    • Implement ShadowSubscriptionManager.getActiveSubscriptionInfoCountMax (#5010)
    • Add ability to set system dialer package in ShadowTelecomManager (#4986)
    • Implement ShadowSensorManager.registerListener 5-arg overload (#5014)
    • Add ability to get last flags set in ShadowUIModeManager (#5027)
    • Add a shadow for BluetoothA2dp (#5034)
    • Add shadow implementation for BluetoothDevice.createRfcommSocketToServiceRecord (#5034)
    • Add shadow implementations for BluetoothDevice.setPin and BluetoothDevice.setPairingConfirmation (and ability to get the values set) (#5116)
    • Adding shadow implementations of BluetoothDevice.getAlias and BlueToothDevice.getAliasName and related test APIs (#5222)
    • Adds the ability to get broadcast intents sent to a specific user (#5045)
    • Validate intents passed to start/stop/bindService (#5053)
    • Complete rewrite of ShadowLocationManager to improve fidelity (#5035, #5062, #5152, #5587, #5666)
    • Add ability to clear broadcast intents in ShadowContextWrapper (#5066)
    • Fix package name ShadowApplicationPackageManager's Activity Chooser (#5068)
    • Add shadow implementation for MediaPlayer#setDataSource(Context, Uri) (#5064)
    • Add shadow implementation for UserManager.getUserHandle(int) (#5065)
    • Add shadow implementations for DevicePolicyManager.setSystemUpdatePolicy and DevicePolicyManager.getSystemUpdatePolicy (#5069)
    • Remove ShadowOverscroller (#5081)
    • Add ability to simulate return value of AccessibilityService.getWindows list in ShadowAccessibilityService (#5083)
    • Fix bug in ShadowParcel.writeByteArray (#5089)
    • Add shadow implementation for UserManager.getUserName (#5099)
    • Improve fidelity of ShadowTime#parse3339 (#5101)
    • Add shadow for BiometricManager (#5072)
    • Propagate RemoteException from Binder#onTransact method (#4984)
    • Add shadow for android.service.notification.NotificationListenerService.Ranking (#5113)
    • Add support for VibrationEffect.Prebaked in ShadowSystemVibrator (#5119
    • Add the ability to set Tx and Rx packets/bytes for ShadowTrafficStats (#5121)
    • Add shadow implementation for Activity.getCallingPackage (and the ability to set it) (#5126)
    • Add shadows for several telephony classes (android.telecom.Call, android.telecom.InCallAdapter, android.telecom.InCallService, android.telecom.Phone) (#5107)
    • Improve fidelity of ShadowCookieManager.removeSessionCookies (#5130)
    • Improve fidelity of OpEntry.getTime() and OpEntry.getDuration() in Q (#5133)
    • Set default NetworkCapabilities for the two Robolectric created Networks (#5129)
    • Set the mimetype in ShadowBitmapFactory.decodeStream() (#5128)
    • Add module support for ShadowPackageManager and ShadowApplicationPackageManager (#5136)
    • Add the ability to set the external storage directory in ShadowEnvironment (#5140)
    • Add support for the dataChanged API in ShadowBackupManager (#5137)
    • Add ShadowContentResolver.registerInputStreamSupplier (#5142)
    • Notify settings ContentResolver when settings change (#5138)
    • Include size and mtime members in Os.stat variants (#5148)
    • Implement ShadowInstrumentation.execStartActivity variant with UserHandle (#5096)
    • Add ability to add entries to ShadowDropBoxManager (#5160)
    • Fix ShadowSigningInfo parceling (#5163)
    • Add ability to set Build.VERSION.SECURITY_PATCH (#5173), Build.PRODUCT (#5304), Build.BRAND (#5566), and Build.HARDWARE (#5619)
    • Add support for DisplayManager BrightnessConfiguration APIs (#5170)
    • Add ability to simulate location power save modes in ShadowPowerManager (#5176)
    • Add shadow method and test API for PowerManager.isLightDeviceIdleMode (#5226)
    • Add support for Android Q usb port statuses in ShadowUsbManager (#5175)
    • Add ability to simulate sending and downloading multimedia messages in ShadowSmsManager (#5177)
    • Add ability to query the number of times a WebView was reloaded (#5182)
    • Add ability to simulate WebViewClient and WebViewClient callbacks on page loads (#5188, #5199)
    • Add shadow method for WebView.getTitle (#5200)
    • Add test APIs to check if WebViewDatabase.clearFormData was called (#5201)
    • Add ability to override autofill service component name to ShadowAutofillManager (#5181)
    • Add ability to construct AttestedKeyPair objects (#5183)
    • Add shadow method for CameraCaptureSessionImpl.capture (#5191)
    • Add shadow method and test APIs for MediaScannerConnection.scanFile (#5178)
    • Add synchronous support to ShadowMediaCodec and the ability to apply fake codecs (#5195)
    • Add shadow methods for CameraParameters metering and focus areas and test APIs (#5189)
    • Add shadow method for AudioManager.getActiveRecordingConfigurations and test APIs (#5198)
    • Add ShadowAudioRecord (#5202, #5789)
    • Add several shadow methods for SliceManager (#5227)
    • Add shadow methods for new Android Q variants of setPackagesSuspended (#5135)
    • Add shadow method and test APIs for AccessibilityManager.sendAccessibilityEvent (#5192)
    • Add ability to log time in ShadowLog (#5224)
    • Add shadow for SuspendDialogInfo system API (#5232)
    • Add shadow method for PackageManager.canonicalToCurrentPackageNames and the ShadowPackageManageraddCanonicalName test API (#5233)
    • Add better support for camera2 CaptureRequestBuilder (#5230)
    • Add shadow method for Os.sysconf and a shadow API to set sysconf values (#5247)
    • Add shadow method for PackageManager.setDistractingPackageRestrictions and shadow API to get the set value (#5248)
    • Add shadow method for Bitmap.extractAlpha(Paint, int[]) (#5240)
    • Add the ability to set the user id in ContextImpl (#5253)
    • Fix some bugs in ShadowStorageManager StorageVolume logic (#5251, #5250)
    • Add shadow method for Trace.isEnabled and shadow API to toggle the value (#5256)
    • Fix infinite loop when using CameraManager (#5269)
    • Add shadow class for MediaController (#5266, #5395)
    • Add shadow method for MediaMetadataRetriever.setDataSource and a shadow API to add bitmaps to a data source (#5279)
    • Add shadow method for MediaMetadataRetriever.getScaledFrameAtTime and the ability to set scaled frames (#5279)
    • Add shadow method for BluetoothDevice.getBluetoothClass and the ability to set the bluetooth class (#5277)
    • Add shadow methods for PendingIntent.readPendingIntentOrNullFromParcel and PendingIntent.writePendingIntentOrNullToParcel (#5283)
    • Improve fidelity of AccessibilityWindowInfo.equals (#5278)
    • Add shadow methods for DevicePolicyManager.bindDeviceAdminServiceAsUser and DevicePolicyManager.getBindDeviceAdminTargetUsers and a shadow API to set the authorized users for these methods (#5287)
    • Add shadow method for ContextImpl.getExternalCacheDirs (#5288)
    • Add shadow method for WebSettings.getDefaultUserAgent to prevent crash (#5294)
    • Add shadow method for MediaBrowserCompat.getSessionToken (#5301)
    • Add shadow method for VMRuntime.getCurrentInstructionSet and shadow API to set the current instruction set (#5318)
    • Add shadow methods for PowerManager.getCurrentThermalStatus, PowerManager.addThermalStatusListener, PowerManager.removeThermalStatusListener. Athermal, and a shadow API to set the current thermal status (#5297)
    • Add support for opening a ParcelFileDescriptor in truncate and append modes (#5322)
    • Add shadow method for UserManager.isUserUnlocked(UserHandle) and shadow API to set user unlocked status (#5323)
    • Improve fidelity of DateFormat.get*DateFormat( #5314)
    • Add shadows for ContextHubManager and ContextHubClient (#5340, #5399)
    • Add support for AudioPlaybackCallback in ShadowAudioManager (#5342)
    • Update many ShadowUserManager methods to support profiles and add shadow method for UserManager.isManagedProfile(int) (#5346)
    • Add shadow for RoleManager (#5357)
    • Add shadow method for AccountManager.addOnAccountsUpdatedListener and shadow API to notify the listeners (#5347)
    • Add shadow API to get AccountManager OnAccountsUpdateListeners (#5361)
    • Add shadow method TelephonyManager.requestCellInfoUpdate and a shadow API to set the cell infos for the callbacks (#5355)
    • Add shadow method for MediaCodec.getOutputFormat and the ability to set the output format (#5372)
    • Add shadow method for AudioManager.isBluetoothScoAvailableOffCall and shadow API to set the value (#5364)
    • Add more complete shadow implementation for TelecomManager.placeCall and shadow API to query information about outgoing calls (#5373)
    • Add shadow APIs for allowing and denying calls to ShadowTelecomManager (#5374)
    • Add shadow method for CrossProfileApps.startActivity and shadow APIs to peek/get/clear the started activities (#5387)
    • Add shadow API to get all available loopers (#5371)
    • Add shadow for android.media.AudioTrack (#5379)
    • Add shadow for android.media.MediaCodecList (#5390, #5699)
    • Add shadow methods for View.addOnAttachStateChangeListener and View.removeOnAttachStateChangeListener and test API to get the OnAttachStateChangeListeners (#5401)
    • Throw IllegalArgumentException in PackageManager.getInstallerPackageName if package name is not installed (#5403)
    • Add shadow method for PackageManager.getUnsuspendablePackages (#5406)
    • Add static factory method ShadowSensorManager.createSensorEvent(int, int) that takes a sensor type (#5398)
    • Add shadow method for TelephonyManager.isRttSupported and a test API to set whether or not Rtt is supported (#5411)
    • Add shadow methods for NfcAdapter.enableReaderMode, NfcAdapter.disableReaderMode, and some shadow API to work with reader mode (#5405)
    • Add shadow for UserManager#isQuietModeEnabled (#5416)
    • Improve fidelity of MediaCodec.dequeueOutputBuffer (#5409, #5466)
    • Add shadow methods for AutofillManager.isAutofillSupported and AutofillManager.isEnabled and shadow API to set values returned (#5408)
    • Add shadow method for WifiRttManager.isAvailable (#5429)
    • Add shadow method for AccessibilityService.dispatchGesture and some shadow API to toggle and get the dispatched gestures (#5441)
    • Add shadow method for Adding TelephonyManager.sendDialerSpecialCode and shadow API to get the values sent (#5444)
    • Improve fidelity of Path copy constructor shadow implementation (#5444)
    • Add shadow method for AppOpsManager.java.unsafeCheckOpRawNoThrow (#5448)
    • Add shadow method for TelephonyManager.isHearingAidCompatibilitySupported and a shadow API method to set the value returned (#5450)
    • Add shadow methods for DevicePolicyManager.getAffiliationIds and DevicePolicyManager.setAffiliationIds (#5452)
    • Add shadow method for Canvas.drawRoundRect and shadow API to get information about the drawn round rects (#5451)
    • Add shadow method for UserManager.getProfileParent (#5457)
    • Add shadow method for DevicePolicyManager.isDeviceProvisioned and shadow API to set the value returned (#5461)
    • Add shadow methods for DevicePolicyManager.getPermissionPolicy and DevicePolicyManager.setPermissionPolicy in ShadowDevicePolicyManager (#5453)
    • Add a Configurer plugin that changes the behavior of the PackageManager.html.getInstallerPackageName shadow method to throw an exception (instead of returning null), which is consistent with real Android (#5465)
    • Add shadow API to optionally enforce a notification limit to NotificationManager.notify (#5467)
    • Fix triggering broadcasts from explicit intents if data on intent is specified (#5482)
    • Add shadow for android.telephony.ims.ImsMmTelManager system service and shadow API to set various pieces of state on the shadow (#5483, #5497)
    • Make ShadowTrace sections thread aware (#5494)
    • Fix permission check when matching broadcast receivers (#5495)
    • Refactor ShadowWrangler to delegate to a ShadowMatcher for making SDK-level decisions (f5371b525887dba3fc49f4d7765c88df8d11825a, dda47090be7dfdbd831397f3fa41c4dff25c24b4)
    • Add shadow for android.media.MediaActionSound and shadow API to get the play counts (#5500)
    • Add shadow method for DownloadManager#setDestinationInExternalPublicDir (#5489)
    • Include StatusBarNotification post times in ShadowNotificationManager (#5519)
    • Add a more complete shadow method for TelecomManager.getDefaultOutgoingPhoneAccount and shadow API to to set (and reset) the default outgoing phone account (#5524)
    • Add shadow method for BluetoothAdapter.isLeExtendedAdvertisingSupported and shadow API to set the value returned (#5515)
    • Add shadow methods for AudioManager.registerAudioPolicy and AudioManager.unregisterAudioPolicy system APIs and shadow API to get information about the audio policies (#5538)
    • Add shadow methods for TrafficStats.setThreadStatsTag and TrafficStats.getThreadStatsTag (#5541)
    • Create separate cache directory for getExternalCacheDir instead of using the external storage root directory (#5534)
    • Use provided executor in TelephonyManager.requestCellInfoUpdate and add shadow API to set the error details for the callback (#5543)
    • Add more complete shadow methods for UserManager.isQuietModeEnabled and UserManager.requestQuietModeEnabled and shadow API to set whether a profile is locked (#5555)
    • Add support for CameraManager.openCamera for older SDKs (21-27) (#5551)
    • Add shadow method for CameraDeviceImpl.close (which is used in CameraDevice.close) (#5552)
    • Add shadow method for ConnectivityManager.getRestrictBackgroundStatus and shadow API to set the returned value (#5556)
    • Add shadow for android.service.voice.VoiceInteractionService and shadow APIs to get set UI hints and set the active service (#5537)
    • Add shadow method for AudioManager.generateAudioSessionId that returns monotonically increasing values (#5559)
    • Add shadow methods for NotificationManager.{getNotificationDelegate,canNotifyAsPackage,setNotificationDelegate} and shadow API ShadowNotificationManager.canNotifyAsPackage (#5565, #5573)
    • Add shadow method for PackageManager.getPackagesHoldingPermissions (#5568)
    • Add shadow method for TelephonyManager.getSimLocale and shadow API to set the returned value (#5582)
    • Add shadow method ConnectivityManager.getProxyForNetwork and shadow API to set the returned value (#5570)
    • Add shadow method for TelephonyManager.getDataNetworkType and shadow API to set the retired value (#5581)
    • Add shadow method for Paint.setUnderlineText (#5585)
    • Add support for MenuItem.setActionView(int) (#5603)
    • Add support for writing and reading FileDescriptors in Parcel. Specifically this adds shadow methods for Parcel.nativeWriteFileDescriptor and Parcel.nativeReadFileDescriptor (#5588)
    • Add shadow methods for DevicePolicyManager.isDeviceProvisioningConfigApplied and DevicePolicyManager.isDeviceProvisioningConfigApplied (#5599)
    • Better support reading/writing SharedMemory objects to Parcels (#5612, #5756)
    • Add shadow method for GradientDrawable.setStroke and shadow API methods to get the information about the stroke. (#5589)
    • Add shadow API for setting default user agent in ShadowWebSettings (#5615)
    • Add shadow method for TelephonyManager.isVoiceCapable and shadow API to set the value returned (#5606)
    • Add shadow method for Android P Typeface.create static factory method (#5616)
    • Add rudimentary support for Paint#breakText (#5607)
    • Add shadow methods for Environment.isExternalStorageLegacy (both no-arg and 1-arg variants) and shadow API to set the value returned (#5617)
    • Add shadow for android.service.voice.VoiceInteractionSession and many shadow API methods to work with the type (#5595)
    • Add shadow method for TelephonyManager.getCarrierIdFromSimMccMnc and a shadow API method to set the value returned (#5618)
    • Add shadow methods for WebView.goForward and WebView.canGoForward and shadow API to get the number of invocations of goForward (#5620)
    • Add shadow method for WebView.getHitTestResult and shadow API to set the value returned (#5630)
    • Add shadow for android.content.rollback.RollbackManager system API and some shadow API methods to get rollback information (#5621)
    • Add shadow for android.media.audiofx.DynamicsProcessing and make significant improvements to ShadowAudioEffect (#5591)
    • Add support for System.logW (#5634)
    • Add ShadowCamera.removeCamera shadow API for removing cameras (#5651)
    • Add an implementation for async setCookie to RoboCookieManager (#5653)
    • Support ADJUST_LOWER and ADJUST_RAISE in AudioManager.adjustStreamVolume shadow method (#5650)
    • Add shadow for android.bluetooth.le.BluetoothLeScanner and add shadow API to BluetoothAdapter to work with BluetoothLeScanner (#5659)
    • Add shadow method for TileService.startActivityAndCollapse(Intent) (#5664)
    • Add shadow API method ShadowWebView.pushEntryToHistory(String) to improve fidelity of history in a WebView (#5654)
    • Add builders for android.media.MediaCodecInfo and android.media.MediaCodecInfo.CodecCapabilities and a shadow API method ShadowMediaCodecList.addCodec (#5705)
    • Update DeviceConfig to populate additional display metrics (#5706)
    • Improve fidelity of Activity#requestPermissions behavior (#5707)
    • Update ShadowPausedAsyncTaskLoader to allow setting a custom executor (#5708)
    • Improve fidelity of password tokens in DevicePolicyManager (#5693)
    • Add shadow methods for BluetoothA2dp.getConnectedDevices and BluetoothA2dp.getDevicesMatchingConnectionStates and shadow API to set the values returned (#5681)
    • Add shadow for android.media.RingtoneManager (#5689)
    • Add shadow method for MediaCodec.native_flush (to support MediaCodec.flush) (#5698)
    • Add shadow methods for BluetoothHeadset.{startVoiceRecognition,stopVoiceRecognition,isAudioConnected} (#5660)
    • Add shadow for android.os.BugreportManager and some shadow API to query state and trigger callbacks for bug reports #5675)
    • Fix handling of null admin in DevicePolicyManager.isUninstallBlocked() (#5720)
    • Implement shadow method for ApplicationPackageManager.isInstantApp (#5725)
    • Improve fidelity related to input buffer ownership in ShadowMediaCodec (#5719)
    • Update ShadowSensorManager to support listeners registering more than one sensor type, as well as a shadow API method to query the registration for a (listener, sensor) pair (#5735)
    • Add shadow method for ContentResolver.query(Uri uri, String[], Bundle, CancellationSignal) (#5729)
    • Add SubscriptionInfoBuilder.setMcc and fix SubscriptionInfoBuilder.setMnc for SDK < Q (#5736)
    • Add shadow method for LauncherApps.isPackageEnabled (#5691)
    • Add shadow for android.media.session.MediaSessionManager (#5741)
    • Add shadow methods for WallpaperManager.setBitmap and WallpaperManager.getWallpaperFile and a shadow API method to get the set bitmap (#5750)
    • Add shadow methods for Android N system APIs ContextHubManager.getContextHubHandles and ContextHubManager.getContextHubInfo (#5760)
    • Add shadow method for Activity.reportFullyDrawn and shadow API to check whether this method has been called
    • Add shadow methods for UsageStatsManager.registerAppUsageLimitObserver, UsageStatsManager.unRegisterAppUsageLimitObserver, and shadow API to get the observers and trigger them (#5770)
    • Add shadow methods for DevicePolicyManager.{getShort,setShort,getLong,setLong}SupportMessage (#5776)
    • Add shadow methods for WallpaperManager.isWallpaperSupported and WallpaperManager.isSetWallpaperAllowed and shadow API to set the values returned (#5765)
    • Add shadow for android.net.wifi.aware.WifiAwareManager, which includes the ability to create WiFI aware sessions (#5766)
    • Add shadow method for LauncherApps.getActivityList and test API to set the values returned (#5771)
    • Add shadow method for TileService#isLocked and shadow API to set the value returned (#5794)
    • Improve fidelity of BitmapFactory.decodeFile by attempting to use the real bitmap file width and height (#5774)
    • Add shadow methods for TextToSpeech.synthesizeToFile, TextToSpeech.isLanguageAvailable, TextToSpeech.setLanguage, and shadow APIs to configure the behavior of these methods (#5797)
    • Add shadow method for WallpaperManager.getWallpaperInfo and the ability for tests to specify the wallpaper service component (#5781)
    • Use loose signatures on ShadowTelephonyManager.requestCellInfoUpdate. This is to continue supporting Java 8 in Robolectric 4.4. (#5835)
    • Add shadow methods for InCallService.canAddCall, InCallService.setMuted, InCallService.setAudioRoute, InCallService.getCallAudioState, InCallService.requestBluetoothAudio, and some shadow API methods to modify the behavior of these methods (#5816)
    • Add shadow for android.media.audiofx.Visualizer (#5818, #5826)
    • Add shadow method of MediaPlayer.setDataSource(AssetFileDescriptor) (#5844)
    • Add shadow API to ShadowNetwork to determine whether a socket is bound, or how many sockets are bound (#5836)
    • Allow tests to configure value returned by P+'s Application.getProcessName (#5825)

    Misc improvements

    • Simplify single-parameter tests in ParameterizedRobolectricTestRunner (#5026)
    • Allow extension point for running custom actions for unsupported SDKs (#5028)
    • Fix SandboxClassLoader classloader inheritance (#5036)
    • Fix noisy NPE in ShadowInstrumentation (#5063)
    • Create Android application specified in package metadata (#5039)
    • Tolerate gaps between ZIP entries when jumping between Local File Headers (#5120)
    • Add extension points so child tests can be created (#5132)
    • Improve thread safety of many shadows (#5018, #5087, #5094, #5144, #5193, #5231, #5306, #5445, #5703, #5676, #5742)
    • Stop depending on javac annotation processing internals (#5155)
    • Add a way to specify classes to not instrument based on a regex (#5264)
    • Make reading binary resource zips more performant (#5309)
    • Fix issue transitioning to RESUMED state in ActivityScenario (#5332, #5331)
    • Add a plugin mechanism to provide a custom ShadowWrangler specialization (#5268)
    • Better support AssumptionViolatedException in RobolectricTestRunner (#5359, #5704)
    • Fix Util.getJavaVersion to support double-digit values (#5381)
    • Fix duplicate call to ContentProvider.onCreate (#5393)
    • Use AAPT for R class (and other cleanup) in shadows.support.v4 tests (#5430)
    • Clean up autoservice usage and dependencies (#5432)
    • Mark fields and methods added to classes as synthetic (#5418)
    • Stop shadowing ApplicationPackageManager's constructor (#5455)
    • Upgrade to Android Gradle Plugin 3.5.3 and Gradle 5.4.1 (#5498)
    • CircleCI improvements (#5498, a64beaf3b91b566bd79116adc7ff4c798f393227, #5709, #5700, #5761, #5770, #5769 )
    • Run google-java-format check on CircleCI (#5769)
    • Add expectLogMessageWithThrowable to ExpectedLogMessagesRule (#5516) and other fixes/improvements to ExpectedLogMessagesRule (#5640, #5657, #5680)
    • Update BouncyCastle security provider due CVE-2018-1000613 (#5572)
    • Avoid instrumenting additional packages ** Jetpack Compose (#5622) ** io.mockk (#5169) ** org.bouncycastle and org.conscrypt (#5845)
    • Update RoboMonitoringInstrumentation to post shadowActivity.callOnActivityResult asynchronously (#5671, #5674)
    • Update ShadowServiceManager to lazily create binder proxies (#5716, #5714) and fix issues in ShadowServiceManager (#5717, #5722)
    • Use guava's ByteStreams to read and copy streams (#5726)
    • Preload android.net.Uri in Android Q+ (#5733)
    • Fix Scheduler return values in PAUSED LooperMode, and support Scheduler#size (#5001)
    • Throw if ShadowPausedLooper APIs are used on a quit looper (#5499)
    • Removed the pegdown-doclet Markdown doclet gradle plugin due to Java 10+ incompatibility (#5743)
    • Converted all Robolectric Markdown Javadoc to regular Javadoc (#5746, #5747, #5753, #5759)
    • Add BackgroundTestRule to simplify running test code in a background thread (#5732)
    • Add BackgroundExecutor.runInBackground(Callable) helper method (similar to the existing BackgroundExecutor.runInBackground(Runnable) (#5730)
    • Improve support for MockK (#5169)
    • Fix 'Duplicate key' error when running ./gradlew upload (#5788)
    • Add robolectric.util.Logger.lifecycle method and use it to log some lifecycle events in RobolectricTestRunner (#5824)
    • Drop maven-ant-tasks dependency (due to CVE) and fetch from Maven manually (#5833, #5842, #5849, #5854, #5855)
    • Generate reflector class with valid access (#5841)
    • Add better support for Conscrypt (#5485
    • Fix problem mocking Java framework classes when using mockito-inline (#5875)
    Source code(tar.gz)
    Source code(zip)
  • robolectric-4.4-beta-1(Aug 17, 2020)

  • robolectric-4.4-alpha-5(Aug 13, 2020)

  • robolectric-4.4-alpha-4(Aug 13, 2020)

  • robolectric-4.4-alpha-3(Aug 13, 2020)

  • robolectric-4.4-alpha-2(Jul 23, 2020)

Owner
Robolectric
Android unit testing framework.
Robolectric
Fixtures for Kotlin providing generated values for unit testing

A tool to generate well-defined, but essentially random, input following the idea of constrained non-determinism.

Appmattus Limited 191 Dec 21, 2022
Selenium locators for Java/Kotlin that resemble the Testing Library (testing-library.com).

Selenium Testing Library Testing Library selectors available as Selenium locators for Kotlin/Java. Why? When I use Selenium, I don't want to depend on

Luís Soares 5 Dec 15, 2022
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

PowerMock 3.9k Jan 5, 2023
PowerMock is a Java framework that allows you to unit test code normally regarded as untestable.

Writing unit tests can be hard and sometimes good design has to be sacrificed for the sole purpose of testability. Often testability corresponds to go

PowerMock 3.9k Jan 2, 2023
Most popular Mocking framework for unit tests written in Java

Most popular mocking framework for Java Current version is 3.x Still on Mockito 1.x? See what's new in Mockito 2! Mockito 3 does not introduce any bre

mockito 13.6k Jan 4, 2023
A programmer-oriented testing framework for Java.

JUnit 4 JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. For more infor

JUnit 8.4k Jan 9, 2023
A programmer-oriented testing framework for Java.

JUnit 4 JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks. For more infor

JUnit 8.4k Dec 28, 2022
Morsa: Jetpack Compose UI Testing Framework

Morsa: Jetpack Compose UI Testing Framework Test library to ease UI testing with Jetpack Compose Purpose This library aims to add some useful wrappers

HyperDevs 10 Dec 3, 2022
Snapshot Testing framework for Kotlin.

KotlinSnapshot Snapshot Testing framework for Kotlin. What is this? Snapshot testing is an assertion strategy based on the comparision of the instance

Pedro Gómez 157 Nov 13, 2022
3 types of Tests in Android (Unit - instrumentation - UI)

UnitTestingPractice 3 types of Tests in Android Unit instrumentation (Integration) UI Unit Testing benefits confirm code work like a charm simulate Ap

Ahmed Tawfiq 8 Mar 23, 2022
A simple project to help developers in writing their unit tests in Android Platform.

AndroidUnitTesting A simple project to help developers in writing their unit tests in Android Platform. This is not a multi-module project, but has th

Bruno Gabriel dos Santos 4 Nov 10, 2021
Kotlin wrapper for React Test Renderer, which can be used to unit test React components in a Kotlin/JS project.

Kotlin API for React Test Renderer Kotlin wrapper for React Test Renderer, which can be used to unit test React components in a Kotlin/JS project. How

Xavier Cho 7 Jun 8, 2022
Android UI Testing

User scenario testing for Android Robotium is an Android test automation framework that has full support for native and hybrid applications. Robotium

null 2.8k Dec 14, 2022
A set of AssertJ helpers geared toward testing Android.

AssertJ Android A set of AssertJ assertions geared toward testing Android. Deprecated The support libraries and play services are developing at a rate

Square 1.6k Jan 3, 2023
Android UI Testing

User scenario testing for Android Robotium is an Android test automation framework that has full support for native and hybrid applications. Robotium

null 2.7k Apr 8, 2021
A sample repo describing best practices for snapshot testing on Android

Road to effective snapshot testing A sample repo describing best practices for snapshot testing on Android. This includes for now: Parameterized Tests

Sergio Sastre Flórez 86 Jan 1, 2023
Testify — Android Screenshot Testing

Testify — Android Screenshot Testing Add screenshots to your Android tests Expand your test coverage by including the View-layer. Testify allows you t

ndtp 43 Dec 24, 2022
Turbine is a small testing library for kotlinx.coroutines Flow.

A small testing library for kotlinx.coroutines Flow

Cash App 1.8k Jan 5, 2023
Lovely Systems Database Testing

Lovely DB Testing This repository provides opinionated testing helpers for database testing used at Lovely Systems. License This plugin is made availa

Lovely Systems GmbH 1 Feb 23, 2022