with information about the quality of the software product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include the process of executing a program or application with the intent of finding software bugs (errors or other defects), and verifying that the software product is fit for use.
with information about the quality of the software product or service under test. Software testing can also provide an objective, independent view of the software to allow the business to appreciate and understand the risks of software implementation. Test techniques include the process of executing a program or application with the intent of finding software bugs (errors or other defects), and verifying that the software product is fit for use. Process to check software quality and to push us to work more.
app testing strategy. By creating and running unit tests against your code, you can easily verify that the logic of individual unit is correct. Running unit tests after every build helps you to quickly catch and fix software regressions introduced by code changes to your app.
app testing strategy. By creating and running unit tests against your code, you can easily verify that the logic of individual units is correct. Running unit tests after every build helps you to quickly catch and fix software regressions introduced by code changes to your app.
to mark function as test fun `test 2 plus 2 is 4`() { <- test function assertEquals(4, 2 + 2) <- assertion } } @Suite.SuiteClasses(UnitTest::class) <- suite
4 is 4`() { // arrange (initialize) val first = 2 val second = 2 // act (do job) val result = first + second // assert (verify) assertEquals(4, result) }
machine only. These tests are compiled to run locally on the Java Virtual Machine (JVM) to minimize execution time. If your tests depend on objects in the Android framework, we recommend using Robolectric. For tests that depend on your own dependencies, use mock objects to emulate your dependencies' behavior.
machine only. These tests are compiled to run locally on the Java Virtual Machine (JVM) to minimize execution time. If your tests depend on objects in the Android framework, we recommend using Robolectric. For tests that depend on your own dependencies, use mock objects to emulate your dependencies' behavior.
{ val user = User(0, "KLUG") val dataSource = object : DataSource { override fun login(login: String, password: String): User = user } val loginRepository = LoginRepository(dataSource) }
{ val user = User(0, "KLUG") val dataSource = object : DataSource { override fun login(login: String, password: String): User = user } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") }
{ val user = User(0, "KLUG") val dataSource = object : DataSource { override fun login(login: String, password: String): User = user } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) }
{ val user = User(0, "KLUG") var called = false val dataSource = object : DataSource { override fun login(login: String, password: String): User { called = true return user } } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) assertTrue(called) }
{ val user = User(0, "KLUG") var called = false val dataSource = object : DataSource { override fun login(login: String, password: String): User { Is proper login/pass passed? called = true return user } } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) assertTrue(called) }
{ val user = User(0, "KLUG") var called = false val dataSource = object : DataSource { What if DataSource is final class? override fun login(login: String, password: String): User { Is proper login/pass passed? called = true return user } } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) assertTrue(called) }
{ val user = User(0, "KLUG") var called = false val dataSource = object : DataSource { What if DataSource is final class? override fun login(login: String, password: String): User { Is proper login/pass passed? called = true return user } } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) assertTrue(called) }
{ val user = User(0, "KLUG") val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) }
{ val user = User(0, "KLUG") val dataSource = mockk<DataSource>() { every { login(any(), any()) } returns user } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) }
{ val user = User(0, "KLUG") val dataSource = mockk<DataSource>() { every { login(any(), any()) } returns user } val loginRepository = LoginRepository(dataSource) val userResult = loginRepository.login("User", "Password") assertEquals(user, userResult) }
CoroutineDispatcher ) : ViewModel() { open val user = MutableLiveData<User>() open val loading = MutableLiveData<Boolean>() open val error = MutableLiveData<Throwable>() …
CoroutineDispatcher ) : ViewModel() { val user = MutableLiveData<User>() val loading = MutableLiveData<Boolean>() val error = MutableLiveData<Throwable>() …
CoroutineDispatcher ) : ViewModel() { val user = MutableLiveData<User>() val loading = MutableLiveData<Boolean>() val error = MutableLiveData<Throwable>() …
fun isIdleNow(): Boolean = isIdle override fun registerIdleTransitionCallback(callback) { this.callback = callback } fun notifyJobStarted() fun notifyJobFinished() }