Skip to content

Latest commit

 

History

History
290 lines (237 loc) · 10.5 KB

apis-for-app-testing.md

File metadata and controls

290 lines (237 loc) · 10.5 KB
id title sidebar_label description keywords url site_name slug
app-testing-apis
Commonly Used APIs For Mobile App Testing
APIs For App Testing
Quick guide on commonly used APIs for Mobile App testing.
apis for manual app testing
api sfor app automation
mobile app testing apis
LambdaTest
app-testing-apis/

import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Commonly Used APIs For Mobile App Testing", "item": "https://www.lambdatest.com/support/docs/app-testing-apis" }] }) }} ></script>

Overview


In this documentation, we look at some APIs that will help you optimize your mobile app testing workflow. If you are performing live or automated app testing, you can use these APIs in your scripts to perform various actions.

Fetching The Devices Available for Testing


To fetch the Devices that are available for running Tests.

{`curl -u "${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}" -X GET "https://mobile-api.lambdatest.com/mobile-automation/api/v1/list?region=us" `}
PARAMETER EXAMPLE DESCRIPTION
region region=us
OR
region=ap
OR
region=eu
We can add a region parameter which will provide us the devices available in the relevant real device cloud.
us - USA
ap - Asia Pacific
eu - Europe

Uploading your Application


PARAMETER EXAMPLE DESCRIPTION
custom_id -F "custom_id="Proverbial_1.0" You do not have to remember the app_URL and only use the custom_id to run your automation on the same app.
storage -F "storage=file"
DEFAULT: url
Used to change the way LambdaTest stores the link.
Used when we Upload using App URL
visibility -F "visibility=team"
DEFAULT: individual
Used to change the visibility of the application being uploaded. Once the app is uploaded using the team, everyone in the organisation can use the same URL to run the tests.

Using App File:

{`curl -u "${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "appFile=@"/Users/macuser/Downloads/Appname.apk"" -F "name="appname"" `}

Using App URL:

{`curl -u "${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}" -X POST "https://manual-api.lambdatest.com/app/upload/realDevice" -F "url=https://prod-mobile-artefacts.lambdatest.com/assets/docs/proverbial_android.apk" -F "name=Proverbial_App" -F "custom_id=sampleName" -F "storage=url" -F "visibility=individual"`}

:::tip

  • If you do not have any .apk or .ipa file, you can run your sample tests on LambdaTest by using our sample 🔗 Android app or sample 🔗 iOS app.
  • Response of above cURL will be a JSON object containing the App URL of the format - lt://APP123456789123456789

:::

Fetching your Applications


{`curl --location --request GET "https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@manual-api.lambdatest.com/app/data?type=android&level=user"`}
{`curl --location --request GET "https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@manual-api.lambdatest.com/app/data?type=ios&level=user"`}

Shown below is the response to the above cURL request.

{`{ "metaData": { "type": "ios", "total": 1 }, "data": [ { "app_id": "APP100245789181570497850", "name": "proverbial_ios.ipa", "type": "ios", "updated_at": "2022-05-10T11:19:30.000Z", "shared": false, "source": "web-client" } ] }`}

Deleting your Application


To delete your uploded apps, run the below cURL command.

{`curl --location --request DELETE "https://${ YOUR_LAMBDATEST_USERNAME()}:${ YOUR_LAMBDATEST_ACCESS_KEY()}@manual-api.lambdatest.com/app/delete" \ --header 'Content-Type: application/json' \ --data-raw '{ "appIds" : "APPID1,APPID2" }' `}

Shown below is the response to the above cURL request.

{`{ "message": "Deleted successfully." }`}

Processing check for your Application


To unlock features such as network logs, image injection, and screenshotunblock feature for your application, app needs to undergo a processing phase. This processing takes a few minutes after the application is uploaded. You can verify if the processing is complete before running your automation script using the following API.

{`curl --location --request POST 'https://mobile-api.lambdatest.com/mobile-automation/api/v1/fetchpatchedapkurl' \ --header 'Authorization: Basic c2hhbnRhbnV3OkFPOEh3NHJtV2hxUlJZSVl3OEk1elMzajhCS0c2ZHl3SVBZeXNNSDJPakdtbFVheXZC' \ --header 'Content-Type: application/json' \y --data-raw '{ "appId": "APP10160161171698993659206876", "imageInjectionEnabled": true, "screenshotUnblockEnabled": true }'`}

The payload allows you to check the processing status for specific features. If the patched_url is empty, the processing is still in progress. To check if the processing for image injection or screenshot unblock is complete, pass either imageInjectionEnabled or screenshotUnblockEnabled as true based on the feature you are testing.

{`{ "data": { "imageinjection_ready": false, //current processing status "patched_url": "", "screenshotunblock_ready": false, //current processing status "status": "success" }, "status": "success" }`}

Fetching the concurrency details


To get your concurrency details, run the below cURL command.

{`curl -u "${YOUR_LAMBDATEST_USERNAME()}:${YOUR_LAMBDATEST_ACCESS_KEY()}" -X GET "https://mobile-api.lambdatest.com/mobile-automation/api/v1/org/concurrency"`}

Shown below is the response to the above cURL request.

{`{ "data":{ "created":0, "max_concurrency":10, "max_queue":150, "pqueued":0, "queued":0, "running":0 }, "status":"success" }`}

Generate publicly shareable build and test links


To generate public shareable build link, run the below cURL command.

{`curl 'https://api.lambdatest.com/lshs/api/v1.0/share-item/generate-sharable-link' \ -H 'authorization: Bearer ' \ --data-raw '{"entityIds":["123456"],"entityType":"App Automation Build","expiresAt":7}'`}

To generate public shareable test link, run the below cURL command.

{`curl 'https://api.lambdatest.com/lshs/api/v1.0/share-item/generate-sharable-link' \ -H 'authorization: Bearer ' \ --data-raw '{"entityIds":["APPTESaBCDefGHI5JlMnOPQ"],"entityType":"App Automation Test","expiresAt":7}'`}
Type Parameter Description
Test entityIds

entityType

expiresAt
For tests, pass entityIds as the test id and pass entityType as "App Automation Test"
expiresAt is the number of days after which the shareable test link will expire '
Build entityIds

entityType

expiresAt
For builds, pass entityIds as the build id and pass entityType as "App Automation Build"
expiresAt is the number of days after which the shareable build link will expire '

That’s all! In case you have any questions or need any additional information, you could reach out at our <span className="doc__lt" onClick={() => window.openLTChatWidget()}>24X7 Chat Support or mail us directly at support@lambdatest.com.