Skip to content

archiseino/Codelab--Advanced-Testing

 
 

Repository files navigation

(Deprecated) TO-DO Notes - Code for 5.1-5.3 Testing Codelab

Caution

This codelab is deprecated and it will be removed soon.

Code for the Advanced Android Kotlin Testing Codelab 5.1-5.3

Build Config Setup

For whoever tried to download from original repo, try to downgrade the gradle into the old version one (in this case the gradle 7.4.2) to sync the project. Next, you can use the AGP Upgrade Assistant, to update to the latest or stable one.

I think by default the Java version of Compilation will be around Java 8 which is not suitable for the Gradle 8.xx. Try to change the Java Compilation and also try to update the Kotlin version and some important dependencies.

Also note, for older dependencies, sometimes when building process, it will throw non-sense error, but try some simple solution just upgrade the dependencies related to the error to the latest or stable one.

Also run the test with the Gradle, the JUnit was trash for running test. The Fragment UI Testing is somehow is not working, It won't launch the fragment and perform the UI Testing. I don't know why.

Run The Test

For physical device, there's something odd with the Xiaomi device, you need to enable the "Display pop-up windows while running in the background" special permission after installing the app since it was resetted, as was present in here quotes

I've been hitting my head on the wall for a few days on this. Try to enable the "Display pop-up windows while running in the background" special permission for your normal apk(not the .test apk). The first run will fail as permissions are reset each time.

Microbenchmarks probably work fine because they don't need to launch an activity(just like standard unit tests)

At least testing is doable this way but of course it's not normal behaviour and should at the very least be documented.

This more like the system issue rather than Kotlin one as per docs: https://stackoverflow.com/questions/59645936/displaying-popup-windows-while-running-in-the-background

Introduction

TO-DO Notes is an app where you to write down tasks to complete. The app displays them in a list. You can then mark them as completed or not, filter them and delete them.

App main screen, screenshot

This codelab has four branches, representing different code states:

The codelabs in this series are:

Pre-requisites

You should be familiar with:

Getting Started

  1. Download and run the app.
  2. Check out one of the codelabs mentioned above.

License

Copyright 2019 Google, Inc.

Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Android Testing Codelab

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%