API Testleri
TestFly, kutu dışında saf API testlerini ve hibrit UI + API testlerini destekler — aynı framework, aynı yapılandırma, aynı rapor.
Saf API Testleri — BaseApiTest
BaseTest yerine BaseApiTest'i genişletin. Tarayıcı başlatılmaz; framework yaşam döngüsünün tamamı yine de geçerlidir (raporlama, @TestData, retry, CI eşikleri).
import io.testfly.test.BaseApiTest;
import io.testfly.client.ApiClient;
import io.testfly.client.ApiResponse;
import org.testng.annotations.Test;
public class UserApiTest extends BaseApiTest {
@Test
public void getUserById() {
ApiResponse res = ApiClient.get("https://api.example.com/users/1")
.send();
res.assertStatus(200);
res.assertJson("$.name", "John Doe");
}
}