Upload
tanjai-kongyuen
View
206
Download
3
Embed Size (px)
Citation preview
Agile Thailand 2016 at Gosoft9 July 2016 #ATH2016
SPEAKER
Tanjai Kongyuen
Tester at Kaidee Mail :[email protected]
Facebook : tanjaik Blog : https://medium.com/tanjai
Behaviour Driven Development ÁѹäÁè§èÒÂ
• What is BDD • Cucumber • Êèǹ»ÃСͺ¢Í§ Cucumber • áÅéÇÁѹäÁè§èÒµçä˹ÅèÐ ? • ÊÔ觷Õè¤ÇÃà»ÅÕè¹ à¾×èÍ àÃÔèÁãªé Cucumber • ˹ѧÊ×Í ÊÓËÃѺÍèÒ¹à¾ÔèÁàµÔÁ
\(^.^)/
What is BDD
❖ ¡ÒþѲ¹Ò«Í¿·ìáÇÃìẺ Behaviour Driven development µÑ駵é¹ÇèÒ éÇ Explore > Discover > Define > Drive ¡è͹¡ÒÃŧÁ×Í·Ó§Ò¹
Start with “Give Me an Example”
Concrete Example
Cucumber❖ Cucumber à»ç¹ ª×èÍ Tools µÑÇ˹Öè§ «Ö觹ÓÁÒãªé㹡ÒþѲ¹Ò«Í¿·ìáÇÃìẺ Behaviour Driven development µÑ駵é¹ÇèÒ éÇ ¾ÄµÔ¡ÃÃÁ ·Õè user ¨Ðãªé§Ò¹¡ÑºÃкº¢Í§àÃÒ ÁÕ Scenario Ẻä˹ à¢Õ¹ Acceptance Test µÒÁ¹Ñé¹
❖ Cucumber ÁÕ 2 ä¿Åì éÇ¡ѹ·Õè·ÓãËéÁѹ·Ó§Ò¹ä é Feature File ¡Ñº Step File
❖ Cucumber Âѧà»ç¹µé¹áºº ãËé ÀÒÉÒÍ×è¹æ àªè¹ Behave (Python), Lettuce (Python) , RSpec(Ruby) , Spinach (Ruby) , Behat (Php)
❖ à¢Õ¹¤ÃÑé§à ÕÂÇ ãªéä é¡Ñº ·Ñé§ Mobile Apps / Web
Cucumber Ingredient : Feature File
❖Feature File ¤×Í File ·Õèà¢Õ¹ºÍ¡ÇèÒ àÃҾѲ¹ÒÍÂÙè¤×ÍÍÐäà ❖ã¹ Feature ºÍ¡ Scenario (Test Case) ÇèÒ ÁÕ Scenario ÍÐäúéÒ§ ❖à¢Õ¹ã¹ÃٻẺ·ÕèàÃÕ¡ÇèÒ Gherkin Syntax Support ÀÒÉÒÍѧ¡ÄÉ áÅÐ ÀÒÉÒä·Â¡çä é¹Ð!
Credit Picture from : P’Roof
Scenario
❖ Given = an initial context
❖ When = an event, or an action. This can be a person interacting with the system, or it can be an event triggered by another system.
❖ Then = an expected outcome, or result.
❖ And = ¤Óàª×èÍÁ
“´Ù§èÒÂà¹ÍД
Cucumber Ingredient : Step File
❖Step File à»ç¹ File ·Õèà¢Õ¹ éÇ Programming language àªè¹ Ruby , Java , Groovy , Python ❖·ÓäÁµéͧà¢Õ¹à»ç¹ Programming language ¡çà¾×èÍ·Õè ¤ÍÁ¾ÔÇàµÍÃì¨Ðä éà¢éÒã¨áÅÐÍèÒ¹ÍÍ¡ ·ÓµÒÁä éä§ÅèÐ
Cucumber Ingredient : pom File
❖ Pom File Áѹ¤×ÍÍÐäÃ
Pom File ãÊèà¾ÔèÁàµÔÁà¾×èÍ Ñ´¡ÒÃãËé Script ·ÕèàÃÒà¢Õ¹¢Öé¹ ·Ó§Ò¹ä é ¡Ñº Selenium Webdirver , Junit «Öè§ãªé㹡Ò÷´Êͺ ¡Ñº Web
Dependencies ·Õèãªé ÁÕ Selenium , Cucumber-Junit , junit
ÁÒ¶Ö§µÃ§¹ÕéáÅéÇ Âѧ§èÒÂÍÂÙè»èÒÇ ?
Demo
áÅéÇÍÐäÃÅèзÕèà»ÅÕè¹ä»
Before planting cucumber
❖ ÃÙé Ñ¡Ãкº , feature ·ÕèàÃÒÁÕ㹵͹¹Õé , feature ·Õè¡ÓÅѧ¨ÐÊÃéÒ§ãËÁè
❖ ·´Êͺ·ÕÅÐ feature
❖ feature ä˹ãªéºèÍÂæ ¾Í·Õè¨ÐàÍÒÁÒ·Ó automated test ä éºéÒ§
❖ feature ·ÕèàÅ×Í¡ÁÒ ÁÕ criteria 㹡Ò÷ӧҹÍÂèÒ§äà ¤Ø¡Ѻ Product , Developer ãËéà¢éÒ㨵ç¡Ñ¹
❖ áµèÅÐ criteria ÁÕ scenario ·Ó§Ò¹ÍÂèÒ§äà ֧ä»à¨Í criteria ¹Ñé¹
Feature : Login
❖ Login ÁÕ Success scenario Âѧ䧺éÒ§
❖ àÃÔèÁ¨Ò¡ Success Scenario ¡è͹
❖ à¢Õ¹·ÕÅÐ Scenario
❖ Run Success Scenario ãËéÊÓàÃç¨ Test Pass ¡è͹
❖ ÊÓàÃç¨áÅéÇ ¤èÍÂà¾ÔèÁ Scenario ¶Ñ´ä»
Prepare to plant cucumber
Prepare to plant cucumber❖ IDE : IntelliJ ม Plugin Cucumber เชน Cucumber-JVM ,
Cucumber-Groovy , Cucumber-Scala
❖ Editor : ãªé Sublime Text2 ¡çä´éà¾×èÍà¢Õ¹ feature file ม snippet (plugin) ชวยเขยน feature file àÂÍÐ áµè äÁèÊÒÁÒö generate step file ä é¹Ð
❖ Coding Knowledge : Basic Java , Basic Groovy
❖ Selenium : selenium blinding with java
❖ JUnit
Books & Link
The Cucumber Book (Ruby)
The Cucumber for Java Book
Cucumber Recipes
Specification By Example
Link : https://cucumber.io/docs
Credit
❖ Video Chapter 1 : Give Me an example from https://cucumber.io/school
❖ Picture from : Give me an example from cucumber school : https://cucumber.io/school
Q&A