Tüm yazılar
test-automation

TestFly Bölüm 1: Selenium'un Spring Boot'u — Sıfır Boilerplate ile Java Test Otomasyonu

Java 17+ tabanlı modern test otomasyon çatısı TestFly'ı keşfedin. BaseTest, testfly.yml ve ThreadLocal sürücü yönetimi ile 60 saniyede çalışan testler kurun.

28 Ağustos 20261 dk okuma
TestFly Bölüm 1: Selenium'un Spring Boot'u — Sıfır Boilerplate ile Java Test Otomasyonu

Felsefe: "Selenium'un Spring Boot'u"

Java ekosisteminde kurumsal bir Selenium çatısı kurmak, geleneksel olarak yüzlerce satır altyapı kodu yazmayı gerektirir: WebDriverManager ayarları, ThreadLocal izolasyonu, bekleme mekanizmaları ve ekran görüntüsü dinleyicileri.

TestFly, konfigürasyon yerine standartları (convention over configuration) benimser:

  • Sıfır Şablon Kod (Zero-Boilerplate): BaseTest sürücü yaşam döngüsünü tamamen üstlenir.
  • Deklaratif YAML: Ortamlar, zaman aşımları ve tarayıcı ayarları testfly.yml içinde tutulur.
  • ThreadLocal İzolasyonu: Race condition olmadan güvenli ve yerel paralel koşum.
  • Dahili HTML Raporu: Harici sunucu gerektirmeyen target/testfly-report.html raporu.

60 Saniyede İlk Test

1. pom.xml Bağımlılığı

xml
<dependencies>
    <dependency>
        <groupId>io.testfly</groupId>
        <artifactId>testfly</artifactId>
        <version>1.0.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>

2. testfly.yml (Proje Kök Dizini)

yaml
execution:
  mode: local
  baseUrl: https://example.com

browser:
  name: chrome
  headless: false

timeouts:
  explicit: 10
  pageLoad: 30

3. Test Sınıfınız

java
package io.testfly.examples;

import io.testfly.test.BaseTest;
import org.testng.annotations.Test;
import static org.testng.Assert.assertTrue;

public class SmokeTest extends BaseTest {

    @Test
    public void sayfayiAc() {
        open(); // testfly.yml'deki baseUrl adresini açar
        assertTrue(getDriver().getTitle().contains("Example Domain"));
    }

    @Test
    public void altSayfayaGit() {
        open("/login"); // baseUrl + "/login" adresine gider
    }
}

Çalıştırmak için:

bash
mvn test

Manuel driver.quit() veya new ChromeDriver() yazmaya gerek yoktur. TestFly her şeyi yönetir!

#TestFly#Java#Test Automation#SDET#Selenium#TestNG#Open Source
Paylaş X LinkedIn

Yorumlar

  • Henüz yorum yok. İlk yorumu sen yaz.