Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I host an Android APK file for every pull-request, so QA can test them before merging?

In order to improve our QA workflow, we want to automatically build an APK file for each pull-request on Github so we can test it BEFORE the branch is merged. We already figured out how to build the file, but we are now wondering how to integrate this in our workflow.

It seems like most available Beta programs (e.g. Crashlytics Beta, Google Play) mostly focus on creating one beta version shortly before the release, but don't allow hosting multiple APKs in parallel.

Here's an example for our ideal workflow:

  1. Developer finishes coding and creates a pull-request
  2. Tests run
  3. If tests are successful, an APK is built automatically and uploaded somewhere (that's the part we're trying to figure out)
  4. QA takes a look at the pull-request and should be able to easily download the correct APK on their testing device
  5. If there are no issues during QA, the pull-request is merged
  6. The APK file is automatically deleted

We specifically don't want to test the APK after the pull-request has been merged, but instead test before so less bugs pop up in our develop branch.

like image 284
TrashyMcTrash Avatar asked Sep 26 '18 15:09

TrashyMcTrash


People also ask

How do I host an APK file?

Upload the App's APK File to Google Play In your browser, go to the address , click Developer Console and log in with your Android Developer account credentials. Click the Add New Application button to begin adding your app to Google Play. Select the language and the name of your app. Press the Upload APK button.

How do I test an APK file?

Navigate to the App Live dashboard. Upload the APK file and choose the desired Android device to test on. Start testing.

What is APK file in mobile automation testing?

APKs, or Android Application Packages, are typically zip files that contain a group of single APK files. Based on rules, specific devices, and user requests, these files will get installed and enabled on the devices in production.


Video Answer


1 Answers

Actually Crashlytics allow to have several versions of APK. Ech version can have each own Version string and of course release notes, to help QA to find correct APK.

Point 3 from question can be described in that way: CI configured to upload build to Crashlytics. It can be achieved by gradle task:

gradle assembleRelease crashlyticsUploadDistributionRelease

It is really useful to have special build type (pullrequest) for this case. You can specify special distribution rules via distribution groups, notifications about builds and release notes.

build.gradle:

//example function for change log 
def getLastGitCommitMessage() {
  try {
    "git log -1 --pretty=%B".execute().text.trim()
  } catch (e) {
    'Undefined message.'
  }
}

android {
  buildTypes {
    ...
    pullrequest { 
      //invitation
      ext.betaDistributionGroupAliases = "QA, devs"
      // notification
      ext.betaDistributionNotifications = true
      // last commit message as release notes
      ext.betaDistributionReleaseNotes = getLastGitCommitMessage()
    }
  }
}

In this case build and upload command will be like that:

gradle assemblePullrequest crashlyticsUploadDistributionPullrequest
like image 76
solikhver Avatar answered Oct 30 '22 06:10

solikhver