Monday, April 14, 2008

Android Developer Challenger: Electron yet another demo

As promised in Android Developer Challenger: Electron and a slightly more interesting demo here you are !
Another Electron demo, this time we have an extremely simple Web Activity application driven from the Electron test web service.



We can see in this test how we start the activity, wait for its progress until loaded completely, scroll down, follow a link and finishing.

What kind of application being tested would you like to see ?

Android Developer Challenger: Electron and a slightly more interesting demo

In my previous post about Android Developer Challenger: Electron Acceptance and Unit Testing Framework we could watch some demos about two simple cases.
Here I'm presenting a slightly more interesting one: driving the Touch Paint application through the test web service.
I hope you enjoy it.



We can see how the activity is started, non-fade is selected from the menu, pointer commands are sent and translated to events by Electron and finally fade is enabled, wait some time and the application is finished.

Still, more to come.

Saturday, April 12, 2008

Android Developer Challenger: Electron Acceptance and Unit Testing Framework

My first intention was to submit a different application, but in the process of developing this application and trying to apply Test Driven Development and Design techniques, I found that although Google is providing JUnit in Android, it was not fully supported, fully documented, fully whatever.

Some Unit Tests can be run in Eclipse, but you were not be testing on the real target. So be careful on that.

Google also provides application instrumentation code through Instrumentation class. When running with instrumentation turned on, this class will be instantiated for you before any of the application code, allowing you to monitor all of the interaction the system has with the application. An Instrumentation implementation is described to the system through an AndroidManifest.xml's .

In the process of writing my own library and tools, I discovered Phil Smith's positron an Open Source library, so I decided to extend his excellent work and bring some new and missing pieces to the table.

And although positron is the anti-particle of the electron, and they annihilate if collide, take for granted that it's not the idea here, but more the conservation of the energy and the generation of some "visible light and waves".

Featured components

Android Electron Acceptance And Unit Tests
Android Electron Acceptance and Unit Test contains some sample applications and their tests:
  • Temperature Converter
  • Touch Paint
  • Web Activity
Android Electron Test Results
Android Electron Test Results is the application used to display test results.
In this video demonstration, Temperature Converter application is tested and some tests failures are showed, because the temperature conversion function is not yet implemented and returns always zero, as an step in the Test Driven Development process.



There's also a web service like interface to drive the tests, as showed in this video.




Electron-JavaSE
Electron Java SE version to drive the tests from the development environment. The ZIP contains the needed components to run Electron, Javadocs and some sample test scripts.

Tests can be scripted, and for example, the test we saw in the video demonstration before can be written as

#! /usr/bin/env electron
start?package=com.codtech.android&\
class=com.codtech.android.adc.tdd.TemperatureConverterActivity

press 123
DOWN
DOWN
CLICK
@celsius.text
assert 123
@fahrenheit.text
assert 253 123C_=>_253F
finish
Stay tuned. More on Electron later.