Skip to content

Latest commit

 

History

History
109 lines (76 loc) · 5.87 KB

xcode-plugin-lambdamax.md

File metadata and controls

109 lines (76 loc) · 5.87 KB
id title sidebar_label description keywords url site_name slug
xcode-plugin-lambdamax
LambdaMax XCode Plugin
LambdaMax XCode Plugin
LambdaTest XCode plugin to run automated tests directly on the LambdaTest grid.
xcode
lambdamax
automation testing
LambdaTest
xcode-plugin-lambdatest/

LambdaTest have developed a new plugin to help developers execute tests on the LambdaTest Grid directly from the XCode (via LambdaMax). The all-new LambdaTest plugin will allow developers and testers to directly run automated tests based on XCUIT (XCode) framework on the LambdaTest real device cloud.

XCUITest is a testing framework that can be used to automate UI tests for native iOS and macOS applications. The framework uses XCTest, an integrated testing framework developed by Apple. You can write automated UI tests using the XCUITest framework in Swift or Objective-C programming language.

With this new plugin, testers and developers never have to leave XCode to execute a test on LambdaTest’s real device cloud. Follow these steps to install LambdaMax plugin:

How to Install LambdaMax Plugin


  1. On Xcode on your machine.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-main.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. Head to Product on the menu bar in the top-left corner.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-menu.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. Hover on the Scheme option from the dropdown and click on the Edit Scheme from the dropdown list.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-dropdown.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. In the pop-up window, click and expland the Build option from the sidebar.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-build-option.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. Head to the Post Actions option from the sidebar and copy the sample code.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-build-dropdown.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. Click on + icon to add "New Script Run Action". You can change the path and capabilities as per your preference, which will reflect directly on the LambdaTest Grid.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-build-code.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

Here is the sample code for the Xcode plugin:

Xcode plugin:
Custom Xcode Script and Images attached below:

#!/bin/sh

#  ci_post_xcodebuild.sh
#  Debug/Release build name if required
#
#  Created by Ankit Agarwal on 08/11/22.
#

AppUploadResponse=$(curl -w --location --request POST 'https://{username}:{accessKey}@manual-api.lambdatest.com/app/upload/realDevice' --form 'name="{name}"' --form 'appFile=@"{filePathWithNameAndExtension}"' --form 'custom_id="{custom_id}"')

appId=$(awk '{sub(/.*\"app_url\":\"/,"");sub(/\",\"url.*/,"");print}' <<< "$AppUploadResponse")

echo "$appId"

TestAppUploadResponse=$(curl -w --location --request POST 'https://{username}:{accessKey}@manual-api.lambdatest.com/app/upload/realDevice' --form 'name="{name}"' --form 'appFile=@"{filePathWithNameAndExtension}"' --form 'custom_id="{custom_id}"')

testAppID=$(awk '{sub(/.*\"app_url\":\"/,"");sub(/\",\"url.*/,"");print}' <<< "$TestAppUploadResponse")

echo "$testAppID"

TestExeuctionPayload="{\"app\": \"$appId\", \"testSuite\": \"$testAppID\", \"device\": [ \"iPhone X-14\" ], \"tunnel\": false, \"network\": true, \"devicelog\": true, \"queueTimeout\": 3000, \"idleTimeout\": 200, \"build\": \"otrium1\", \"project\": \"testerror\" }"

echo "$TestExeuctionPayload"

XCUITTestExecution=$(curl -w --location --request POST 'https://{username}:{accessKey}@mobile-api.lambdatest.com/framework/v1/xcui/build' --header 'Content-Type: application/json' --data-raw "$TestExeuctionPayload")

echo "$XCUITTestExecution"

Note: By clicking on the Play button in the top left corner, the script will automatically run on the LambdaTest Grid.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-play.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. In the above code, update the required LambdaTest credentials - {Username:AccessKey}. You can access your credentials under the profile section.

<img loading="lazy" src={require('../assets/images/lambdamax/lambdamax-profile.webp').default} alt="Image" width="1444" height="703" className="doc_img img_center"/>

  1. Along with this, you need to update the {FilePathWithNameAndExtension} with the path where your app and test suite is in local.