Slide 1

Slide 1 text

TDD Test Driven Development

Slide 2

Slide 2 text

Test'le Yürüyen/İlerleyen Geliştirme

Slide 3

Slide 3 text

?? ?

Slide 4

Slide 4 text

TEST TÜRLERİ • Verification & Validation • Quality Assurance • TDD

Slide 5

Slide 5 text

Verification & Validation / QA KODU YAZ TEST'i YAZ TEST'i ÇALIŞTIR REFACTOR

Slide 6

Slide 6 text

TDD

Slide 7

Slide 7 text

ÖNCE HAYAL ETTİĞİN UYGULAMAYI TANIMLA BEKLENTİLERİNİ BELİRLE! TEST'LERİNİ ÇALIŞTIR

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

SONRA TEST'LERİ ÇALIŞTIR VE HEPSİNİ BAŞARIYLA GEÇ!

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

EN SONDA YAZDIĞIN KOD'LARI DÜZENLE!

Slide 12

Slide 12 text

RED (Kırmızı) 1 TEST FAIL EDECEK! Henüz ilgili fonksiyonlar/sınıflar yazılmadı!

Slide 13

Slide 13 text

GREEN (YEŞİL) 2 TÜM TESTLER PASS ETTİ! Şimdi sırada REFACTOR etmek var!

Slide 14

Slide 14 text

TEST YAZ / ÇALIŞTIR FAIL EDENLERİ GÖR KOD'U DÜZELT TEKRAR ÇALIŞTIR REFACTOR

Slide 15

Slide 15 text

FAYDALARI • BUG FREE geliştirme • Hızlı geliştirme • Dökümantasyon yazma zahmetinden kurtarıyor • Sürdürülebilir kod yazma • Uçtan uca uygulamayı görmek • Deployment otomasyonunda kolaylık • Test Coverage

Slide 16

Slide 16 text

DEZAVANTAJLARI • Legacy code'a entegre etmek sorun olabilir • Test'lerin maintenance işi ve test süresi • "Quick Edit" mini değişimler için zor • False Positives • Edge Case'leri mutlaka tamamlamak gerek

Slide 17

Slide 17 text

TEST YAZACAK ZAMANIM YOK

Slide 18

Slide 18 text

!

Slide 19

Slide 19 text

TEST YAZACAK ZAMANIM YOK BUNU SÖYLEYEN CAHİLDİR!

Slide 20

Slide 20 text

require 'test/unit' class TestPalindrome < Test::Unit::TestCase def test_palindrome palindromes = ["anastas mum satsana", "kuk"] not_palindromes = ["hello", "mello"] palindromes.each{|str| assert palindrome?(str)} not_palindromes.each{|str| assert !palindrome?(str)} end end def palindrome?(string) string.reverse == string end

Slide 21

Slide 21 text

Loaded suite untitled Started . Finished in 0.001015 seconds. 1 tests, 4 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed 985.22 tests/s, 3940.89 assertions/s

Slide 22

Slide 22 text

Unit Tests Uygulama içindeki en küçük parçaları fonksiyonları test ettiğimiz test. Hatta buna Functionality Testing de denir.

Slide 23

Slide 23 text

Integration Tests Kod içindeki farklı parçacıkların birbirleriyle olan entegrasyonlarını / ilişkilerini test eden test.

Slide 24

Slide 24 text

Acceptance Tests Baştan sona tüm fonksiyonalitenin, entegrasyonun test edildiği test. Bu test'e END to END Testing de denir.

Slide 25

Slide 25 text

Sağlıklı Test Akışı 1. Unit Tests 2. Integration Tests 3. Acceptance Tests

Slide 26

Slide 26 text

TEST ARAÇLARI

Slide 27

Slide 27 text

rspec cucumber mini-test test-unit capybara selenium

Slide 28

Slide 28 text

Fixture ve Factory Testleri yapabilmek için gerekebilecek fake datalar / dublörler

Slide 29

Slide 29 text

it "allows setting these responses" do fake_person = double("Person") allow(fake_person).to receive_messages(:full_name => "Uğur Özyılmazel") expect(fake_person.full_name).to eq("Uğur Özyılmazel") end it "stubs desired year on a real Time object" do time = Time.new.now allow(time).to receive(:year).and_return(1972) expect(time.year).to eq(1975) end

Slide 30

Slide 30 text

factory_girl rspec-mocks mocha rr faker fabrication

Slide 31

Slide 31 text

TEST FIRST! Teşekkürler