Why automate the testing of its mobile applications?

Reading Time: 3 minutes

The tests automation is often considered as an additional cost within the development teams, and this for various reasons:

  • Necessity of a team’s rise in competence on a particular tool
  • Writing times are more important than manual execution times
  • Necessary maintenance of tests over time

Mobile development with lower project costs and shorter development times doesn’t help move to automated testing. The benefits aren’t necessarily well evaluated towards the cost of autonomization. In the end, mobile application automation projects often go by the wayside or are delayed too late in the project. This is a common mistake because the benefits of test automation for mobile applications are numerous.

Mobile applications are applications like the others: complex, technical …

Mobile applications are considered applications requiring little development, low costs… This isn’t always the case. We are no longer in the same situation in recent years where mobile application projects were Proofs Of Concept and other early stages. Mobile applications have now undergone the natural entropy of any software project: reinforced security constraints, integrated libraries and SDKs, modular architectures, multiple interactions with backend servers …

This maturity (mixed with the entropy of software) no longer allows to leave the tests aside. An industrialization of the tests, and in particular the automation, makes it possible to ensure a necessary quality for the mobile projects. Without this, it’s a failure assured.

Failure is no longer possible

Combined with this complexification of mobile projects, applications have become critical business projects. Indeed, they are the new showcases of brands and organizations. And given the rapid development cycles, a project failure (delays, late detection of user bugs…) may be fatal to the company reputation. Especially since a bad experience experienced by the user can simply lead to uninstallation, non-use of the application or writing a negative opinion on the stores.

The level of quality must be at the rendezvous and automated tests are a must to control the performance of its application.

Test is doubtful, doubt is good

A quality development team, a square process and manual tests could help ensure this quality. To test would question the skills of the team? No, because as the stress of the tightrope walker that allows him to cross the ravine, the doubt is good for the quality. An SDK with unexpected behavior, an undesired regression … As much insure with tests.

Automation makes Test Driven Development (TDD) possible

Anticipating automation will allow more to go to the practices of Test Driven Development. Writing tests before development is quite possible in mobile projects. With or without tools, it’s interesting to automate a specified scenario and launch it under development.

And not to mention Test Driven Development, having tests that closely follow the development will detect other problems as soon as possible.

Platform fragmentation can not be managed with manual tests

Testing manually on a device only no longer makes it possible to ensure the proper functioning of an application. The diversity of the hardware with hardware and software configurations is a source of bug. Different screen sizes, overlay builders … an automation will allow to run parallel tests on different devices and detect potential bugs. This way, we will avoid confusing end users and beta testers of the application!

Master the regressions in maintenance

The release of the first release of the application is only the beginning of the life cycle of the application. 80% of the development load is maintenance and application evolution. It’s therefore necessary to project on the duration. By automating, we will avoid adding regressions in the application. The launch of the tests will be systematic with each evolution of the application.

Automation allows performance metrics

In the end, automation will make it possible to follow other requirements than functional requirements: non-functional requirements. Indeed, associated with measurement tools, the automated tests will allow to trace new metrics: performance, resource consumption…

This is the strategy that GREENSPECTOR recommends to its users: by integrating the GREENSPECTOR API into automated tests, they can follow at each test campaign: the efficiency and performance of their development. The cost of automation is then largely covered by the benefits.

Is it possible to listen to music without emptying your smartphone’s battery?

Reading Time: 4 minutes

Your phone battery is discharging too fast? When buying your smartphone, the seller has promised you a battery life of 3 days. After one month, you recharge it every day (the phone, not the seller). Maybe the seller (and probably the constructor with him) lied to you about the actual capabilities of the phone? Since the Volkswagen case, we are no longer sure of anything … But the problem is probably more complex. You may not be using your smartphone correctly, or you may be choosing the services that aren’t suit your needs as well.

{{% note %}}
Article to read with some tracks to listen to

Music associated with the topic of the article and according to the tastes (With a distant report on the subject, I admit it):

The music or the autonomy of the phone, you must choose!

It’s a long way from listening to music with an MP3 player or even a cassette player (for the older ones). Now, as for many uses, the smartphone has replaced the different readers. We don’t recharge batteries, but we charge the battery of the smartphone. Especially that there are many moments in everyday life to listen to music: in public transport, at the office, by car, in the evening to fall asleep …

