Skip to content

Test the Cupcake app: Android Basics with Compose 5. Write Navigation Tests: Test failing #129

@cygnus-sawyer

Description

@cygnus-sawyer

URL of codelab
https://developer.android.com/codelabs/basic-android-kotlin-compose-test-cupcake#4

In which task and step of the codelab can this issue be found?
Test The Cupcake App, 5.Write Navigation Tests, Step 2.

Describe the problem
I added the test described in Step 2:
@Test
fun cupcakeNavHost_verifyStartDestination() {
assertEquals(CupcakeScreen.Start.name, navController.currentBackStackEntry?.destination?.route)
}

But when I run this test, it fails.

I downloaded the solution code and opened that project and ran the test there, and it fails there as well.

Steps to reproduce?

  1. Go to cupcakeNavHost_verifyStartDestination() in the editor
  2. Click on the green arrow in the margin to the left of the function
  3. See error "FAILURE: Build failed with an exception."

Versions
Android Studio Ladybug Feature Drop | 2024.2.2
Build #AI-242.23726.103.2422.12816248, built on December 17, 2024
Runtime version: 21.0.4+-12508038-b607.1 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Toolkit: sun.awt.windows.WToolkit
Windows 11.0
GC: G1 Young Generation, G1 Concurrent GC, G1 Old Generation
Memory: 4054M
Cores: 20
Registry:
ide.experimental.ui=true
i18n.locale=
Non-Bundled Plugins:
IdeaVIM (2.19.0)

Additional information
I can't tell from the build output what the problem is. It just says this:

Task :app:connectedDebugAndroidTest FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:connectedDebugAndroidTest'.

There were failing tests. See the report at: file:///C:/Users/doner/Projects/AndroidStudio/Cupcake/app/build/reports/androidTests/connected/debug/index.html


When I open that index.html file, it just shows "0 tests 0 failures 0 skipped" as if it never ran the test at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions