{"id":22846628,"url":"https://github.com/vicfran/robottest","last_synced_at":"2026-05-11T05:47:55.312Z","repository":{"id":149036589,"uuid":"212919222","full_name":"vicfran/RobotTest","owner":"vicfran","description":"Robot pattern in android UI testing with espresso and kotlin DSL :robot:","archived":false,"fork":false,"pushed_at":"2019-10-04T23:57:03.000Z","size":762,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-06T10:15:32.128Z","etag":null,"topics":["android","dsl","espresso","kotlin","testing","ui"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vicfran.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-10-04T23:43:59.000Z","updated_at":"2019-10-04T23:57:04.000Z","dependencies_parsed_at":null,"dependency_job_id":"5bce07c0-47af-4c25-9b6f-0f2ed542b3be","html_url":"https://github.com/vicfran/RobotTest","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicfran%2FRobotTest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicfran%2FRobotTest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicfran%2FRobotTest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vicfran%2FRobotTest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vicfran","download_url":"https://codeload.github.com/vicfran/RobotTest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246423494,"owners_count":20774796,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dsl","espresso","kotlin","testing","ui"],"created_at":"2024-12-13T03:30:06.715Z","updated_at":"2026-05-11T05:47:55.242Z","avatar_url":"https://github.com/vicfran.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RobotTest [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\nThis repo works on robot pattern in android UI testing with [espresso](https://developer.android.com/training/testing/espresso) and [kotlin](https://kotlinlang.org/docs/reference/) DSL\n\n## Things learned\n- android app development\n- UI testing\n- Espresso\n- kotlin DSL\n\napp consists of a simple activity containing two edit texts, one for setting price other for size and a create button. If both text fields are filled a success label will appear,\n in case of any error, an error label will appear.\n\n![gif](art/video.gif)\n\nThis UI testing strategy consists of applying robot pattern to wrap related espresso UI interactions outside test behavior. This pattern separates the **what** of the **how**. Gives you the power of defining a test to make without taking care\nof UI details, which will be encapsulated in the robot.\n\n![app](art/app_architecture.png)\n\n![testing](art/test_architecture.png)\n\nThis way you can write the behavior of the test like this:\n\n``` kotlin\n@Test\nfun setPriceAndSizeCreateIsSuccess() {\n    ad {\n        price(750f)\n        size(250f)\n    } create {\n        isSuccess()\n    }\n}\n```\n\nYou can use DSL power thanks to some of these kotlin features:\n- Use of lambdas outside of method parentheses\n- Lambdas with receivers\n- Extension functions\n- infix operator\n\n\n``` kotlin\nfun price(price: Float) {\n    onView(withId(R.id.priceEditText)).perform(typeText(price.toString()))\n}\n\nfun ad(func: CreateAdRobot.() -\u003e Unit) = CreateAdRobot().apply { func() }\n\ninfix fun create(func: CreateAdRobot.() -\u003e Unit): CreateAdRobot {\n    onView(withId(R.id.createButton)).perform(click())\n    return CreateAdRobot().apply { func() }\n}\n```\n\n\n## License\n\n    MIT License\n\n    Copyright (c) 2019 vicfran\n\n    Permission is hereby granted, free of charge, to any person obtaining a copy\n    of this software and associated documentation files (the \"Software\"), to deal\n    in the Software without restriction, including without limitation the rights\n    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n    copies of the Software, and to permit persons to whom the Software is\n    furnished to do so, subject to the following conditions:\n\n    The above copyright notice and this permission notice shall be included in all\n    copies or substantial portions of the Software.\n\n    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n    SOFTWARE.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicfran%2Frobottest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvicfran%2Frobottest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvicfran%2Frobottest/lists"}