📜 ⬆️ ⬇️

Testing Adobe AIR applications in the HockeyApp system

Greetings, friends!

What is the article about?


In this article, a brief description of the HockeyApp mobile application testing system will be given. I'll tell you how to go from writing code in ActionScript to getting logs in the HockeyApp system. And introduce you to the ANE library FPHockeyApp . If you are familiar with application testing systems, you can go directly to examples of using the FPHockeyApp library.

The essence of the problem


If you are developing a mobile application alone, then you probably feel uncomfortable with the need to constantly connect different devices to your computer in order to download the new version of the application being developed for further testing. If you work in a large team, then the process of distributing test builds to testers, with the manual approach turns into hell ... Automated testing systems for applications, like HockeyApp, are designed to solve this problem. How it works, read on.
')


How does HockeyApp work


A detailed description of all the capabilities of the HockeyApp system can be found on their website http://hockeyapp.net/ . In short, it works as follows. You register on the hockeyapp.net site as a developer, and create an application. After creating the application, you get a unique identifier APP_ID:
image

Also, all testers are registered on the site, and you, as a developer, distribute to testers the rights to receive new versions of the application. The resulting APP_ID must be applied in the HockeyApp SDK initialization method. Download the collected .ipa / .apk file to hockeyapp.net :


And all participants of the testing application receive a notification about the new test build by mail. In the same place, testers receive a link to automatically update the application, i.e. A new version of the application is installed immediately on the tester's device (and there is no need for any dances with iTunes, etc.). Here is the screen from the mobile mail:


If for some reason the tester application has dropped, the application can send logs to the site for further analysis on the HockeyApp website:


In addition to the standard logs of the operating system, you can send your own logs to the server, making it easier to find a bug, you can see your logs on the site in the section Data - Description:


In addition to all that the system has, there are many more different buns and amenities, try it and you will like it :)

Initializing HockeyApp SDK


The hockeyapp.net website has detailed instructions for using the SDK. You need to embed a few lines of code, here is an example for initialization in iOS:

[[BITHockeyManager sharedHockeyManager] configureWithIdentifier:@"APP_ID"]; [[BITHockeyManager sharedHockeyManager] startManager]; [[BITHockeyManager sharedHockeyManager].authenticator authenticateInstallation]; 


This is enough for minimal work with the SDK.

Initialization in an AIR application using FPHockeyApp.ane


To work with HockeyApp in an AIR application, you need to connect the FPHockeyApp ANE database , and add the following code:

 import ru.fp.hockeyapp.FPHockeyApp; import ru.fp.hockeyapp.constants.BITAuthenticatorIdentificationType; // FPHockeyApp.instance.configureWithIdentifier('APP_ID'); FPHockeyApp.instance.startManager(); FPHockeyApp.instance.authenticateInstallation(); 


In the event of a crash, your application sends logs to the server, add the following code:
 import ru.fp.hockeyapp.FPHockeyApp; import ru.fp.hockeyapp.logger.FPhaLogger; // var logger:FPhaLogger = FPhaLogger.createInStorageDir('TestLog', 'loggs/myLog1.txt'); logger.add('my log record'); // FPHockeyApp.instance.init(); FPHockeyApp.instance.setLogFilePath(logger.nativePath); // FPHockeyApp.instance.configureWithIdentifier('YOU_APP_ID'); FPHockeyApp.instance.startManager(); FPHockeyApp.instance.authenticateInstallation(); 


The FPhaLogger class creates a file in the file system of the device in which the logs are stored. You can use any other logger that is convenient for you. It is only important to transfer the absolute path to the file where the logs are located to the FPHockeyApp.instance.setLogFilePath () method.

By default, when an application sends logs, no information is sent to the server from whom the logs are sent. If you want to know who and when from the testers launched the application and which of them dropped the application, you need to authorize the user. This is done using the setIdentificationType () method:
 import ru.flashpress.hockeyapp.FPHockeyApp; import ru.flashpress.hockeyapp.constants.BITAuthenticatorIdentificationType; // FPHockeyApp.instance.configureWithIdentifier('APP_ID'); FPHockeyApp.instance.setIdentificationType(BITAuthenticatorIdentificationType.HOCKEY_APP_USER); FPHockeyApp.instance.startManager(); FPHockeyApp.instance.authenticateInstallation(); 


There are several ways to authorize a user:


For a detailed description of all types of authorization, see the HockeyApp documentation.

Unfortunately, the authorization types BITAuthenticatorIdentificationType.DEVICE and BITAuthenticatorIdentificationType.WEB_AUTH are not supported in the FPHockeyApp.ane library. This is associated with certain technical difficulties in writing ANE libraries. If I manage to overcome this problem, I will definitely tell you how I did it and download the new version of the library. In the meantime, successful compilation and quick search for bugs :)

Spoon of tar and analogues


The biggest and, in my opinion, the only disadvantage of this system is payment. The minimum rate is $ 10 per month with a limit of 5 applications. There is a trial period - 30 days, during which you will have time to evaluate all the pros / cons of this system. Honestly, I have not yet had time to try out analogues, but quite famous among them is probably TestFlight , it is free and I saw ANE libraries somewhere on the net to work with this service. If anyone has used analogues in the AIR-application - share your experience.

UPD: Updated library version. In the FPhaLogger class, I added the ability to specify the maximum file size with logs, so that developers do not accidentally clog all free memory with logs :) As soon as the file size exceeds the allowable one, the earliest entries start to be deleted. All good!

UPD2: Sources in the svn repository fpsvn.ru/svn/ane/hockeyapp/opensource

Source: https://habr.com/ru/post/237255/


All Articles