# TestFly Part 1: The Spring Boot of Selenium for zero-boilerplate Java test automation

URL: https://hakangul.lovable.app/blog/introducing-testfly-modern-java-test-automation-framework
Author: Hakan Gül — Team Lead Senior Test Automation Engineer
Published: 2026-08-28
Updated: 2026-10-18
Category: test-automation
Tags: TestFly, Java, Test Automation, SDET, Selenium, TestNG, Open Source

> TestFly is an opinionated test automation framework for Java 17+. This post shows how BaseTest, testfly.yml and ThreadLocal driver management get a test passing in under 60 seconds.

## English

## The idea behind TestFly

TestFly calls itself "the Spring Boot of Selenium". Building an enterprise-grade Selenium framework in Java has usually meant writing hundreds of lines of repetitive infrastructure code: configuring `WebDriverManager`, synchronizing thread-local instances, managing wait strategies and setting up screenshot listeners.

TestFly follows convention over configuration. `BaseTest` creates the driver and tears it down. Environment, timeouts and execution parameters live in `testfly.yml`. Each thread gets its own driver, so tests run in parallel without race conditions and without extra setup. After a run, a self-contained HTML report is written to `target/testfly-report.html`.

## Quickstart in 60 seconds

### 1. Add the dependency to `pom.xml`
```xml
<dependencies>
    <dependency>
        <groupId>io.testfly</groupId>
        <artifactId>testfly</artifactId>
        <version>1.0.0</version>
        <scope>test</scope>
    </dependency>
</dependencies>
```

### 2. Create `testfly.yml` in the project root
```yaml
execution:
  mode: local
  baseUrl: https://example.com

browser:
  name: chrome
  headless: false

timeouts:
  explicit: 10
  pageLoad: 30
```

### 3. Write a test class
```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 opensThePage() {
        open(); // navigates to execution.baseUrl from testfly.yml
        assertTrue(getDriver().getTitle().contains("Example Domain"));
    }

    @Test
    public void navigatesToSubpath() {
        open("/login"); // navigates to baseUrl + "/login"
    }
}
```

Run it with Maven:
```bash
mvn test
```

You don't write `driver.quit()` or `new ChromeDriver()` anywhere. TestFly manages the driver for you.

## Türkçe

## TestFly'ın çıkış noktası

TestFly kendini "Selenium'un Spring Boot'u" olarak tanımlıyor. Java'da kurumsal ölçekte bir Selenium çatısı kurmak çoğu zaman yüzlerce satır tekrar eden altyapı kodu yazmak anlamına geliyor: `WebDriverManager` ayarları, ThreadLocal izolasyonu, bekleme mekanizmaları, ekran görüntüsü dinleyicileri.

TestFly, konfigürasyon yerine standartlara dayanıyor (convention over configuration). Sürücüyü `BaseTest` açıyor ve kapatıyor. Ortam, zaman aşımı ve tarayıcı ayarları `testfly.yml` dosyasında duruyor. Her thread kendi sürücüsünü kullandığı için testler ek bir ayar yapmadan, race condition yaşamadan paralel koşabiliyor. Koşum bittiğinde harici sunucu gerektirmeyen bir HTML raporu `target/testfly-report.html` altında oluşuyor.

## 60 saniyede ilk 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ı
```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
```

Hiçbir yerde `driver.quit()` ya da `new ChromeDriver()` yazmanız gerekmiyor, sürücüyü TestFly yönetiyor.
