Assertion ne demek?

Assertion, Türkçede “doğrulama ifadesi” ya da “beklenti kontrolü” anlamına gelir.

əˈsɜːrʃnisimSık kullanılan terim

Yazılım İngilizcesi · Yazılım Testi

Bir testte sonucun beklenen değerle eşleşip eşleşmediğini kontrol eden satır. Kontrol yanlış çıkarsa test başarısız olur.

English: A line in a test that checks whether a result matches the expected value. If the check is false, the test fails.

Nerede ve nasıl kullanılır?

assertEquals, expect(...).toBe(...) ya da Python'daki assert gibi yapılarla yazılır. Bir test çok az şey kontrol ediyorsa inceleyenler 'a stronger assertion' ister. Çıktıdaki 'Assertion failed' veya 'AssertionError', hangi kontrolün bozulduğunu gösterir. Türk ekiplerde 'assert' ya da 'assertion' denir.

Örnek cümleler

  1. This test has no assertions, so it passes even when the function returns garbage.

    Bu testte hiç assertion yok; fonksiyon saçma bir değer döndürse bile geçiyor.

  2. Add an assertion for the error message, not just for the status code.

    Sadece durum kodu için değil, hata mesajı için de bir assertion ekle.

Sık kullanılan kalıplar

  • add an assertion
  • the assertion fails
  • assertion error
  • a stronger assertion