Skip to content

Commit

Permalink
Merge pull request #25 from jamesnyakush/testing
Browse files Browse the repository at this point in the history
Added UI Test 🚀 ☺️
  • Loading branch information
James Nyakundi committed May 16, 2021
2 parents a36ac0d + e0939df commit bc67bde
Show file tree
Hide file tree
Showing 58 changed files with 682 additions and 33 deletions.
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ I used CMake to Secure Api Key :relaxed:
$ cd app/src/main/cpp
$ cp native-lib.cpp.sample native-lib.cpp
```

## Tech-stack

* Tech-stack
Expand Down Expand Up @@ -45,7 +46,16 @@ I used CMake to Secure Api Key :relaxed:
* CI/CD
* Github Actions


## Work plan

I created an automated [Kanban](https://github.com/jamesnyakush/Qhala-interview/projects/1) on the Github projects for agile development.

![Work plan](/art/kabana.png)

## Unit Test
Ui Testing
![Unit Test](/art/uitest.png)

## Room Database Inspector

This is How data is being Stored to Room db.
Expand Down
36 changes: 33 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ android {
versionCode = AndroidSDK.versionCode
versionName = AndroidSDK.versionName

testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
testInstrumentationRunner = "com.qhala.HiltTestRunner"

kapt {
arguments {
Expand All @@ -44,13 +44,12 @@ android {
}
}



externalNativeBuild {
cmake {
path("CMakeLists.txt")
}
}

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
Expand Down Expand Up @@ -112,6 +111,37 @@ dependencies {
implementation(Libraries.roomKtx)
implementation(Libraries.roomRuntime)
kapt(Libraries.roomCompiler)

// UI Tests
androidTestImplementation(TestLibraries.espresso)
androidTestImplementation(TestLibraries.kakao)

// Instrumentation Tests
androidTestImplementation(TestLibraries.runner)
androidTestImplementation(TestLibraries.rules)
androidTestImplementation(TestLibraries.androidXJUnit)
androidTestImplementation(TestLibraries.androidXTestCore)
androidTestImplementation(TestLibraries.androidMockK)
androidTestImplementation(TestLibraries.hiltAndroidTesting)
kaptAndroidTest(TestLibraries.hiltAndroidCompiler)

// Unit Tests
testImplementation(TestLibraries.jUnit)
testImplementation(TestLibraries.roomTest)
testImplementation(TestLibraries.mockK)
testImplementation(TestLibraries.mockWebServer)
testImplementation(TestLibraries.roboelectric)
testImplementation(TestLibraries.truth)
testImplementation(TestLibraries.runner)
testImplementation(TestLibraries.androidXJUnit)
testImplementation(TestLibraries.coroutinesTest)
testImplementation(TestLibraries.archComponentTest)
testImplementation(TestLibraries.liveDataTesting)
testImplementation(TestLibraries.hiltAndroidTesting)
kaptTest(TestLibraries.hiltAndroidCompiler)


debugImplementation(TestLibraries.fragment)
}

kapt {
Expand Down
17 changes: 17 additions & 0 deletions app/src/androidTest/java/com/qhala/HiltTestRunner.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.qhala

import android.app.Application
import android.content.Context
import androidx.test.runner.AndroidJUnitRunner
import dagger.hilt.android.testing.HiltTestApplication

class HiltTestRunner : AndroidJUnitRunner() {

override fun newApplication(
cl: ClassLoader?,
className: String?,
context: Context?
): Application {
return super.newApplication(cl, HiltTestApplication::class.java.name, context)
}
}
15 changes: 15 additions & 0 deletions app/src/androidTest/java/com/qhala/data/SampleData.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.qhala.data

import com.qhala.data.db.entity.Movie

var tomClancy = Movie(
567189,
false,
"https://image.tmdb.org/t/p/rEm96ib0sPiZBADNKBHKBv5bve9.jpg",
"An elite Navy SEAL uncovers an international conspiracy while seeking justice for the murder of his pregnant wife.",
4547.446,
"https://image.tmdb.org/t/p/rEm96ib0sPiZBADNKBHKBv5bve9.jpg",
"2021-04-29",
"Tom Clancy's Without Remorse",
7.3
)
Loading

0 comments on commit bc67bde

Please sign in to comment.