TestFly Bölüm 4: testfly-mcp ile yapay zeka destekli test üretimi ve kendini onaran seçiciler
testfly-mcp ile TestFly'ı Claude, Cursor ve Copilot'a bağlayıp canlı tarayıcı oturumlarını kaydetmeyi, semantik Java kodu üretmeyi ve kırılan seçicileri onarmayı anlatıyorum.
28 Ağustos 20261 dk okuma
Model Context Protocol ve TestFly
TestFly, testfly-mcp sunucusu üzerinden Claude Desktop, Cursor, Copilot ve Antigravity gibi yapay zeka asistanlarına doğrudan bağlanıyor.
testfly-mcp kurulumu
Sunucuyu mcp_config.json dosyanıza ekleyin:
json
{
"mcpServers": {
"testfly-mcp": {
"command": "npx",
"args": ["-y", "testfly-mcp@latest"]
}
}
}Doğal dilden TestFly kodu üretmek
Yapay zeka MCP üzerinden canlı bir tarayıcı açıyor, adımları sayfada deniyor ve erişilebilirlik standartlarına uygun TestFly kodu yazıyor. Sipariş akışı için çıkan kod şöyle:
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");
}
}Kendini onaran seçiciler (self-healing)
testfly.yml içinde self-healing özelliğini açın:
yaml
locators:
selfHealing: trueBir seçici DOM değişikliği yüzünden bulunamazsa TestFly'ın onarım motoru alternatif ARIA ve metin özniteliklerine bakıyor ve test düşmeden tamamlanıyor.
#TestFly#testfly-mcp#MCP#AI Testing#Self-Healing#Claude#Cursor#SDET