Skip to content

Upload Service Testbed

Alex Gotev edited this page Oct 17, 2020 · 18 revisions

When signaling an upload issue, be sure the problem you're facing can be replicated with the upload service testbed, otherwise it may be a network error, your server error or a device specific error which is not related to the library.

If the error can be reproduced, describe the steps to reproduce and add the following to the issue:

  • Android version used in the emulator
  • LogCat output
  • Demo Server output

How to create the testbed

Following this guide: https://github.com/gotev/android-upload-service/wiki/Testing-and-working-examples

  1. Get Upload Service Demo Server. Run the demo server in a terminal window and keep it open.

  2. Get the example app:

    git clone https://github.com/gotev/android-upload-service.git
    

    Open Android Studio and open the project located in examples/app

  3. Run the demo app on an emulator. Set LogCat to display only output from package net.gotev.uploadservicedemo at debug level.

  4. Open your emulator's browser and download a file from here: https://www.thinkbroadband.com/download It will be stored in the Downloads directory.

  5. get back to the demo app and:

    • tap on "New Multipart Upload"
    • copy the multipart URL from the server's terminal window (e.g. http://192.168.1.132:3000/upload/multipart) and paste into the appìs text field (long click on the field, release and then select Paste from the popup window)
    • click on "Add file", type "file" and click on next
    • select the file you downloaded at step 4
    • tap on the checkmark in the upper right corner to start the upload
  6. wait for the upload to complete

Using your physical device

Instead of running the demo app in an emulator, you can also use your physical device. Be sure both your computer and the device are connected to the same WiFi network and that there's no client isolation configured on the access point. Most basic way of detecting this is to ping the device from your computer or to ping your computer from your device. If it's working, then your setup is ok.

Using your own app with the demo server

After you're sure everything works using the demo server and the demo app, you can also use your own app against the demo server to see if everything works like you expect and that all the datas are sent to the server. Just change che URLs in your uploads using those of the demo server. You may also modify demo server's responses to match your own real server response data format. It's pretty easy, the demo server consists of a single js file which you can edit and re-run on the go.

This is useful to ensure your app is working like expected and to debug issues happening on your own production server or app. You know, these days when something doesn't work, the first thought of many people is the app is bugged, so you're engaged to solve the issue or provide some insights. Since you are using a third party library, you may be tempted to think

followed the examples, run my app, it doesn't work, so its' it's a library bug for sure

wrong. This guide was written exactly for that purpose. To help you spot where the real issue is step by step, methodically, like we engineers do 🍷