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 ...

Get Learning Android Application Testing now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.