Book Image

Learning Android Application Testing

Book Image

Learning Android Application Testing

Overview of this book

Table of Contents (16 chapters)
Learning Android Application Testing
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Using libraries in test projects


Your Android project might require an external Java library or an Android library. Now, we will explain how to incorporate these in your project that is ready to be tested. Note that the following explains the usage of a local module that is an Android library, but the same rules can be applied to an external JAR (Java library) file or an external AAR (Android library) file.

Let's pretend that in one Activity, we are creating objects from a class that is part of a library. For the sake of our example, let's say the library is called dummyLibrary, and the mentioned class is Dummy.

So our Activity would look like this:

import com.blundell.dummylibrary.Dummy;

public class MyFirstProjectActivity extends Activity {
    private Dummy dummy;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        final EditText messageInput = (EditText) findViewById(R...