title | description | icon |
---|---|---|
Development |
How to create automation scripts |
code |
```swift
import qaml
// Set the bundle ID of the app you'd like to test
let app = XCUIApplication(bundleIdentifier: "com.yourbundleID")
app.launch()
let q = QamlClient(apiKey: "<API_KEY>", app: "<APP_INSTANCE>")
q.execute("tap the address bar")
q.execute("type camelqa.com")
```
## Updating the package
Please be sure to update your package. To update, locate qaml on the left side menu > right click > Update Package.
<Frame>
<img width="400" src="/images/update-xcode-image.png" />
</Frame>
## XCode Cloud integration
If you have XCode cloud set up, these tests will run as part of your Xcode cloud actions. Apple offers iOS developers 25 hours of free device farm access per month. Read more about this on [Xcode’s documentation](https://developer.apple.com/xcode-cloud/#:~:text=Apple%20Developer%20Program%20membership%20includes,Cloud%20monthly%20subscriptions%20are%20available.&text=Upgrade%20or%20downgrade%20your%20subscription%20at%20any%20time.).
<CodeGroup>
```java Java
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import com.camelqa.qaml.Client;
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void testAppleSite() {
Client q = new Client("<APIKey>");
q.openURL("https://apple.com");
q.execute("tap buy button");
q.execute("scroll down");
}
}
```
```kotlin Kotlin
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import com.camelqa.qaml.Client as QamlClient
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun testAppleSite() {
val q = QamlClient(apiKey = "<APIKey>")
q.openURL("https://apple.com")
q.execute("tap buy button")
q.execute("scroll down")
}
}
```
</CodeGroup>
## Updating the package
Note, if you chose to keep your package auto updated in Quickstart, you can skip this.
To update the package, you can either manually update the version by incrementing your gradel to the most recent package version:
<CodeGroup>
```java Java
dependencies {
androidTestImplementation 'com.camelqa:qaml:1.0.6'
}
```
```kotlin Kotlin
dependencies {
androidTestImplementation("com.camelqa:qaml:1.0.6")
}
```
</CodeGroup>
Alternatively, you can set the package to auto update:
<CodeGroup>
```java Java
dependencies {
androidTestImplementation 'com.camelqa:qaml:+'
// or
androidTestImplementation 'com.camelqa:qaml:latest.release'
}
```
```kotlin Kotlin
dependencies {
androidTestImplementation("com.camelqa:qaml:+")
// or
androidTestImplementation("com.camelqa:qaml:latest.release")
}
```
</CodeGroup>
## Python library
You can use qaml from Python to automate tasks in natural language. Initialize the qaml client with your API key and then start executing commands:
```python
import qaml
q = qaml.Client(api_key="<API_KEY>")
q.execute("tap the address bar")
q.execute("type camelqa.com")
q.execute("tap go")
q.execute("scroll down")
q.execute("open the apple music app")
...
```
## Updating the library
Run `pip install -U qaml` to update to the latest verison of qaml
## Appium integration
qaml integrates with Appium so you can use your existing Appium client and server configurations. To use a custom Appium configuration pass an Appium driver instance to the qaml Client constructor:
```python
import qaml
q = qaml.Client(driver=appium_driver, api_key="<API_KEY>")
q.execute("<NATURAL_LANGUAGE_COMMAND>")
...
```
Using your own Appium driver allows you to easily integrate with device clouds like [SauceLabs](https://saucelabs.com) and [BrowserStack](https://www.browserstack.com)