Showing posts with label agile. Show all posts
Showing posts with label agile. Show all posts

Saturday, April 27, 2013

Testing Android Apps with Junit (no more slow emulator)

Hi there, today i wanna share a very helpful way to test our Android Apps with fast Junit tests instead of using the "slow emulator". With Junit you'll speed up your development and ensure quality.

Requirements:
  • Your Project must use at a minimum platform 2.2 Google API level 8. (This is the most cases)
  • You must use Junit 4 Library and not Junit 3.
  • Download the newst jar file from here: robolectric-X.X.X-all.jar 
How to do it? 
  1. Create your Android project normally.
  2. select your project and add a new folder called test like the pic bellow.


Creating a Junit Test Project
Create a simple Java-Project (attention not another Android-Project) with the same name as your Android project but with the suffix -Test at the end and click next. (Attenion: do not press finish)  
Ex: MyProject and MyProjectTest

Select the src-folder, right mouse click and select "remove source folder" from build path. (the src folder will change from source into normal folder. see picture bellow after point 4)


Select the src-folder, right mouse click and take "Link additional source" and browse the created test folder from your Android Project and then click finish. The result will be something like point 1 in the pic above.

Create a folder called lib in your test project like point 4 in the picture above and copy/paste the downloaded roboelectric-x.x.x-all.jar into it.

Now select your test project, right mouse click, select Build Path > Configure Build Path... > select tab libraries > add library > Junit > next > select Junit 4 > click finish but stay in this dialog.

Click add jars... > select your test project (in this example here: MyProjectTest) > lib > select roboelectric-x.x.x-jar > click ok but stay in this dialog. (see picture bellow point 1)

Click add external jars... > [browse the location from your android-sdk] > platforms > android 8 > select android.jar > click ok but stay in this dialog. (see picture bellow point 1)

Click add external jars... > [browse the location from your android-sdk] > add-ons> addons-google_apis-android-8 > libs > select maps.jar > click ok. (see picture bellow point 1)


Select the Tab Projects > add your test project to it like the picture bellow. After that press the refresh key (F5) and run a project clean. (Project > clean...) (see picture bellow)


Setup your test run configuration
Attention: This step is very important. It will not work, if you don't do it.

Select menu run > run configurations... > double click Junit > and follow the steps in the picture bellow:




Write your first test to validate all those steps
Go back to your test project (in this case here MyProjectTest) and create a simple class in the test folder called MyActivityTest and copy the next code lines into it.

package com.example;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import org.junit.Test;
import org.junit.runner.RunWith;

import com.example.myproject.MainActivity;
import com.example.myproject.R;
import com.xtremelabs.robolectric.RobolectricTestRunner;

@RunWith(RobolectricTestRunner.class)
public class MyActivityTest {

    @Test
    public void shouldHaveHappySmiles() throws Exception {
        String hello = new MainActivity().getResources().getString(R.string.hello_world);
        assertThat(hello, equalTo("Hello world!"));
    }
}

Run the test
Menu > Run > Run Configurations... > select Junit > select your created MyProjectTestConfiguration and run it. If everything went well, we should get something like this:



So bye bye slow emulator... ;-) happy coding!



😱👇 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘‡

Be sure to read, it will change your life!
Show your work by Austin Kleonhttps://amzn.to/34NVmwx

This book is a must read - it will put you in another level! (Expert)
Agile Software Development, Principles, Patterns, and Practiceshttps://amzn.to/30WQSm2

Write cleaner code and stand out!
Clean Code - A Handbook of Agile Software Craftsmanship: https://amzn.to/33RvaSv

This book is very practical, straightforward and to the point! Worth every penny!
Kotlin for Android App Development (Developer's Library): https://amzn.to/33VZ6gp

Needless to say, these are top right?
Apple AirPods Pro: https://amzn.to/2GOICxy

😱👆 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘†




Friday, September 2, 2011

What are the contraindications for agile projects? (checklist)


What are the contraindications for agile projects?
Table of contents

What are the contraindications for agile projects? (checklist)
When are agile methods suitable ?
How could we improve the quality of this article ?
Source code convention tools
Literature, good books and references
How can i subscribe/feed this blog ?
Want to stay up to date ?
How can i rate this blog ?
Where do i find more clean code knowledge and gadgets?

What are the contraindications for agile projects? (checklist)

When are agile methods suitable ?


Agiler Background:
The agile approach is not always the best solution. There are work environment or circumstances that militate against the agile approach. Below are the contra-indicators to observe and evaluate:.


Agile Contraindicators:
These are the criteria, which does not speak for the agile approach. In this case, other approaches shall be favored.

                Contraindications Customer
o  The project goal is not SMART. The goal is not clear. (specific, measurable, appropriate, relevant, terminated)
o  process is defined and regulated. (e.g. by Authority or Law)
o  Nice-To-Have-projects. If the pressure required is missing or it has no great significance for the organization. (No pressure = no result value)
o  Customer’s decision takes a long time. When agile process, the feedback is an important element. The absence of this element, makes the project to fail.
o  Lengthy change request process. These are formalized change process. The project stays still.
o  No user or customer contact. Projects without user or costumer contact are difficult to perform agile.
o  customer does not control the outputs. The customer must take care of the project. At least 50% of the time available shall be invested, otherwise the above-mentioned problems will arrive.
o  creation of life critical software. If the meaning of provability is higher than the agile approach.
o  fear of responsibility. If errors are not seen as an opportunity to learn, but interpreted as misconduct charge.
o  Client does not support the agile approach. To customer needs to come and play its role in the feedback activity.
o  No work on site possible. For agile methods is the close cooperation with customers and users very important.
o  fixed price projects - in such cases, consider whether or not feature driven development would be appropriate. It comes from fixed-price combinations.
o  Client is an authority - If the Customer is an authority, most of the decision paths takes to long, fixed price, a given process, i.e. a collection of some contraindications.

Contraindications Developers
o  No experience with agile projects, and no coach available.
o  unwillingness or inability to learn. Agile software development is a learning process.
o  culture of command and obedience - in a strictly hierarchical culture that grants the instructions almost like commands, each devbeloper is controlled so that any error is found for a guilty person, are not suitable for the application of agile methods.
o  If developers do not want user contact - then it is hardly possible to apply agile methods.
o  High developer fluctuation which is not good for the team
o  Developer does not accept to work on site if needed or possible.
o  No management commitment to an agile method - without it is not possible.

Contraindication Technology
o  Long build time

Agile Tip!
Book tip: Agile software development, values, concepts, methods of Wolf-Gideon Bleek - Henning Wolf-Morgan Kaufmann Publishers, - ISBN: 978-3-89864-473-0


😱👇 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘‡

Be sure to read, it will change your life!
Show your work by Austin Kleonhttps://amzn.to/34NVmwx

This book is a must read - it will put you in another level! (Expert)
Agile Software Development, Principles, Patterns, and Practiceshttps://amzn.to/30WQSm2

Write cleaner code and stand out!
Clean Code - A Handbook of Agile Software Craftsmanship: https://amzn.to/33RvaSv

This book is very practical, straightforward and to the point! Worth every penny!
Kotlin for Android App Development (Developer's Library): https://amzn.to/33VZ6gp

Needless to say, these are top right?
Apple AirPods Pro: https://amzn.to/2GOICxy

😱👆 PROMOTIONAL DISCOUNT: BOOKS AND IPODS PRO ðŸ˜±ðŸ‘†