Testing Adobe AIR applications on a HockeyApp system

    Greetings friends!

    What is the article about


    This article will give a superficial description of the HockeyApp mobile app testing system . I'll tell you how to go from writing code in ActionScript to getting logs in the HockeyApp system. And I introduce you to ANE library FPHockeyApp . If you are familiar with application testing systems, you can immediately jump to examples of using the FPHockeyApp library.

    The essence of the problem


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



    How does hockeyapp


    You will find a detailed description of all the features of the HockeyApp system at http://hockeyapp.net/ . In short, this works as follows. You register on hockeyapp.net as a developer and create the application. After creating the application, you get a unique identifier APP_ID: Also, all testers are registered on the site, and you, as a developer, give testers the right to receive new versions of the application. The resulting APP_ID must be applied in the HockeyApp SDK initialization method. The assembled .ipa / .apk file is uploaded to hockeyapp.net :
    image




    And all participants in the application testing receive a notification about a new test assembly by mail. In the same letter, testers receive a link to automatically update the application, i.e. The new version of the application is installed immediately on the tester’s device (and you don’t need any dancing with iTunes, etc.). Here is a screen from mobile mail: If for some reason the tester’s application crashed, 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, which make it easier to find the bug, to you can see your logs in the Data - Description section of the site: In addition to everything indicated, the system has many more goodies and amenities, try it and you will like it :)










    HockeyApp SDK Initialization


    The site hockeyapp.net there are detailed instructions on the use of 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 library , 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 order for your application to send logs to the server in case of crash, 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 pass the absolute path to the file where the logs are in the FPHockeyApp.instance.setLogFilePath () method.

    By default, when the application sends logs, information about who the logs were sent from is not transmitted to the server. If you want to know who and when of 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:
    • BITAuthenticatorIdentificationType.ANONYMOUS - without authorization, default value
    • BITAuthenticatorIdentificationType.HOCKEY_APP_EMAIL - The user specifies only his email for feedback
    • BITAuthenticatorIdentificationType.HOCKEY_APP_USER - The user indicates his username and password from the HockeyApp personal account. The authorization window is displayed directly in your application.
    • BITAuthenticatorIdentificationType.DEVICE - Authorization using the UDID of the application. The user will be shown a window with the Authorization button, clicking on which the Safari application will be launched, which determines the current UDID, and after clicking on the Authorization button in Safari, the UDID will be transferred to the application for further authorization in the HockeyApp system
    • BITAuthenticatorIdentificationType.WEB_AUTH - Authorization by login and password from the HockeyApp system, as well as the HOCKEY_APP_USER type, only authorization occurs in Safari. Unlike the HOCKEY_APP_USER type, Safari can save an authorization session so that the user does not have to enter a username and password each time.


    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 due to certain technical difficulties in writing ANE libraries. If I can overcome this problem, I will definitely tell you how I did it and pump out a new version of the library. In the meantime, a successful compilation and quick search for bugs :)

    Fly in the ointment and analogues


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

    UPD: Updated the library version. In the class, FPhaLogger 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 limit, the earliest entries begin to be deleted. Good to all!

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

    Also popular now: