Who’s Using Your App? Examine Logs for Testing Insight

[article]
Summary:
When testing an application, have you ever thought to yourself, "I wonder who uses this"? Examining the app's logs can give you some idea. Logs are helpful for testers because they provide real feedback and insight into an application as it’s being used, as well as information that describes or can even help solve bugs. Here's how to use them to inform your testing.

When testing an application, have you ever thought to yourself, "I wonder who uses this"?

I've been curious about that myself. In a previous role, I worked on a project management application for accountants. As someone who's not an accountant, I didn't have any experience or even business knowledge of the product. How accountants used the product on a daily basis was a mystery to me.

There are several ways testers can find out who is using an application and how. One approach that is becoming more commonplace is analyzing the application’s production logs.

Logs are lists of lines of text output from an application in a given environment, such as a test server or production server. They can be helpful for testing purposes because they provide real feedback and insight into an application as it’s being used, as well as information that describes or can even help solve bugs.

Each line of a log corresponds to some event or occurrence in the application. A log line could be informational ("A user successfully logged in at "1:00 PM EST"), a warning ("The current number of users is 90 percent of the total allowed concurrent users"), or an error ("A valid user login failed unexpectedly"). Log entries can be output from the application itself ("The number of logged-in users at a given time has reached a hard-coded limit") or from the application's environment or the system running the application ("The server has run out of memory and cannot allow any more users to log in"). Most logging systems provide a timestamp for each log entry, often to the millisecond, and each log entry follows some standard format. This can provide useful insight into the question "Who's using this application?"

An Example of an App’s Log

As an example, here's a simple application called Corsica. It generates random numbers based on an HTTP request and provides these values in a response.

Let's say this application gets two requests, one valid and one invalid. If we take a look at the logs provided in the application infrastructure, we see the following lines:

Two log requests: one valid, one invalid

The two lines correspond to each request. Each line has the same format, starting with a timestamp of when the request was sent. The valid request returned an HTTP status of 200, while the invalid request returned an HTTP status of 404. You can also see information such as the fact that each request originated from a Chrome version 57 browser and what the end of the HTTP request URL looked like. This log contains other lines as other requests are made, each of which has data similar to these two highlighted lines.

In the case of our sample application, logs are generated automatically as part of an application hosting service (Google App Engine) and can be accessed by members of the project. This is true for many hosted web applications, but often, logs are generated and kept internally on a team.

So, back to our question: Who uses this application? Here are two approaches we can take to find answers.

About the author

StickyMinds is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.