All Projects → Karumi → Katasuperheroeskotlin

Karumi / Katasuperheroeskotlin

Licence: apache-2.0
Super Heroes Kata for Android Developers in Kotlin. The main goal is to practice UI Testing.

Programming Languages

kotlin
9241 projects

Projects that are alternatives of or similar to Katasuperheroeskotlin

Device Automator
An easy to use, Espresso like, syntax on top of the Android UI Automator testing framework
Stars: ✭ 63 (-18.18%)
Mutual labels:  espresso, ui-testing
Compose
Nice and simple DSL for Espresso Compose UI testing in Kotlin
Stars: ✭ 56 (-27.27%)
Mutual labels:  espresso, ui-testing
Kakao
Nice and simple DSL for Espresso in Kotlin
Stars: ✭ 1,109 (+1340.26%)
Mutual labels:  espresso, ui-testing
espresso-robot-pattern-sample
Espresso Robot Pattern Sample with Spoon Integration
Stars: ✭ 37 (-51.95%)
Mutual labels:  espresso, ui-testing
Green Coffee
Android library that allows you to run your acceptance tests written in Gherkin in your Android instrumentation tests.
Stars: ✭ 219 (+184.42%)
Mutual labels:  espresso, ui-testing
Katasuperheroesandroid
Super Heroes Kata for Android Developers. The main goal is to practice UI Testing.
Stars: ✭ 680 (+783.12%)
Mutual labels:  training, espresso
Java Training Exercices
Stars: ✭ 44 (-42.86%)
Mutual labels:  training
Blockchain Learning
Learn and promote blockchain together by writing
Stars: ✭ 44 (-42.86%)
Mutual labels:  training
Mvvm Kotlin Android Architecture
MVVM + Kotlin + Retrofit2 + Hilt + Coroutines + Kotlin Flow + mockK + Espresso + Junit5
Stars: ✭ 1,014 (+1216.88%)
Mutual labels:  espresso
Advanced R
One day course covering functions, functional programming and tidy evaluation
Stars: ✭ 38 (-50.65%)
Mutual labels:  training
Go Collection
🌷 awesome awesome go, study golang from basic to proficient
Stars: ✭ 1,193 (+1449.35%)
Mutual labels:  training
Learnyougit
A self-guided workshop to learn the basics and some of the internals of Git
Stars: ✭ 65 (-15.58%)
Mutual labels:  training
Android tmdb clean architecture
Showcase of clean architecture concepts along with Continuous Integration and Development for modular Android applications. Includes test suits (functional and unit tests) along with code coverage.
Stars: ✭ 63 (-18.18%)
Mutual labels:  espresso
Scrutiny
Randomly test state machines (such as your UI) by randomly navigating through transitions
Stars: ✭ 46 (-40.26%)
Mutual labels:  ui-testing
Githubprojectbrowser
This is a sample Android Project that is based on Clean Architecture
Stars: ✭ 64 (-16.88%)
Mutual labels:  espresso
Daggermock
A JUnit rule to easily override Dagger 2 objects
Stars: ✭ 1,156 (+1401.3%)
Mutual labels:  espresso
Kaspresso
Great UI test framework
Stars: ✭ 994 (+1190.91%)
Mutual labels:  espresso
D3
This is the repository for my course, Learning Data Visualization with D3.js on LinkedIn Learning and Lynda.com.
Stars: ✭ 64 (-16.88%)
Mutual labels:  training
Uitestingexample
Example code from my blog post about UI testing
Stars: ✭ 57 (-25.97%)
Mutual labels:  ui-testing
Opencv Face Filters
Snapchat-like Face Filters in OpenCV
Stars: ✭ 51 (-33.77%)
Mutual labels:  training

Karumi logo KataSuperHeroes in Kotlin Build Status

  • We are here to practice UI Testing.
  • We are going to use Espresso to interact with the Application UI.
  • We are going to use Kodein to replace production code with Test Doubles.
  • We are going to practice pair programming.

Getting started

This repository contains an Android application to show Super Heroes information:

ApplicationScreencast

This Application is based on two Activities:

  • MainActivity showing a list of super heroes with name, photo and a special badge if is part of the Avengers Team.

MainActivityScreenhot

  • SuperHeroDetailActivity showing detailed information about a super hero like his or her name, photo and description.

SuperHeroDetailActivityScreenshot

The application architecture, dependencies and configuration is ready to just start writing tests. In this project you'll find Kodein configured to be able to replace production code with test doubles easily and Espresso to be able to interact with the application user interface.

Tasks

Your task as Android Developer is to write all the UI tests needed to check if the Application UI is working as expected.

This repository is ready to build the application, pass the checkstyle and your tests in Travis-CI environments.

Our recommendation for this exercise is:

  • Before starting

    1. Fork this repository.
    2. Checkout kata-super-heroes branch.
    3. Execute the application, explore it manually and make yourself familiar with the code.
    4. Execute MainActivityTest and watch the only test it contains pass.
  • To help you get started, these are some test cases for MainActivity:

    1. Setup mocked SuperHeroRepository in MainActivityTest to return a list of some Super Heroes.
    2. Test that RecyclerView is listing the correct number of elements when SuperHeroesRepository returns a list of some Super Heroes.
    3. Test that each of this elements contains the correct Super Hero name.

Considerations

  • If you get stuck, master branch contains already solved tests for MainActivity and SuperHeroDetailActivity

  • You will find some utilities to help you test RecyclerViews and Toolbars easily in: app/src/androidTest/java/com/karumi/matchers and app/src/androidTest/java/com/karumi/recyclerview.

    • RecyclerViewInteraction: provides an easy way to apply an Espresso matcher to all of the RecyclerView elements

      RecyclerViewInteraction.onRecyclerView<ITEM_TYPE>(withId(R.id.recycler_view))
                  .withItems(A_LIST_OF_ITEMS)
                  .check({ item, view, e -> matches(A_MATCHER).check(view, e) })
      
    • RecyclerViewItemsCountMatcher: a matcher that returns true if RecyclerView contains the expected number of elements.

    • ToolbarMatcher: a matcher that returns true if a Toolbar with expected title is found.

Extra Tasks

If you've covered all the application functionality using UI tests try to continue with the following tasks:

  • Add a pull to refresh mechanism to MainActivity and test it.
  • Modify SuperHeroDetailActivity to handle an error case where the name of the super hero used to start this activity does not exist and show a message if this happens.
  • Modify the project to handle connection errors and show a SnackBar to indicate something went wrong.
  • Modify SuperHeroesRepository test double to perform a Thread.sleep and use the custom idling resources you'll find in this repository to get your tests working.

Documentation

There are some links which can be useful to finish these tasks:

Data provided by Marvel. © 2017 MARVEL

License

Copyright 2017 Karumi

Licensed 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.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].