Testimi & QA

Arrange-Act-Assert (AAA)

Në shqip: Përgatit, Vepro, Kontrollo

ShpjegimiSQ

Struktura më e qartë e një testi: Arrange (përgatit të dhënat), Act (ekzekuto veprimin), Assert (kontrollo rezultatin). Te BDD quhet Given–When–Then. Një test i mirë teston një gjë të vetme.

EnglishEN

The clearest test structure: Arrange (set up the data), Act (perform the action), Assert (check the result). In BDD it's called Given–When–Then. A good test tests one thing only.

Si ta mendosh

Si një eksperiment shkencor: përgatit, provo, vëzhgo.

Lexoje në anglisht

Like a science experiment: set up, try, observe.

Shembull kodipython

def test_depozita():
    llogaria = Llogari(bilanci=100)   # Arrange
    llogaria.depozito(50)             # Act
    assert llogaria.bilanci == 150    # Assert

Terma të lidhur