All Projects → Karumi → Katasuperheroesandroid

Karumi / Katasuperheroesandroid

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

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Katasuperheroesandroid

Daggermock
A JUnit rule to easily override Dagger 2 objects
Stars: ✭ 1,156 (+70%)
Mutual labels:  dagger, espresso
Marvel
Marvel Characters Android Application Assigned by smava GmbH
Stars: ✭ 227 (-66.62%)
Mutual labels:  dagger, espresso
Katasuperheroeskotlin
Super Heroes Kata for Android Developers in Kotlin. The main goal is to practice UI Testing.
Stars: ✭ 77 (-88.68%)
Mutual labels:  training, espresso
Espressoexamples
A collection of examples demonstrating different techniques for automated testing with Espresso.
Stars: ✭ 396 (-41.76%)
Mutual labels:  espresso
Symfony Certification Preparation List
List of topic-specific resources to help you prepare for Symfony certification
Stars: ✭ 460 (-32.35%)
Mutual labels:  training
Theatre
Pet project using Clean Architecture + MVVM + Reactive Extensions + Android Architecture Components. The data are fetched from LondonTheatreDirect API. 🎭
Stars: ✭ 577 (-15.15%)
Mutual labels:  dagger
Kotlinmultiplatform
Kotlin MultiPlatform App (Android, iOS, JVM & JS). MVVM/MVP - Kotlin MultiPlatform
Stars: ✭ 661 (-2.79%)
Mutual labels:  dagger
Firebucket
Glimpse into Firebase, with a simple TODO list app built around Dagger, RxJava 2, Clean architecture and of course, Firebase.
Stars: ✭ 376 (-44.71%)
Mutual labels:  dagger
Scabbard
🗡 A tool to visualize Dagger 2 dependency graphs
Stars: ✭ 615 (-9.56%)
Mutual labels:  dagger
Startup Os
Working examples of Google's Open Source stack and deployment to the cloud.
Stars: ✭ 564 (-17.06%)
Mutual labels:  dagger
Archapp
Simple Android app to show how to design a multi-modules MVVM Android app (fully tested)
Stars: ✭ 551 (-18.97%)
Mutual labels:  espresso
Android Mvp Architecture
This repository contains a detailed sample app that implements MVP architecture using Dagger2, GreenDao, RxJava2, FastAndroidNetworking and PlaceholderView
Stars: ✭ 4,360 (+541.18%)
Mutual labels:  dagger
Workshop
JetBrains Kotlin Workshop Material
Stars: ✭ 577 (-15.15%)
Mutual labels:  training
Mvp Android Arch Component
Android MVP sample adapts with new Android architecture components (Lifecycle, Room).
Stars: ✭ 446 (-34.41%)
Mutual labels:  dagger
Countries
An example Android app using Retrofit, Realm, Parceler, Dagger and the MVVM pattern with the data binding lib.
Stars: ✭ 616 (-9.41%)
Mutual labels:  dagger
Android Mvp Interactor Architecture
Extension of the android-mvp-architecture for very large projects.
Stars: ✭ 388 (-42.94%)
Mutual labels:  dagger
Amazon Sagemaker Examples
Example 📓 Jupyter notebooks that demonstrate how to build, train, and deploy machine learning models using 🧠 Amazon SageMaker.
Stars: ✭ 6,346 (+833.24%)
Mutual labels:  training
Secdevlabs
A laboratory for learning secure web and mobile development in a practical manner.
Stars: ✭ 547 (-19.56%)
Mutual labels:  training
Dagger Android Injection
Sample project explains Dependency Injection in Android using dagger-android framework.
Stars: ✭ 524 (-22.94%)
Mutual labels:  dagger
Dvwa
Damn Vulnerable Web Application (DVWA)
Stars: ✭ 5,727 (+742.21%)
Mutual labels:  training

Karumi logo KataSuperHeroes for Android

  • We are here to practice UI Testing.
  • We are going to use Espresso to interact with the Application UI.
  • We are going to use Dagger2 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 Dagger2 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 it should.

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 SuperHeroesRepository 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

  • A DaggerMockRule is an utility to let you create Dagger 2 modules dynamically. In this case we are using it to create a new MainModule in this testing scope. Instead of returning real objects, this new MainModule will returns the mock for SuperHeroesRepository defined in this test.

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

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

      RecyclerViewInteraction.<ITEM_TYPE>onRecyclerView(withId(R.id.recycler_view))
      .withItems(A_LIST_OF_ITEMS)
      .check(new RecyclerViewInteraction.ItemViewAssertion<ITEM_TYPE>() {
          @Override
          public void check(ITEM_TYPE item, View view, NoMatchingViewException 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. © 2016 MARVEL

License

Copyright 2016 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].