Agile methodologies based on BDD and CI by Nikolai Shevchenko

496 views

Published on

Published in: Technology

Agile methodologies based on BDD and CI by Nikolai Shevchenko

  1. 1. 1• Agile Methodology based on BDD and CICreated by Nicolai Sevcenco
  2. 2. Agile Methodology based on BDD and CI What is BDD?Behaviour-Driven Development (BDD) is about implementing an application by describing itfrom the point of view of its stakeholders2ReqsDoneTest “Golden triangle” between BArequirements, acceptance tests andthe “Done” criteria for a featureused by developersTeam effort: BA QA (manual & automation) Developer/ Architect BA, QA and Dev. teams speak thesame language (Gherkin, etc)AgileTeam
  3. 3. 3
  4. 4. User Stories BDD revolves around the concept of a Story, which represents an automaticallyexecutable increment of business functionality. At its core a Story comprises of oneor more Scenarios, each of which represents a concrete example of the behaviour of thesystem. Each Scenario comprises of a number of executable steps. These Steps can beof three types:41 Scenario: When a user enters an incorrect password on to Login page,the corresponding error message should be displayed.2 Given a user tst150005684 !-- comments are here3 Given an incorrect password "test9033T"4 When the user enters account to the account text box5 When the user enters an incorrect password to the password text box6 When the user clicks the login button7 Then the "Incorrect password or user name" must be displayed
  5. 5. 5public class LoginPage { // hey Im POJOprivate String accnt;private String passwd;@Given("a user $account")public void givenAUser(final String account){this.accnt = account;}@Given("an incorrect password $pwd")public void givenAnIncorrectPassword(final String pwd){this.passwd = pwd;}@When("the user enters account to the account text box")public void userEntersAccount() {page.getSeleniumImpl().getDriver().findElement(By.name("USERID")).sendKeys(userId);}@When("the user enters an incorrect password to the password text box")public void userEntersPassword() {page.getSeleniumImpl().getDriver().findElement(By.name("PASSWORD")).sendKeys(password);}@When("the user clicks the login button")public void userClicksLoginButton() {page.getSeleniumImpl().getDriver().findElement(By.id("loginBtn")).click();}@Then("the $errmsg must be displayed")public void checkErrMessage(final String errmsg){Assert.assertTrue(this.loginPageImpl.checkForWrongUserIdOrPasswordMessage());}
  6. 6. How to exclude needless code duplications an Allias annotation with the new matching step pattern comes into play:6@When("the item price is $price")@Alias("the item price becomes $price") // single aliaspublic void theItemPriceIs(double price) {// ...}
  7. 7. 7Oracle
  8. 8. Development and QA consideration points8 BDD can help development team focus on the user’s needs and the expectedbehavior instead of jumping ahead and getting caught up in implementation detailsupfront. Much lower barrier-to-entry for new members as a result of common language(Gherkin, etc) between BA, QA and Dev. teams. Perceive unit tests more like “change detectors” rather than tests with reliablefailures reports. BDD helps to shift expectations towards reusing automatedfunctional/ regression tests and acceptance tests. Greater ROI: Behavior has a much longer shelf life than implementation andimplementation related documentation. Also as the business rules change, BDDcaptures it better than it being lost in documents and code. Predictability & Confidence: BDD makes much better predictability and confidenceto the team work. A genuine collaboration between business, QA and development: Automation team produces automated functional/regression and acceptance tests Dev. team re-uses automated tests to leverage unit tests coverage as well as automationteam may use unit tests, produced by developers, to better understand thesystem/application. Business justifies priorities by showing concrete value thru the provided stories.
  9. 9. BDD Toolkits9GherkinJBehaveSelenium + JBehaveHTML
  10. 10. CI - Continues Integration10 Main principles: Integrates source code and runs test after each commit to the source repository Near-immediate (as quickly as possible) feedback to the “agile” team once detectingintegration errors. Benefits: Eliminates deferred integration which is very hard to predict how long it will take to do. Having a good test suite can dramatically easier to find and remove bugs. Frequent deployments: are valuable because they allow your users to get new featuresmore rapidly, to give more rapid feedback on those features, and generally become morecollaborative in the development cycle. Toolkit: Cruise Control Apache Continuum JetBrains Team City Hudson Jenkins
  11. 11. 11
  12. 12. This document contains confidential information for use by TD AMERITRADE Holding Corporation and its subsidiaries. 12Q U E S T I O N SA N S W E R S

×