# Catatan Seekor Katalon

> <� **Quick Start**: Panduan lengkap test automation menggunakan Katalon Studio untuk web, mobile, dan API testing dengan mudah dan powerful.

## =� Daftar Isi

* [<� Overview](#-overview)
* \[=� Installation & Setup]\(#-installation--setup)
* [=� Test Creation](#-test-creation)
* [< Web Testing](#-web-testing)
* [=� Mobile Testing](#-mobile-testing)
* [= API Testing](#-api-testing)
* [=' Advanced Features](#-advanced-features)
* [=� Reporting & Analytics](#-reporting--analytics)
* [=� Best Practices](#-best-practices)
* [=� Resources](#-resources)

## <� Overview

Katalon Studio adalah comprehensive test automation platform yang menggabungkan web, mobile, dan API testing dalam satu tool. Dibangun di atas framework yang populer (Selenium, Appium), Katalon memudahkan automation testing untuk pemula dan expert.

### < **Mengapa Katalon?**

* **<� All-in-One**: Web, Mobile, API testing dalam satu platform
* **=� No-Code/Low-Code**: Scriptless automation dengan record & playback
* **= Cross-Platform**: Windows, Mac, Linux support
* **= CI/CD Integration**: Jenkins, GitLab CI, Azure DevOps
* **=� Rich Reporting**: Built-in analytics dan customizable reports
* **< Multi-Language**: Groovy scripting, JavaScript support

## =� Installation & Setup

### =� **System Requirements**

```yaml
Minimum Requirements:
  OS: Windows 7+, macOS 10.12+, Ubuntu 16.04+
  Memory: 4GB RAM (8GB recommended)
  Storage: 2GB free space
  Java: JRE 8+ (bundled with installer)
```

### =� **Installation Steps**

1. **Download Katalon Studio**
   * Visit: <https://www.katalon.com/download/>
   * Choose appropriate version for your OS
2. **Installation**

   ```bash
   # Windows
   katalon-studio-windows-x64.exe

   # macOS
   katalon-studio-macos-x64.dmg

   # Linux
   katalon-studio-linux-x64.sh
   ```
3. **First Time Setup**
   * Launch Katalon Studio
   * Create account or login
   * Configure workspace
   * Install browser drivers (auto-detect)

### =' **Configuration**

```groovy
// Execution Settings
Project > Settings > Execution
- Default browser: Chrome/Firefox/Safari
- Default execution environment: Local/Remote
- Page load timeout: 30 seconds
- Implicit wait: 10 seconds
```

## =� Test Creation

### <� **Record & Playback**

1. **Create New Test Case**
   * File > New > Test Case
   * Name: "Login Test"
   * Click "Record"
2. **Recording Actions**
   * Enter URL in browser
   * Perform user actions
   * Add verification points
   * Stop recording
3. **Playback Test**
   * Click "Run" button
   * Select browser
   * View execution results

### =' **Manual Scripting**

```groovy
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

// Test Case: User Login
WebUI.openBrowser('https://example.com/login')
WebUI.setText(findTestObject('Page_Login/input_Username'), 'testuser')
WebUI.setText(findTestObject('Page_Login/input_Password'), 'password123')
WebUI.click(findTestObject('Page_Login/button_Login'))
WebUI.verifyElementPresent(findTestObject('Page_Dashboard/header_Welcome'), 10)
WebUI.closeBrowser()
```

### =� **Test Objects Management**

```groovy
// Object Repository Structure
Object Repository/
�� Page_Login/
   �� input_Username
   �� input_Password
   �� button_Login
�� Page_Dashboard/
   �� header_Welcome
   �� button_Logout
�� TestData/
    �� users.xlsx
```

## < Web Testing

### =

**Element Locators**

```groovy
// XPath Strategies
// Absolute XPath
findTestObject('Page_Login/input_Username') // //input[@id='username']

// Relative XPath
findTestObject('Page_Login/input_Username') // //div[@class='form-group']//input

// CSS Selectors
findTestObject('Page_Login/input_Username') // #username
findTestObject('Page_Login/button_Login') // .btn-primary

// Custom Properties
findTestObject('Page_Login/input_Username') // input[name='username'][type='text']
```

### <� **Common Web Actions**

```groovy
// Navigation
WebUI.openBrowser(url)
WebUI.navigateToUrl(url)
WebUI.closeBrowser()
WebUI.refresh()

// Element Interaction
WebUI.click(findTestObject('element'))
WebUI.setText(findTestObject('input'), 'text')
WebUI.selectOptionByLabel(findTestObject('select'), 'Option')
WebUI.uploadFile(findTestObject('file_input'), filePath)

// Verification
WebUI.verifyElementPresent(findTestObject('element'), 10)
WebUI.verifyTextPresent('Expected Text', false)
WebUI.verifyElementClickable(findTestObject('button'), 5)
WebUI.verifyElementVisible(findTestObject('message'), 10)
```

### � **Waits & Timeouts**

```groovy
// Implicit Wait
WebUI.waitForPageLoad(30)
WebUI.waitForElementPresent(findTestObject('element'), 20)
WebUI.waitForElementVisible(findTestObject('element'), 15)
WebUI.waitForElementClickable(findTestObject('element'), 10)

// Explicit Wait with Custom Condition
WebUI.waitForElementNotPresent(findTestObject('loading'), 30)
WebUI.waitForElementAttributeValue(findTestObject('input'), 'value', 'expected', 20)
```

## =� Mobile Testing

### =� **Mobile Setup**

```yaml
Android Requirements:
  - Android Studio
  - Android SDK (API 21+)
  - USB Debugging enabled
  - ADB connection

iOS Requirements:
  - Xcode (macOS only)
  - iOS Developer Account
  - Real device or Simulator
  - WebDriverAgent setup
```

### <� **Mobile Test Creation**

```groovy
import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile
import internal.GlobalVariable as GlobalVariable

// Mobile Test: App Login
Mobile.startApplication('path/to/app.apk', true)
Mobile.setText(findTestObject('Mobile/input_Username'), 'testuser', 10)
Mobile.setText(findTestObject('Mobile/input_Password'), 'password123', 10)
Mobile.tap(findTestObject('Mobile/button_Login'), 10)
Mobile.verifyElementExist(findTestObject('Mobile/text_Welcome'), 10)
Mobile.closeApplication()
```

### =� **Mobile-Specific Actions**

```groovy
// Device Actions
Mobile.tap(findTestObject('element'), 10)
Mobile.swipe(100, 200, 100, 100) // Swipe up
Mobile.scrollToText('Bottom of page', 10)
Mobile pinchAndZoom(findTestObject('map'), 100, 200) // Zoom in

// App Actions
Mobile.pressBack()
Mobile.hideKeyboard()
Mobile.rotateToDeviceOrientation('landscape', 10)

// Verification
Mobile.verifyElementExist(findTestObject('element'), 10)
Mobile.verifyElementVisible(findTestObject('element'), 10)
Mobile.verifyElementNotVisible(findTestObject('element'), 10)
```

## = API Testing

### < **API Request Setup**

```groovy
import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS
import com.kms.katalon.core.testobject.RequestObject
import com.kms.katalon.core.testobject.ResponseObject

// GET Request
def response = WS.sendRequest(findTestObject('API/Users/GetUsers'))
WS.verifyResponseStatusCode(response, 200)

// POST Request
def postResponse = WS.sendRequest(findTestObject('API/Users/CreateUser'))
WS.verifyResponseStatusCode(postResponse, 201)
```

### =� **Request Object Configuration**

```json
{
  "REST": {
    "name": "CreateUser",
    "url": "https://api.example.com/users",
    "httpMethod": "POST",
    "httpHeaders": {
      "Content-Type": "application/json",
      "Authorization": "Bearer ${token}"
    },
    "httpBody": "{\"name\":\"John Doe\",\"email\":\"john@example.com\"}"
  }
}
```

### >� **API Testing Strategies**

```groovy
// Response Validation
WS.verifyResponseStatusCode(response, 200)
WS.verifyElementPropertyValue(response, 'data.id', 123)
WS.verifyElementPropertyValue(response, 'data.name', 'John Doe')

// Schema Validation
WS.verifyElementPropertyValue(response, '$.data.id', '#number')
WS.verifyElementPropertyValue(response, '$.data.email', '#email')

// Error Handling
try {
    def response = WS.sendRequest(findTestObject('API/GetUser'))
    WS.verifyResponseStatusCode(response, 200)
} catch (Exception e) {
    log.logError("API request failed: " + e.getMessage())
}
```

## =' Advanced Features

### =� **Data-Driven Testing**

```groovy
import internal.GlobalVariable as GlobalVariable

// Excel Data Source
def data = findTestData('Data Files/UserCredentials')
for (int i = 1; i <= data.getRowNumbers(); i++) {
    String username = data.getValue('username', i)
    String password = data.getValue('password', i)

    WebUI.setText(findTestObject('Page_Login/input_Username'), username)
    WebUI.setText(findTestObject('Page_Login/input_Password'), password)
    WebUI.click(findTestObject('Page_Login/button_Login'))

    // Verify login result
    WebUI.verifyElementPresent(findTestObject('Page_Dashboard/header_Welcome'), 10)
}
```

### = **Test Listeners**

```groovy
// TestListener.groovy
import com.kms.katalon.core.annotation.AfterTestCase
import com.kms.katalon.core.annotation.BeforeTestCase
import com.kms.katalon.core.context.TestCaseContext

class TestListener {

    @BeforeTestCase
    def sampleBeforeTestCase(TestCaseContext testCaseContext) {
        println "Starting test case: " + testCaseContext.getTestCaseId()
    }

    @AfterTestCase
    def sampleAfterTestCase(TestCaseContext testCaseContext) {
        println "Completed test case: " + testCaseContext.getTestCaseId()

        // Take screenshot on failure
        if (testCaseContext.getTestCaseStatus() == 'FAILED') {
            WebUI.takeScreenshot('Screenshots/' + testCaseContext.getTestCaseId() + '.png')
        }
    }
}
```

### = **Custom Keywords**

```groovy
// CustomKeywords.groovy
package com.example.keywords

import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

public class CustomKeywords {

    @Keyword
    def loginWithCredentials(String username, String password) {
        WebUI.setText(findTestObject('Page_Login/input_Username'), username)
        WebUI.setText(findTestObject('Page_Login/input_Password'), password)
        WebUI.click(findTestObject('Page_Login/button_Login'))

        return WebUI.verifyElementPresent(findTestObject('Page_Dashboard/header_Welcome'), 10)
    }

    @Keyword
    def waitForElementAndClick(String objectName, int timeout) {
        WebUI.waitForElementClickable(findTestObject(objectName), timeout)
        WebUI.click(findTestObject(objectName))
    }
}
```

## =� Reporting & Analytics

### =� **Built-in Reports**

```yaml
Report Features:
  - Execution Summary
  - Test Case Results
  - Pass/Fail Statistics
  - Execution Timeline
  - Error Details
  - Screenshots & Videos
  - Performance Metrics
```

### =' **Custom Reporting**

```groovy
// Generate Custom HTML Report
def generateCustomReport() {
    def htmlReport = """
    <html>
    <head><title>Test Execution Report</title></head>
    <body>
        <h1>Test Results</h1>
        <table>
            <tr><th>Test Case</th><th>Status</th><th>Duration</th></tr>
            <!-- Dynamic content here -->
        </table>
    </body>
    </html>
    """

    // Write to file
    def reportFile = new File('Reports/custom-report.html')
    reportFile.write(htmlReport)
}
```

### =� **Katalon Analytics**

```yaml
Analytics Features:
  - Test Execution Trends
  - Failure Analysis
  - Performance Metrics
  - Team Productivity
  - Test Coverage Analysis
  - Integration with Jira/Trello
```

## =� Best Practices

### <� **Test Design**

```yaml
Test Organization:
  - Logical Test Suite Structure
  - Descriptive Test Case Names
  - Reusable Test Objects
  - Modular Test Components
  - Proper Test Data Management
```

### =� **Script Quality**

```groovy
// Good Practice Example
import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject
import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI

class LoginTest {

    def testValidLogin() {
        // Given: User is on login page
        WebUI.openBrowser(GlobalVariable.BASE_URL + '/login')

        // When: User enters valid credentials
        WebUI.setText(findTestObject('Page_Login/input_Username'), GlobalVariable.VALID_USERNAME)
        WebUI.setText(findTestObject('Page_Login/input_Password'), GlobalVariable.VALID_PASSWORD)
        WebUI.click(findTestObject('Page_Login/button_Login'))

        // Then: User should be redirected to dashboard
        WebUI.verifyElementPresent(findTestObject('Page_Dashboard/header_Welcome'), 10)
        WebUI.verifyElementText(findTestObject('Page_Dashboard/text_Username'), GlobalVariable.VALID_USERNAME)
    }
}
```

### =' **Maintenance**

```yaml
Maintenance Strategies:
  - Regular Object Repository Updates
  - Test Data Versioning
  - Scheduled Test Execution
  - Result Analysis
  - Framework Updates
```

## =� Resources

### =� **Official Documentation**

* [Katalon Documentation](https://docs.katalon.com/)
* [Katalon Academy](https://academy.katalon.com/)
* [Katalon Community Forum](https://forum.katalon.com/)

### <� **Learning Resources**

* [Katalon YouTube Channel](https://www.youtube.com/c/KatalonStudio)
* [Katalon Blog](https://www.katalon.com/blog/)
* [Sample Projects](https://github.com/katalon-studio)

### = **Integration Guides**

* [Jenkins Integration](https://docs.katalon.com/katalon-studio/docs/jenkins-integration.html)
* [GitLab CI Integration](https://docs.katalon.com/katalon-studio/docs/gitlab-ci-integration.html)
* [Docker Deployment](https://docs.katalon.com/katalon-studio/docs/docker.html)

***

## =� **Quick Start Template**

### **1. First Test Automation**

* [ ] Install Katalon Studio
* [ ] Create new project
* [ ] Record first test case
* [ ] Add verification points
* [ ] Run and analyze results

### **2. Advanced Setup**

* [ ] Configure Test Objects
* [ ] Set up Data Files
* [ ] Create Custom Keywords
* [ ] Configure Test Listeners
* [ ] Set up CI/CD integration

### **3. Best Practices Implementation**

* [ ] Organize test structure
* [ ] Implement data-driven testing
* [ ] Add error handling
* [ ] Configure reporting
* [ ] Schedule regular execution

***

*Catatan Seekor: Katalon - Comprehensive test automation guide for modern quality assurance teams*
