Gradle newbie looking for help with unit testing

I’m relatively new to using Gradle and its’ command line options, and while I have some experience creating working Android apps, I don’t have a clue on how to get unit tests up and running for my Android application. (I’m using Android Studio’s features to help me get by

In the root folder of my project, I tried to run the command I found online:

./gradlew test

But this just shows some useless information that I don’t want to see. I want to see what tests are running, which ones have completed, which ones have failed, and which ones have been skipped and so on, just like how I could when running Java Unit tests in another IDE. I looked online for some answers, found something that looked useful so I attempted to give it a go, so I placed some code into the ‘build.gradle.kts’ file, which looks like this:

plugins {
    id("com.android.application")
    id("org.jetbrains.kotlin.android")
    id("com.google.devtools.ksp")
}

android {
    namespace = "com.unilearning.ar_pointsofinterest"
    compileSdk = 34

    defaultConfig {
        applicationId = "com.unilearning.ar_pointsofinterest"
        minSdk = 27
        targetSdk = 33
        versionCode = 1
        versionName = "1.0"

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            isMinifyEnabled = false
            proguardFiles(
                getDefaultProguardFile("proguard-android-optimize.txt"),
                "proguard-rules.pro"
            )
        }
    }
    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_17
        targetCompatibility = JavaVersion.VERSION_17
    }
    kotlinOptions {
        jvmTarget = "17"
    }
    testOptions {
        unitTests {
            all {
                maxHeapSize = "512m"

                reports {
                    junitXml.isEnabled = true
                    html.isEnabled = true
                }

                testLogging {
                    events("passed", "skipped", "failed")
                    exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
                    showStandardStreams = true
                }
            }
        }
    }
}

dependencies {

    implementation("androidx.core:core-ktx:1.12.0")
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("com.google.android.material:material:1.10.0")
    implementation("androidx.constraintlayout:constraintlayout:2.1.4")
    implementation("androidx.fragment:fragment-ktx:1.6.2")
    implementation("org.osmdroid:osmdroid-android:6.1.13")
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
    implementation("androidx.room:room-runtime:2.6.1")
    implementation("androidx.room:room-ktx:2.6.1")
    implementation("androidx.room:room-ktx:2.6.1")
    ksp("androidx.room:room-compiler:2.6.1")
    implementation("com.github.kittinunf.fuel:fuel:2.3.1")
    implementation("com.github.kittinunf.fuel:fuel-android:2.3.1")
    implementation("com.github.kittinunf.fuel:fuel-json:2.3.1")
    implementation("com.github.kittinunf.fuel:fuel-gson:2.3.1")
    testImplementation("junit:junit:4.13.2")
    androidTestImplementation("androidx.test.ext:junit:1.1.5")
    androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
}

Trying to build the application with the above just doesn’t work, because Gradle doesn’t recognise those test options I’m trying to use. Can anyone please help me with what’s going wrong with all of this?? I really want to get unit tests working properly and this is a bit of an annoyance.