TestFly Bölüm 4: testfly-mcp ile Yapay Zeka Test Üretimi ve Kendi Kendini Onaran Seçiciler
testfly-mcp ile TestFly'ı Claude, Cursor ve Copilot'a bağlayın. Canlı tarayıcı oturumlarını kaydedin, semantik Java kodu üretin ve kırılan seçicileri onarın.
28 Ağustos 20261 dk okuma
Yeni Dönem: Model Context Protocol ve TestFly
TestFly, testfly-mcp sunucusu aracılığıyla yapay zeka asistanlarına (Claude Desktop, Cursor, Copilot, Antigravity) doğrudan bağlanır.
1. testfly-mcp Entegrasyonu
mcp_config.json dosyanıza ekleyin:
json
{
"mcpServers": {
"testfly-mcp": {
"command": "npx",
"args": ["-y", "testfly-mcp@latest"]
}
}
}2. Doğal Dilden TestFly Kodu Üretimi
Yapay zeka MCP üzerinden canlı tarayıcı açar, adımları dener ve erişilebilirlik standartlarına uygun TestFly kodu üretir:
java
package io.testfly.examples;
import io.testfly.test.BaseTest;
import io.testfly.locator.Role;
import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
public class CheckoutFlowTest extends BaseTest {
@Test
public void siparisTamamlamaAkisi() {
open("/products");
getByRole(Role.BUTTON).withName("Sepete Ekle").click();
getByRole(Role.LINK, "Ödeme").click();
getByLabel("Ad Soyad").type("Hakan Gül");
getByRole(Role.BUTTON).withName("Siparişi Onayla").click();
assertEquals(getByTestId("order-status").getText(), "ONAYLANDI");
}
}3. Kendi Kendini Onaran Seçiciler (Self-Healing)
testfly.yml içinde self-healing özelliğini etkinleştirin:
yaml
locators:
selfHealing: trueBir seçici DOM değişikliği nedeniyle bulunamadığında TestFly'ın onarım motoru alternatif ARIA ve metin özniteliklerini analiz ederek testi düşürmeden tamamlar.
#TestFly#testfly-mcp#MCP#AI Testing#Self-Healing#Claude#Cursor#SDET