Introducing Android WebDriver

[This post is by Dounia Berrada, an engineer on the EngTools team. — Tim Bray] Selenium WebDriver is a browser automation tool which provides a lightweight and elegant way for testing web apps. Selenium WebDriver is now available as an SDK extra in the Android SDK, and supports 2.3 (Gingerbread) and onwards! Whether or not your site is optimized for mobile browsers, you can be sure that users will be accessing it from their phones and tablets. WebDriver makes it easy to write automated tests that ensure your site works correctly when viewed from the Android browser. We’ll walk you through some basics about WebDriver and look at it in action. WebDriver Basics WebDriver tests are end-to-end tests that exercise the web application just like a real user would. WebDriver models user interactions with a web page such as finger flicks, finger scrolls and long presses. It can rotate the display and interact with HTML5 features such as local storage, session storage and the application cache. Those tests run as part of an Android tests project and are based on Junit. They can be launched from Eclipse or the command line. WebDriver tests can be wired with a continuous integration system and can run on phone and tablet emulators or real devices. Once the test starts, WebDriver opens a WebView configured like the Android browser and runs the tests against it. WebDriver is an Android SDK extra and can be installed following these instructions . Once you’ve done that you’ll be ready to write tests! There is a comprehensive WebDriver user guide on the Selenium site, but let’s start with a basic example using www.google.com to give you a taste of what’s possible. Getting Started First, create an Android project containing an empty activity with no layout. public class SimpleAppActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } Then create the Android test project that will contain the tests. WebDriver will create the WebView and set the layout automatically in the main Activity. Let’s write a test that opens the Google home page on Android and issues a query for “weather in San Francisco”. The test will verify that Google returns search results, and that the first result returned is giving the weather in San Francisco. public class SimpleGoogleTest extends ActivityInstrumentationTestCase2 { public void testGoogleShouldWork() { // Create a WebDriver instance with the activity in which we want the test to run WebDriver driver = new AndroidDriver(getActivity()); // Let’s open a web page driver.get(“http://www.google.com”); // Lookup for the search box by its name WebElement searchBox = driver.findElement(By.name(“q”)); // Enter a search query and submit searchBox.sendKeys(“weather in san francisco”); searchBox.submit(); // Making sure that Google shows 11 results WebElement resultSection = driver.findElement(By.id(“ires”)); List searchResults = resultSection.findElements(By.tagName(“li”)); assertEquals(11, searchResults.size()); // Let’s ensure that the first result shown is the weather widget WebElement weatherWidget = searchResults.get(0); assertTrue(weatherWidget.getText().contains(“Weather for San Francisco, CA”)); } } Now let’s see our test in action! WebDriver will create a WebView with the same configuration as the Android browser in the main UI thread, i.e. the activity thread. The activity will display the WebView on the screen, allowing you to see your web application as the test code is executing. Interaction Testing We’ve mentioned that WebDriver supports creating advanced gestures to interact with the device. Let’s use WebDriver to throw an image across the screen by flicking horizontally, and ensure that the next image in the gallery is displayed. WebElement toFlick = driver.findElement(By.id(“image”)); // 400 pixels left at normal speed Action flick = getBuilder(driver).flick(toFlick, 0, -400, FlickAction.SPEED_NORMAL) .build(); flick.perform(); WebElement secondImage = driver.findElement(“secondImage”); assertTrue(secondImage.isDisplayed()); Now, let’s rotate the screen and ensure that the image displayed on screen is resized. assertEquals(landscapeSize, secondImage.getSize()) ((Rotatable) driver).rotate(ScreenOrientation.PORTRAIT); assertEquals(portraitSize, secondImage.getSize()); What if your test reveals a bug? You can easily take a screenshot for help in future debugging: File tempFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); Find Out More If this has whetted your appetite and you’d like to know more, go ahead and install the Android WebDriver, take a look at the documentation on the Selenium project’s wiki , or just browse the javadocs . For questions and feedback not only of the Android WebDriver but also its desktop brethren, please join webd...@googlegroups.com . For announcements keep an eye on http://seleniumhq.wordpress.com/ .

Link:
Introducing Android WebDriver

Introducing Android WebDriver

[This post is by Dounia Berrada, an engineer on the EngTools team. — Tim Bray] Selenium WebDriver is a browser automation tool which provides a lightweight and elegant way for testing web apps. Selenium WebDriver is now available as an SDK extra in the Android SDK, and supports 2.3 (Gingerbread) and onwards! Whether or not your site is optimized for mobile browsers, you can be sure that users will be accessing it from their phones and tablets. WebDriver makes it easy to write automated tests that ensure your site works correctly when viewed from the Android browser. We’ll walk you through some basics about WebDriver and look at it in action. WebDriver Basics WebDriver tests are end-to-end tests that exercise the web application just like a real user would. WebDriver models user interactions with a web page such as finger flicks, finger scrolls and long presses. It can rotate the display and interact with HTML5 features such as local storage, session storage and the application cache. Those tests run as part of an Android tests project and are based on Junit. They can be launched from Eclipse or the command line. WebDriver tests can be wired with a continuous integration system and can run on phone and tablet emulators or real devices. Once the test starts, WebDriver opens a WebView configured like the Android browser and runs the tests against it. WebDriver is an Android SDK extra and can be installed following these instructions . Once you’ve done that you’ll be ready to write tests! There is a comprehensive WebDriver user guide on the Selenium site, but let’s start with a basic example using www.google.com to give you a taste of what’s possible. Getting Started First, create an Android project containing an empty activity with no layout. public class SimpleAppActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); } } Then create the Android test project that will contain the tests. WebDriver will create the WebView and set the layout automatically in the main Activity. Let’s write a test that opens the Google home page on Android and issues a query for “weather in San Francisco”. The test will verify that Google returns search results, and that the first result returned is giving the weather in San Francisco. public class SimpleGoogleTest extends ActivityInstrumentationTestCase2 { public void testGoogleShouldWork() { // Create a WebDriver instance with the activity in which we want the test to run WebDriver driver = new AndroidDriver(getActivity()); // Let’s open a web page driver.get(“http://www.google.com”); // Lookup for the search box by its name WebElement searchBox = driver.findElement(By.name(“q”)); // Enter a search query and submit searchBox.sendKeys(“weather in san francisco”); searchBox.submit(); // Making sure that Google shows 11 results WebElement resultSection = driver.findElement(By.id(“ires”)); List searchResults = resultSection.findElements(By.tagName(“li”)); assertEquals(11, searchResults.size()); // Let’s ensure that the first result shown is the weather widget WebElement weatherWidget = searchResults.get(0); assertTrue(weatherWidget.getText().contains(“Weather for San Francisco, CA”)); } } Now let’s see our test in action! WebDriver will create a WebView with the same configuration as the Android browser in the main UI thread, i.e. the activity thread. The activity will display the WebView on the screen, allowing you to see your web application as the test code is executing. Interaction Testing We’ve mentioned that WebDriver supports creating advanced gestures to interact with the device. Let’s use WebDriver to throw an image across the screen by flicking horizontally, and ensure that the next image in the gallery is displayed. WebElement toFlick = driver.findElement(By.id(“image”)); // 400 pixels left at normal speed Action flick = getBuilder(driver).flick(toFlick, 0, -400, FlickAction.SPEED_NORMAL) .build(); flick.perform(); WebElement secondImage = driver.findElement(“secondImage”); assertTrue(secondImage.isDisplayed()); Now, let’s rotate the screen and ensure that the image displayed on screen is resized. assertEquals(landscapeSize, secondImage.getSize()) ((Rotatable) driver).rotate(ScreenOrientation.PORTRAIT); assertEquals(portraitSize, secondImage.getSize()); What if your test reveals a bug? You can easily take a screenshot for help in future debugging: File tempFile = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE); Find Out More If this has whetted your appetite and you’d like to know more, go ahead and install the Android WebDriver, take a look at the documentation on the Selenium project’s wiki , or just browse the javadocs . For questions and feedback not only of the Android WebDriver but also its desktop brethren, please join webd...@googlegroups.com . For announcements keep an eye on http://seleniumhq.wordpress.com/ .

View post:
Introducing Android WebDriver

Nexus One “too old” to be upgraded to Ice Cream Sandwich

It seems the trusty Nexus One has made it into the legacy column. Google has confirmed what we have long suspected; the beloved Nexus One, Google’s original Nexus device, is too old to be fully and officially upgraded to Ice Cream Sandwich. Fortunately, many people who purchased the Nexus One were individuals who wanted to root their devices. Though Ice Cream Sandwich will not be officially brought to the Nexus One, we’re quite confident that Nexus One owners will see an unofficial  version of Ice Cream Sandwich come to their devices. Who out there is still using the Nexus One as your daily driver? Are you disappointed that Google couldn’t find a way to make it work, or did you largely expect this move? Any developers out there planning to port Ice Cream Sandwich to the Nexus One? Sound off below.

The rest is here:
Nexus One “too old” to be upgraded to Ice Cream Sandwich

Changes to Library Projects in Android SDK Tools, r14

Last week, we released the SDK for Android 4.0 and a new set of developer tools, now in revision 14. The updated tools include a lot of build changes, many that improve build performance. Also included is an under-the-hood change in how libraries are used by main projects — a first step in improving library support and code reusability. While the change should have little impact on existing projects, some developers have had issues when migrating to the updated tools. Please read below for more information about the change to library projects and how to solve migration issues. Previously, library projects were handled as extra resource and source code folders to be used when compiling the resources and the application’s source respectively. While this worked fine for most cases, there were two issues. 1. Developers asked us for the ability to distribute a library as a single jar file that included both compiled code and resources. The nature of Android resources, with their compiled IDs prevented this. 2. The implementation of the library projects was extremely fragile in Eclipse. Adding extra source folders outside of the project folders is non-trivial when it needs to be handled automatically, in a way that doesn’t expose a user’s local installation path (which is required for people working in teams through a source control system such as SVN or git). For r14, we decided to fix both issues at once, by moving to a compiled-code based library mechanism. This solves the implementation fragility in Eclipse and will allow us to, later, enable distribution of libraries as a single jar file. As you might have seen in the release notes, moving to this new mechanism can affect existing projects in some cases, but there are simple fixes. The first impact of this change is that the new library project requires the resource IDs generated by libraries to be non final. This prevents the Java compiler from inlining the values in the library code, and therefore prevents usage of the switch statement in the library code. To address such occurrences in your code, Eclipse provides a refactoring action to convert from switch statements to if/else (see here ). Second, some projects may not have been properly migrated to the new mechanism, resulting in projects that fail to compile, with errors such as duplicated classes being added in the dex build step. ADT 14 should have migrated older projects to the new mechanism but the fragility of the old mechanism may have prevented it from happening. This makes projects reference the libraries twice, using both the old and new mechanisms, which then triggers the libraries classes being packaged twice. If you see this in your projects, look in the Package Explorer for extraneous source folders named with the pattern _src . The screenshot to the right shows an example of this. To fix the project, you must remove the extraneous source folders with the following steps: Right click source folder and choose Build Path > Remove from Build path A dialog will pop up. In it, make sure to check “Also unlink the folder from the project” to completely remove the folder. With this change to library projects, we pave the way to better support for reusable components. We will continue working to make components easier to create, work with, and manage. Our goal is to make it easy for developers to create apps with great user experiences that easily adapt to all form factors. Some developers have also told us that they only use library projects internally, that they don’t need to distribute binary versions and would prefer to continue with a source-based mechanism. We are investigating how we could support this alongside the new mechanism. Finally, I wanted to point out that we are tracking a few known issues (and workaround for them) in the current r14 tools at this page: http://tools.android.com/knownissues . We are working on a tools update that will include fixes for most of these. We are hoping to have it out shortly.

View original post here:
Changes to Library Projects in Android SDK Tools, r14

Linux 3.1 released with NFC support

%excerpt%

Read the original:
Linux 3.1 released with NFC support

NVIDIA Releases 285.62 Graphics Drivers

NVIDIA today released the final, WHQL-certified version of its 285.62 graphics driver package for desktops and laptops running 32 and 64-bit versions of Windows Vista and Windows 7. The new drivers feature “improved compatibility and performance for Battlefield 3 ,” as did the beta drivers released last month , and they do the same for RAGE and the forthcoming Batman: Arkham City . A timeout issue that existed in the beta package has also been fixed.  Additionally, the new package contains an updated version of the PhysX System Software (9.11.06.21), a new HD audio driver (1.2.24.0), OpenGL 4.2 support for 400 and 500-series GeForce cards, and small performance gains in many games for GTX 560 and 580 users. The desktop version of the package supports all integrated and dedicated GeForce cards going all the way back to the GeForce 6 series, while the laptop version supports most DirectX10 and DirectX11-capable GPUs (GeForce 8 series and later).  32 and 64-bit Windows XP users get the 285.58 driver package for desktop cards, which includes most of the enhancements listed above (though there is no particular mention of Arkham City in the release notes ). As usual, NVIDIA's Verde driver for laptop users doesn't support Windows XP. You can grab the latest drivers for your card from  GeForce.com . Source: NVIDIA

Excerpt from:
NVIDIA Releases 285.62 Graphics Drivers

Bluetooth 4.0 Becomes ‘Bluetooth Smart’ as iPhone 4S Creates New Opportunities

Following the debut of the iPhone 4S as the first phone to support the Bluetooth 4.0 standard , the Bluetooth Special Interest Group (SIG) has begun promoting the technology under the new “Bluetooth Smart” marketing term. In a press release issued today, the Bluetooth SIG outlined the types of devices that will fall into the Bluetooth Smart categories. The Bluetooth Special Interest Group (SIG) announced two new brand extensions to its globally recognized logo today in an effort to create consumer awareness around compatibility for new devices implementing Bluetooth v4.0 – the Bluetooth Smart Ready trademark and the Bluetooth Smart trademark. Bluetooth Smart Ready devices are phones, tablets, PCs and TVs that sit at the center of a consumer’s connected world and implement a Bluetooth v4.0 dual mode radio. Bluetooth Smart devices are sensor-type devices like heart-rate monitors or pedometers that run on button-cell batteries and were built to collect a specific piece of information. Bluetooth Smart devices include only a single-mode low energy Bluetooth v4.0 radio. Bluetooth Smart has been promised as a way to allow devices to interact wirelessly using low-power standards, enabling countless new potential uses. Bluetooth Smart devices are designed to gather a specific type of information—are all the windows on my house locked, what is my insulin level, how much do I weigh today?—and send it to a Bluetooth Smart Ready device. Examples include heart-rate monitors, blood-glucose meters, smart watches, window and door security sensors, key fobs for your car, and blood-pressure cuffs—the opportunities are endless. While the iPhone 4S is not yet able to make extensive use of the features specific to Bluetooth Smart due to a lack of peripheral single-mode Smart devices capable of transmitting data to the iPhone, it is clear the Bluetooth standards bearers and manufacturers will be quickly pushing forward to promote the adoption of Smart technology in a host of new product categories. Beyond the iPhone 4S, Apple has also been building Bluetooth 4.0 support into several of its latest Mac lines, including the Mac mini and MacBook Air introduced back in July. Notably, today’s MacBook Pro update did not bring Bluetooth 4.0 support to that line, although the update was an extremely minor one that Apple is not even acknowledging as a refresh on its promotional product pages. Consequently, the update appears to have been limited to core “plug-and-play” features such as CPU, GPU, and hard drives that could be easily upgraded rather than features like new Bluetooth 4.0 capabilities that could require more significant engineering work. Recent Mac and iOS Blog Stories • China Mobile Hits 10 Million iPhone Users Despite Lack of Agreement with Apple • Siri Co-Founder Dag Kittlaus Leaves Apple • Walter Isaacson's Steve Jobs Interview on 60 Minutes Tonight • Some Scenes In The Avengers [Not] Filmed On an iPhone [Updated] • T-Mobile: Apple's Decision When We Get the iPhone

Go here to read the rest:
Bluetooth 4.0 Becomes ‘Bluetooth Smart’ as iPhone 4S Creates New Opportunities

Microsoft now takes patent licensing fees on 50pc of Android devices

ODM Compal is the latest entry in Microsoft’s Android Licensing Program With Compal as its latest victim, Microsoft has proudly announced that it now collects license fees from companies that account for over half of all Android devices shipments. Some of these are big names like HTC, Samsung and Acer. On the ODM front also,

Read the original here:
Microsoft now takes patent licensing fees on 50pc of Android devices

Microsoft now takes patent licensing fees on 50pc of Android devices

ODM Compal is the latest entry in Microsoft’s Android Licensing Program With Compal as its latest victim, Microsoft has proudly announced that it now collects license fees from companies that account for over half of all Android devices shipments. Some of these are big names like HTC, Samsung and Acer. On the ODM front also,

Read the original:
Microsoft now takes patent licensing fees on 50pc of Android devices

Workaround for minimizing sensor sampling battery cost

In my Droidcon 2011 presentation I tried to highlight the battery cost of the continuous sensor sampling which is necessary for detecting motion patterns. While the general case still requires some sort of improvement over the current Android sensor architecture e.g. the use of the “wake on motion” feature of the acceleration sensors , it is possible to decrease the battery consumption if the motion to be detected is longer than 5-10 seconds. This is still not suitable for recognising very short events like fall, tap, shake, etc. but can be suitable to “wake up” a step counter when the motion starts. Some steps would be missed but this may be acceptable if the battery life is increased. Click here to download the example program . The essence of the workaround is to use the AlarmManager and to generate periodic wakeup events. When the wakeup event is received, sensor sampling is started and some samples are collected. Then we have to figure out using some heuristics whether there is some movement. This implementation calculates the average value of the acceleration sample absolute values and looks for values deviating from the average. If there is movement detected, the sampling continues. If there is no movement detected, the program gives up the wake lock and goes back sleeping.- I have made some measurements using my Nexus 1. I switched the phone into airplane mode and ran the program during the night, for 7-8 hours. The battery percentage consumed during an hour can be seen below as a function of wakeup period (check out WAKEUP_PERIOD constant in AlarmSleep.java). 5 sec – 1.14%/hour 10 sec – 1.10%/hour 20 sec – 0.56%/hour 30 sec – 0.27%/hour The battery consumption with the last timeout value – 30 sec – is very close to the standby consumption, 0.25%. If you can tolerate that long “dead period”, then you can bring the battery consumption in “no motion” state very close to the phone’s normal standby consumption. For a general “tap” or “shake” detector, however, this is not an adequate solution. I have received encouraging mails that a proper solution relying on the sensor’s low-power mode may be deployed soon.

Read this article:
Workaround for minimizing sensor sampling battery cost