O'Reilly logo

Learning Android Application Testing by Paul Blundell, Diego Torres Milano

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding functionality

The user interface is in place. Now, we can start adding some basic functionality. This functionality will include the code to handle the actual temperature conversion.

Temperature conversion

From the list of requirements, we can obtain this statement: When one temperature is entered in one field, the other one is automatically updated with the conversion.

Following our plan, we must implement this as a test to verify that the correct functionality is there. Our test would look something like this:

@UiThreadTest public void testFahrenheitToCelsiusConversion() { celsiusInput.clear(); fahrenheitInput.clear(); fahrenheitInput.requestFocus(); fahrenheitInput.setText("32.5"); celsiusInput.requestFocus(); double f = 32.5; double expectedC ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required