All Projects → blipinsk → Cortado

blipinsk / Cortado

Licence: apache-2.0
Android Espresso made more fluent ☕️

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Cortado

jest-dashboard
Command Line Dashboard for Jest
Stars: ✭ 61 (-81.63%)
Mutual labels:  testing-tools
Recon My Way
This repository created for personal use and added tools from my latest blog post.
Stars: ✭ 271 (-18.37%)
Mutual labels:  testing-tools
Gotests
Automatically generate Go test boilerplate from your source code.
Stars: ✭ 3,597 (+983.43%)
Mutual labels:  testing-tools
bat
Gherkin based DSL for testing HTTP APIs via Cucumber.JS
Stars: ✭ 30 (-90.96%)
Mutual labels:  testing-tools
Android Jetpack Playground
Pet project for cutting edge Android development with Jetpack
Stars: ✭ 266 (-19.88%)
Mutual labels:  espresso
Awesome Unit Testing Swift
A curated collection of awesome blog articles, books, talks, podcasts, tools/frameworks and examples.
Stars: ✭ 272 (-18.07%)
Mutual labels:  testing-tools
super-powered-api-testing
Comparisons of powerful API testing tools
Stars: ✭ 25 (-92.47%)
Mutual labels:  testing-tools
Moviehub
Showcases popular movies, tv shows, and people from The Movie Database
Stars: ✭ 325 (-2.11%)
Mutual labels:  espresso
Kotest
Powerful, elegant and flexible test framework for Kotlin with additional assertions, property testing and data driven testing
Stars: ✭ 3,234 (+874.1%)
Mutual labels:  testing-tools
Clean Mvvm Archcomponents
👽 Android app consuming Star Wars API.Built with clean architecture ,MVVM pattern, Koin , Coroutines + Flows ,Architecture Components, Data Binding , Firebase , Unit/UI Tests ,Motion Layout
Stars: ✭ 285 (-14.16%)
Mutual labels:  espresso
behave-restful
BDD Framework to Test REST Services and APIs
Stars: ✭ 47 (-85.84%)
Mutual labels:  testing-tools
ESPressIoT
This project covers somewhat advances features for an espresso machine controller.
Stars: ✭ 31 (-90.66%)
Mutual labels:  espresso
Avenging
MVP pattern example on Android: no Dagger or RxJava example
Stars: ✭ 279 (-15.96%)
Mutual labels:  espresso
ru-qa-resources
Список ресурсов на тему QA
Stars: ✭ 15 (-95.48%)
Mutual labels:  testing-tools
Nut.js
Native UI testing / controlling with node
Stars: ✭ 309 (-6.93%)
Mutual labels:  testing-tools
bron
🏃‍♂️ Fast & tiny test runner for Node.js
Stars: ✭ 17 (-94.88%)
Mutual labels:  testing-tools
Chn Eolinker Ams Lite 4.0 For Java
中国最大的API接口管理平台,3.x开源发行版,支持多国语言[英语、简体中文、繁体中文]
Stars: ✭ 275 (-17.17%)
Mutual labels:  testing-tools
Phpunit
The PHP Unit Testing framework.
Stars: ✭ 18,103 (+5352.71%)
Mutual labels:  testing-tools
Goc
A Comprehensive Coverage Testing System for The Go Programming Language
Stars: ✭ 320 (-3.61%)
Mutual labels:  testing-tools
Pho
BDD test framework for PHP
Stars: ✭ 287 (-13.55%)
Mutual labels:  testing-tools

Image

Android Espresso made more fluent ☕️

Check out my blog or say hi on Twitter.


Android Arsenal Android Weekly Android Weekly Build Status

Overview

Cortado provides a layer of abstraction above Espresso, so it's a bit easier to use.

Remember: It is Google Espresso underneath. You can still mess up your tests the same way you would when using pure Espresso. Cortado just gives you a bit nicer way to communicate with Espresso.

Espresso vs. Cortado

  1. Get a Matcher for clickable views with R.id.text and with text NOT "Example"
Framework Code example
Espresso Matchers.allOf(withId(R.id.text), isClickable(), Matchers.not(withText("Example")));
Cortado Cortado.view().withId(R.id.text).and().isClickable().and().not().withText("Example");
  1. Get a Matcher for views that have text example or have parent FrameLayout
Framework Code example
Espresso Matchers.anyOf(withText("example"), withParent(isAssignableFrom(FrameLayout.class)));
Cortado Cortado.view().withText("example").or().withParent(isAssignableFrom(FrameLayout.class));
  1. Click on a View with R.id.button
Framework Code example
Espresso Espresso.onView(withId(R.id.button)).perform(ViewActions.click());
Cortado Cortado.onView().withId(R.id.button).perform().click();
  1. Check if a View with text example is visible
Framework Code example
Espresso Espresso.onView(withText("example")).check(ViewAssertions.matches(isDisplayed()));
Cortado Cortado.onView().withText("example").check().matches(isDisplayed());
  1. Replace a text on enabled view with R.id.edit
Framework Code example
Espresso Espresso.onView(Matchers.allOf(withId(R.id.edit),isEnabled())).perform(ViewActions.replaceText("changed"));
Cortado Cortado.onView().withId(R.id.edit).and().isEnabled().perform().replaceText("changed");

Features

  1. Creating an instance of org.hamcrest.Matcher<View>

    org.hamcrest.Matcher<View> matcher = Cortado.view().withId(R.id.example);
    
  2. Creating an instance of android.support.test.espresso.ViewInteraction

    ViewInteraction viewInteraction = Cortado.onView().withId(R.id.example).perform(click());
    
  3. Fluently creating Matchers.allOf(...)

    Cortado.view().withId(R.id.example).and().withText("example").and().isClickable();
    
  4. Fluently creating Matchers.anyOf(...)

    Cortado.view().withId(R.id.example).or().withText("example").or().isClickable();
    
  5. Fluently negating conditions

    Cortado.view().not().withId(R.id.example).and().withText("example").and().not().isClickable();
    
  6. Fluently performing single action (on ViewInteraction)

    Cortado.onView().withId(R.id.example).perform().click();
    
  7. Fluently checking matches (on ViewInteraction)

    Cortado.onView().withId(R.id.example).check().matches(Cortado.view().withText("example"));
    

Compatibility

I wanted the api of Cortado to be compatible with Espresso as much as possible. That's why you can do stuff like that:

Espresso.onView(Cortado.view().withId(R.id.example).and().withText("Example")).perform(click());

Including In Your Project

dependencies {
    androidTestImplementation 'com.bartoszlipinski:cortado:1.2.0'
}

Developed by

  • Bartosz Lipiński

License

Copyright 2017 Bartosz Lipiński

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