And there are many ways to listen to music: apps like Deezer, Live Radio, Youtube, locally stored MP3 … But what’s the least consumer way for your battery?

Measurement protocol

This study was done on a Samsung Galaxy S7 smartphone. Some results may vary on different devices, however they provide a trend for the digital services that have been evaluated.

I want to choose the least consumer service

So you always have the screen turned on and you particularly like to zap between the tracks. Consider that you are in Wi-Fi and the sound volume is on a medium level.

You can reduce your phone’s battery life by up to 3.5 hours depending on which service you use It’s usually best to play an MP3 that you have stored on the phone. You don’t use an internet connection, so there is less consumption that results. However, we see that apps like Google Play will tend to consume a lot more autonomy than playing music on the Internet (Deezer, [Spotify](https://play.google.com/store/apps/details? id = com.spotify.music), Youtube…). Be careful therefore to choose the player for your MP3 files. Android will tell you in all cases the most consuming applications, you can then make your choice.

Internet radio isn’t the most interesting solution. Pre-downloaded podcasts will be preferred. Indeed, the internet connection coupled with the browser make that the radio players aren’t the most effective.

What if I lower the volume of the audio ?

Does the sound volume affect battery consumption?

Yes and no, for a low to medium level, consumption does not vary much. However, if you use your smarphone as a speaker to broadcast sound around you, the consumption will be higher (2h20 of autonomy less). If you want to hear the louder sound, the headphones will be more useful. Don’t wait for a significant reduction in consumption with a headset.

And if I’m mobile with 4G?

Is it good listening to music on public transport where there is no Wi-Fi network?

Well this at a cost, and a significant cost. It’s best to connect to a Wi-Fi hotspot.

The summary of consumption while listening to music on the Youtube application and all in 4G.

And if I turn off my screen?

Some applications allow to go into sleep mode (or background mode) and let the screen turns off. If so, you will be able to save battery power. The ranking between services hardly changes, you just reduce consumption. Deezer actually becomes the most consumer. It seems that the background treatments aren’t optimized enough within the application.

So what?

Uses vary, depending on tastes, habits, smartphone … and energy consumption too. It’s thus possible to obtain a “range” of autonomy in continuous reading from 4h to 13h.

It’s also possible to change habits to increase autonomy. To go further in this process: identify consumer applications on OS and challenge publishers by asking them to improve is all it’s possible.

That’s green?

Yes, less energy consumption will reduce the load on the battery, so you will perform fewer charge cycles, longevity of the battery will be higher (it’s the cycles of reloading / unloading that l use), and you will extend the overall life of the battery (which is very polluting) see your smartphone.

This study was conducted with the GREENSPECTOR tool that measure the energy consumption of applications on real devices. For more information on methodologies and tools, we invite you to browse this blog.

Catch GREENSPECTOR at the IEEE Globecom 2018 conference in Abu Dhabi next 10th December!

Reading Time: 2 minutes

Thierry LEBOUCQ, President of GREENSPECTOR will speak at the panel entitled “Challenges and opportunities for sustainable development in 5G and beyond 5G” at the IEEE Globecom conference to be held from 9 to 13 December 2018 in Abu Dhabi.

Continue reading “Catch GREENSPECTOR at the IEEE Globecom 2018 conference in Abu Dhabi next 10th December!”

Top 2018 least energy-hungry browsers for your smartphone

Reading Time: 5 minutes

2020 Edition: what are the best browsers to use on mobile?

The internet browser is one of the most critical applications of your smartphone. It allows you to access a multitude of services (Social Network, news, games …). It’s even more so when you don’t want to download an app and prefer to use a mobile site instead. Your browser is used almost continuously on your phone. It’s therefore responsible for some of the decline in the battery life of your smartphone.

It’s therefore important to choose the best browser if you want to increase the life of your smartphone.

Ranking

Find the methodology of this ranking at the end of the article.

We obtain a range of different browsers that varies between 6h15 and 7h26. This may seem small as a difference but over the total battery life of your smartphone, you will less stress your battery and ultimately avoid planned obsolescence. Not to mention a prolonged autonomy at the end of the day!

The browsers

Top 1: Brave

New browser on the market, Brave wants to make privacy a workhorse. It automatically blocks ads and trackers. This seems to pay on autonomy since Brave takes the lead with 7h26mn estimated autonomy for a continuous web use.

Top 2: Firefox Focus

Mozilla publishes Firefox Focus, a browser focused on privacy: default privacy policy, blocking tackers … It seems that just like Brave, this strategy allows to gain autonomy.

Top 3: Dolphin

Much less known than Chrome or Firefox, Dolphin is however very downloaded. With features similar to Chrome or Firefox, it’s a challenger to take very seriously.

Top 4: Opera

The Opera browser has an ad blocker and the ability to create a personalized homepage with a news feed. Its Mini version exists but could not be evaluated in this study. The autonomy is quite good but inferior of 30 minutes compared to our top 1: Brave.

Top 5: Ecosia

Based on Chromium, this German browser finances sustainable development actions (such as tree replanting) with searches carried out by users. Even if autonomy is not the worst, it’s unfortunate that this browser who wants only the good of the planet is not better placed in the ranking!

Top 6: Samsung internet

This is the browser pre-installed on all Samsung phones: Samsung Internet. Consumption close to that of Ecosia, probably because the browser is also based on Chromium.

Top 7: Chrome

Chrome, the Google Android browser, one of the most used browsers. The home page allows to consult a selection of articles of press. He’s in the top 3 of the worst browsers. Some heaviness coming from the history of the solution and the non-priority on privacy.

Top 8: Microsoft Edge

The new Microsoft engine is now available on Android. Maybe the bottom of the rankings is due to the non-adaptation of the engine for Android.

Top 9: Firefox

Published by Mozilla, the browser announces a reliability on the respect of the private life. We are, however, disappointed with his place in this ranking.

Conclusion

The choice of the browser should not only be about autonomy, but it is an important criterion. We observe that the 3 historical and recognized players (Microsoft, Google and Mozilla) are at the bottom of the ranking. This is probably due to the age of the applications, and therefore overweight code (Obesiciel or bloatware). But we can also go watch a performance race that was made at the expense of autonomy. Maybe the race between the 3 has not been beneficial to their improvement. We remember, for example, the Microsoft Edge benchmark … with only Chrome and Firefox. Maybe the arrival of new serious browsers will change the game.

We can note that the differences in autonomy between browsers are also related to certain features like the news feeds on the default home pages. However, the user has a margin of maneuver: disable these features if he doesn’t use them.

Note that the base open source Chromium which is found in different browsers (Brave, Samsung Internet, Ecosia …) isn’t necessarily the most optimized (We find most browsers in the middle of the ranking.) An optimization of the heart (and potentially better integration by publishers) would reduce the consumption of several browsers. Here we see the potential of open source that isn’t used fully.

A highlight of this benchmark, newcomers to the market with a real position on privacy are at the top of the ranking (Brave and Firefox Focus). Respect for privacy and the environment go in the same direction. This is a good signal for users.

Methodology

We perform our measurements of the real energy consumption of the phone with the tool GREENSPECTOR. The Samsung Galaxy S7 smartphone was used for this Benchmark.

The methodology aims to achieve a journey that is representative of the use of a user. We study how the browser behaves on the same course. The course lasts 5 minutes and is carried out 4 times to obtain reliable measurements.

Beforehand a preparation of the phone is carried out:

  • Mastered configuration (brightness, Wi-Fi enabled …)
  • Closing all applications and services: Allows not to be polluted by other applications and to have reliable measurements
  • Removing browser caches
  • Stabilized network access

The following course is then realized:

  • Launching the browser on the home page configured at installation
  • 20-second wait (foreground): measures the impact of the home page.
  • For 3 sites of different types (Wikipedia, lemonde.fr, pinterest): Launch of the page, Scroll at the bottom of the page, wait of 20 seconds
  • Launch again of the 3 sites to evaluate the impact of the caching
  • Background browser setting (background): lets you see how the browser behaves when it is not in front of the phone.

The unit energy consumption obtained is then projected on continuous use to obtain final autonomy.

For information, here is the raw data of measured energy:

Should I activate the night mode to increase my battery life? The case of the Twitter app

Reading Time: 2 minutes

Some apps like Youtube, Google Chrome or Twitter offer a not white but black wallpaper. This “Night” mode or dark theme dedicated to a night use, facilitates reading at night, rest your eyes and especially you avoid turning into a lighthouse. But what about your battery?

We chose to compare the “Day” and “Night” mode of the Twitter app for this battle of efficiency.

(Re)discover our other comparative articles on Twitter & Twitter Lite ainsi qu’Instagram & Instagram Lite.

Twitter Night mode

The transition to “Night” mode is very simple:

  • Open your Twitter application
  • Click on the bubble of your profile at the top left of your screen
  • Click on the moon icon at the bottom left of your screen

You can also enable or disable the “Night” mode from Settings:

  • Go to “Settings and Privacy”
  • Go to “Display and Sound”
  • Click on “Night mode”

And here is the result of the “Night” mode versus the “Day” mode:

Quel gain pour l’énergie ?

Over 30 seconds, the “Day” mode will consume 3.92 mAh and the “Night” mode 2.98 mAh. The “Night” mode is therefore less consumer -23%. Why ? The measurement was made on a Samsung Galaxy S7 that has an AMOLED screen. These screens are much less consumer on dark colors, find our explanatory article about it on our blog.

Does that make a difference to the autonomy of my phone? Absolutely! With the “Day” mode enabled, 1 hour of social network (including Twitter) will discharge the battery of 15% whereas in mode “Night”, the discharge will be only 11%.

This is a victory for the “Night” mode!

Note: The measurements were done simply with the GREENSPECTOR tool on a Samsung Galaxy S7. I invite you to browse this blog for more information on tools and methodology.

How to estimate the battery life of a smartphone in less than one hour?

Reading Time: 6 minutes

Knowing the battery life of a smartphone is important because it’s one of the first purchase criteria. This is the more critical for the fleets of devices (in B2B mode) for the companies. In fact, poor autonomy will lead to a productivity decrease or customer insastisfactions. It’s therefore necessary to have a good strategy to choose its devices as well as the applications that will be hosted on it.

Traditional approaches to estimate battery life

A first approach is to rely on data provided by manufacturers. However, the limit of this approach is that those data are based on usage scenarios that aren’t necessarily representative of yours. The risk is to have a reality of autonomy far removed from what you have estimated. Especially since some features (such as taking pictures for example ..) may not be optimized on a certain type of smartphone and will be very used in your use. This criticism is also valid for tests carried out by external laboratories.

A second approach is to perform tests on real devices and perform the target scenario. Tools exist to launch benchmarks automatically but you can also perform your tests manually. The advantage is to have a realistic autonomy. The only problem is that these tests are very time-consuming. And that doesn’t give the right to the error. Indeed, if you want to change a parameter on the smartphone (brightness …) or add an application to test, you must restart the entire test campaign.

One last approach is to let users do the testing. You wait for your users feedback or you use the fleet deployment tools (MDM) to trace the information. This has the advantage of being inexpensive, the disadvantage is that there is a hidden cost: if there is a problem, there will inevitably be insatisfaction and unproductivity generated. And that forces you to choose a device that may need to be replaced.

The innovative approach of GREENSPECTOR

To meet this need to control the battery life of devices (and to choose the right device as soon as possible), GREENSPECTOR proposes an approach based on on real but unitary measurements with a projection algorithm. The process consists of 3 stages:

  • Measurement of the main features on the devices to be evaluated
  • Configuring a target scenario
  • Data projection and analysis

Use case

We want to estimate the autonomy of a traditional use on a smartphone Samsung Galaxy S7. The use can be a use in company but also an intensive personal use:

  • 30 minutes of internet browsing
  • 30 minutes of social network
  • 30 minutes of telephone conversation
  • 30 minutes of taking pictures
  • 10 minutes of video recording
  • 30 minutes of e-mail
  • 30 minutes of videoconference
  • 30 minutes of Microsoft Word
  • 10 minutes train reservation
  • 30 minutes of geolocation

This scenario is deliberately generic but we could add a specific application or an exotic use …

Functionality measurement

We use the module Free Runner of GREENSPECTOR which allows perform manual tests. These actions can be empowered but in the approach of this article, we focus on rapid testing oriented exploratory tests. If a larger benchmark is needed, automation would be of interest.

For each step of the scenario (navigation, taking a photo …), we launch the Free Runner module and we carry out a scenario representative of a real use over 1 minute.

The GREENSPECTOR module sends the measurements directly to the GREENSPECTOR server. In the end it took us just over 10 minutes to get all the measurements. If we want a little more precision (or representativeness), we can do more iterations.

At this stage, the most consuming features or applications can be identified.

Implementation of the budget strategy

Within the GREENSPECTOR interface on the Budget tab, you will be able to initiate a projection of autonomy:

You will be guided in the budget configuration. A first step is to specify the autonomy you want to achieve. If you’re on a fleet of devices, you probably want your user to have at least 9 hours of battery life to finish the day without recharging the phone.

GREENSPECTOR then offers you the possible steps of the scenario. They come from the measurements you have done previously.

The most complicated step for you now is going to be to specify how many times or how long you want the action to happen. For example, we use 30-minute target durations, so you have to enter this data for each step. No worries, this can be changed later.

You can then validate and let the algorithm calculate. No time to have a coffee, the results of the projections are immediate:

Analysis of the results of the algorithm

The first warning in the window means that the projection of battery life according to your scenario and the real measures allow to say that the autonomy of 9 hours will not be respected.

This information is found in the projection graph:

  • The 1st bar is the available capacity of usable energy over 9 hours: The capacity of the Samsung Galaxy S7 phone is 3000 mAh.
  • the 2nd bar is the energy distribution (the unitized bugdets) by functionality if you want to respect the autonomy.
  • The 3rd bar is the consumption projection associated with real measures.

It can be seen, the actual measured consumption is 3300 mAh while the capacity of the phone is 3000 mAh. We will see below what to do to correct this.

The notion of unit budget appears on the graph and on the right-hand side. This is the ideal distribution of energy consumption on each feature to respect autonomy. Here are the main principles of the algorithm:

  • To stay close to a real use, the algorithm adds a period of inactivity that corresponds to what the user would do between his actions (Idle foreground)
  • A deep sleep period is added which corresponds to a long-term inactivity of the phone (Idle background)
  • The idle periods that you will define (for example an idle corresponding to a lunch break) will be associated with a budget that is based on the reference consumption of the phone
  • To the actions, will be assigned a budget which corresponds to a maximum consumption of x2 the reference consumption.

In the end, the unit budget of each action is the amount of energy that a unit action must not exceed. Like that, you can check against the actual measurement if the action consumes too much:

We see here that the consumption of navigation is important and exceeds the budget. This feature contributes to the lack of respect of the desired battery life.

In the end, you can analyze the data outside GREENSPECTOR and for example visualize the battery discharge curve:

How to obtain a correct autonomy?

A first axis is to replace the phone. Indeed, you can choose the wrong device for your use. Ideally, the projections of autonomy will make it possible to carry out a benchmark to avoid a change too late.

Then maybe the scenario isn’t enough realistic. It will then be necessary to rethink the use: is the video conference via mobile really viable? Unfortunately, this approach is generously dismissed because we always want more digital service on the devices. The following approaches will then be more appropriate.

The unit budget will be useful to apply a better strategy:

  • On system applications (camera for example), we will study the possibility of setting the application differently to find optimizations and reduce consumption to stay within the defined budget.
  • For other applications like browsers we will be able to benchmark alternative applications. It’s likely, for instance, that videoconferencing solutions aren’t all equal in terms of energy consumption.
  • For applications developed by a third party and you master, you can incorporate a criterion in the specifications to meet the desired budget.
  • Finally for applications or websites developed internally, you can integrate GREENSPECTOR and budgets in the software factory to optimize the consumption of your applications as soon as possible and thus detect energy and energy problems. performance before your users.

Android 9 Pie’s Adaptive Battery: Your application may be heavily impacted

Reading Time: 4 minutes

Android 9 Pie (API level 28) introduces a new battery management feature: the Adaptive Battery. Depending on the user’s use of the applications, the system will restrict certain mechanisms for the applications.

New feature on Android 9 Pie : Adaptive Battery

The system prioritizes the use of resources on the frequency of use of applications and their recent date of use. 5 classes of applications (buckets) have been implemented:

  • Active: The user frequently uses the application. Some architectural criteria are also taken into account: starting activities, foreground service, user clicking on a notification …
  • Working set: The application is used frequently but is not always active. For example, a social network application will be assigned as Working set. An application used indirectly will also be in this class.
  • Frequent: The application is used frequently but not necessarily daily.
  • Rare: An application used irregularly. For example an airline flight reservation application for an individual.
  • Never: The application has been installed but has never been used.

The algorithm is based on artificial intelligence (AI), it’s likely that the learning phase will take several days. However many applications will likely be assigned to the Frequent bucket or the Rare one. System applications or Google applications (Maps, Camera…) will probably be in Working Set while the usual applications (Bank, Travel…) may be classified as Frequent. The implementation of the algorithm will also depend on the smartphone manufacturer.

Adaptive Battery restrictions

Depending on the buckets, several restrictions will be put in place:

  • Job
  • Alarm
  • Network
  • Firebase Cloud Messaging

This means that several features of your applications could be impacted:

  • Network request to update resources
  • Information download
  • Background process
  • Periodic calls to system APIs…

The restrictions will be as follows :

BucketsJobAlarmNetworkFCM
ActiveNo restrictionNo restrictionNo restrictionNo restriction
Working setDelayed up to 2 hoursDelayed up to 6 minutesNo restrictionNo restriction
FrequentDelayed up to 8 hoursDelayed up to 30 minutesNo restrictionHigh priority: 10/day
RareDelayed up to 24 hoursDelayed up to 2 hoursDelayed up to 24 hoursHigh priority: 5/day

How to increase the ranking of an application?

One of the ways to avoid declassification is to have the user assign your application in the Doze whitelist. Applications freom this whitelist are exempt from restrictions.

  • If your application does not have a launcher activity, think about implementing one if possible.
  • It’s important that your users can interact with notifications.
  • Don’t clutter your user with too many notifications, otherwise the user could block them and your application will be downgraded.

Testing difficulty

It will be difficult to predict which class your app will be assigned to. It’s likely that its usage will be fragmented, hence your application may end up in any of the 5 classes. If you want to know the class of your application (but noly after your own usage), you can use the API :

It’s however necessary to test your application in all of the different cases. For this you can place the application in the desired class using ADB:

adb shell am set-standby-bucket packagename active|working_set|frequent|rare

It’s obvious that such new testing need will increase the duration of the tests.

Note that if you have a multi-apk application, it’s possible that all APKs aren’t in the same class. It’s therefore important to think about a suitable test strategy.

Does the Adaptive battery really reduce battery consumption?

Since the announcement of this feature (associated with the Artificial Intelligence buzzword) many speculations on its operating mode have been heard: Android would store the most used applications, would allow significant energy gains… Google announced a 30% CPU gain during application launch. Now this figure was actually true but in a Google-centric context. We are more likely around 5% off. The implementation of Adaptive battery is indeed more restricted: depending on the use, some treatments, especially in the background, are delayed. This allows for example, in some cases where the user would have little battery left, to postpone a treatement hoping that it happens when the device is charged. But note that if the treatment is postponed, it’s in no way suppressed. (Source). The Adaptive battery will allow for higher gains as developers use alarms and jobs. An Artificial Intelligence that would drastically reduce energy consumption may be a goal for Android, but we are only witnessing the beginnings.

Each new version of Android has brought more energy management features (Doze, Adaptive battery …). However the gains for the end users are hard to quantify. In any case, it all comes down to the battery life of our smartphones, and we are still to witness a game changing extent in its duration. However what these novelties bring to us, is that they shed some additional light on the applications that are detected as high consumers by the system. The consequence may be severe: the user having been alerted may choose to uninstall these applications.

So… what can we do?

It’s difficult right now to predict how the Adapative Battery system will perceive the applications and sort them in the buckets (Frequently used, Rarely …). However three points are of the utmost importance:

  • An efficient, fluid and well-designed application will probably be used more often. Beyond the good practices that are given in this article, it’s important to have a high level of quality for one’s application. This involves more testing, high quality control, gather resources consumption and energy metrics …
  • Background tasks set via Alarms and Jobs, as well as network treatments are targeted by Android. It’s important to design an effective application architecture and to test the behavior of these tasks. And to do this in various conditions: different network connection, fragmented platforms ….
  • OS editors and devices manufacturers are still looking for mechanisms to prevent applications from using too much battery. As an application developer, it’s critical to anticipate this issue. Indeed, the key to the problem is the design of applications. If applications don’t improve their behavior, systems may continue to put constraining – and somwehat inefficient – mechanisms into place.