Giter VIP home page Giter VIP logo

unit-1-exercises's Introduction

Exercises for Access Code

Based off of https://github.com/robolectric/deckard-gradle

Make sure to enable Unit Testing in Android Studio. Then right click and run Unit1ExerciseTests.java

Pass the following tests

test01ActivityExists()

Tests if main Activity exists.

test02AddTextViewToLayout()

Tests if a TextView called with the id "text" has been added to a layout.

test03SetTextViewValueToTODO()

Tests if the TextView with the id "text" contains the string, "Help, I'm stuck in an Android Factory!"

test04AddImageViewToLayout()

Tests if an ImageView with the id "image" has been added to a layout.

test05SetImageViewToHelloGreen()

Tests if an ImageView with the id "image" uses the drawable "hello_green.png".

test06EditTextActivityExists()

Tests if EditTextAcitivity class exists.

test07EditTextActivityLayoutExists()

Tests if layout for EditTextActivity exists.

test08EditTextActivityTextViewCounterExists()

Tests if TextView R.id.counter displays the number of times a button has been clicked exists in main activity.

test09EditTextActivityButtonExists()

Tests if Button with click! text is created after the TextView R.id.counter. Every time R.id.button is clicked, R.id.counter should be incremented by 1.

Bonus #1 -- try implementing the following exercises as well as the tests.

testCounterSavesState()

Tests if the Activity saves and restores the state of the counter in OnSaveInstanceState and onRestoreInstanceState.

testSocialActivityExists()

Tests if SocialActivity class exists.

testSocialActivityLayoutExists()

Tests if a layout exists for the SocialActivity Class.

testSocialActivityRespondsToIntent()

Tests if SocialActivity responds to the ACTION_SEND Intent.

testSocialShareButtonExists()

Tests if the Main Activity has a button for social sharing with id R.id.social.

Bonus #2

Write your own unit tests, and then implement features to pass those tests. Take a look at Robolectric for documentation of the testing framework. Feel free to take a look at some of our own tests in unit-1-exercises.

unit-1-exercises's People

Contributors

amyquispe avatar shurane avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.