Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Code Katas
for Magento 2
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Code Kata?
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
We practice our craft.
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
Like an 80s movie
Training Montage
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@Vina...
Today's Kata:
Magento 2 Total Model
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@Vin...
Training Module: Example_GiftItem
Add a free water bottle to the cart
when the customer adds a product from the
sample dat...
Training Module: Example_GiftItem
The gift item total model is responsible for
setting the price of gift items to zero.
ht...
What does this
kata teach?
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
(1/2) Generic skills:
4 TDD Red-Green-Refactor process
4 Working with stubs & mocks
4 Separating pure functions and
side e...
(2/2) Magento 2 skills:
4 Test driving Magento code
4 Memorizing the total model architecture
4 Dealing with Law of Demete...
Getting started:
# Create module dir
mkdir -p app/code/Example && cd app/code/Example
# Clone repo
git clone https://githu...
Kata Task:
Test drive the Example_GiftItem total model
ModelTotalsGiftItemAddressTotal
TDD Magento 2 Kata - #MageTestFest,...
Target collect() behavior:
4 Subtract gift item row totals and base row totals
from the subtotal
4 Set calculation_price
a...
Enjoy the session and feel
those reflexes get sharper!
TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.c...
Upcoming SlideShare
Loading in …5
×

Magento 2 TDD Code Kata Intro

463 views

Published on

Intro slides for the Magento 2 code kata session at #MageTestFest on the 17. November 2017.

Published in: Technology
  • Be the first to comment

Magento 2 TDD Code Kata Intro

  1. 1. Code Katas for Magento 2 TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  2. 2. Code Kata? TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  3. 3. We practice our craft. TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  4. 4. Like an 80s movie Training Montage TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  5. 5. Today's Kata: Magento 2 Total Model TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  6. 6. Training Module: Example_GiftItem Add a free water bottle to the cart when the customer adds a product from the sample data Bags attribute set. https://github.com/Vinai/module-example-giftitem TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  7. 7. Training Module: Example_GiftItem The gift item total model is responsible for setting the price of gift items to zero. https://github.com/Vinai/module-example-giftitem TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  8. 8. What does this kata teach? TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  9. 9. (1/2) Generic skills: 4 TDD Red-Green-Refactor process 4 Working with stubs & mocks 4 Separating pure functions and side effects TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  10. 10. (2/2) Magento 2 skills: 4 Test driving Magento code 4 Memorizing the total model architecture 4 Dealing with Law of Demeter violations TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  11. 11. Getting started: # Create module dir mkdir -p app/code/Example && cd app/code/Example # Clone repo git clone https://github.com/Vinai/module-example-giftitem.git GiftItem cd GiftItem # Check out git tag git checkout beginning-of-kata TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  12. 12. Kata Task: Test drive the Example_GiftItem total model ModelTotalsGiftItemAddressTotal TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  13. 13. Target collect() behavior: 4 Subtract gift item row totals and base row totals from the subtotal 4 Set calculation_price and base_calculation_price of every gift item to zero 4 Call calcRowTotal on each item TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp
  14. 14. Enjoy the session and feel those reflexes get sharper! TDD Magento 2 Kata - #MageTestFest, Nov. 2017 - contact@vinaikopp.com - twitter://@VinaiKopp

×