[Reprint] Behavior Driven Development (BDD) Full description

Behavior Driven Development (BDD) Full description

HTTPS: // blog.csdn.net/winteroak/article/details/81585299 

did not seem to be able to come .. need to re-do it.

 


In the software industry, software development projects are often delayed delivery of software products, research and development costs often exceed the budget, often missing software features required for customers, nearly 20% of the final project can not be delivered, or canceled. These software development often spend a lot of money, manpower and time, but delivered to the user of the product features most users will not use it there, or not be able to help you solve the problem.

Software development project failure causes are many and varied, but the end result can be divided into two categories:

Failed to properly research and development software.
Failed to develop the right software.
Failed to properly research and development software, mainly to deliver software that meets quality requirements, software defects are many and difficult to maintain. Failed to develop the right software, mainly in the costs exceed the budget, late delivery of software products, the software features omissions, errors or delivery of product features customers do not have the product features.

In view of this, behavior-driven development (Behavior Driven Development, BDD) draws Agile and Lean practices allow agile product development team as much as possible to understand the needs of product managers or business people, and timely feedback and presentation software products in the software development process R & D status, so that product managers or business people in a timely manner to adjust the software product characteristics product development information obtained. BDD help agile development team to focus on identifying, understanding and build product features with business objectives above, and let the agile development teams to ensure that the identified product features can be properly designed and implemented it.


Figure 1 BDD improve communication level R & D team and operational staff

The introduction of BDD software development team by using the scene full of communication and product features to be implemented, for example, to help the development team to understand the business value of the product characteristics. BDD easier to test the use of software requirements described ways to encourage demand for analysts, software developers, testers carried out in close collaboration software product research and development. Meanwhile BDD tool can help convert business requirements with BDD style described as automated test script that allows software developers to synchronize verification code that I have written meets the product features business needs described, and the formation of a software product characteristics to verify the software product characteristics at the same time documents. In order to achieve the product development documentation and code synchronization software product written update.

BDD is not a software development method, nor is it used to replace the existing theory and agile method Scrum, XP, Kanban, etc., but to integrate existing working methods, so that software development teams to work more efficiently, thereby reducing due to a software product planning delays or loss of function caused by stress.

The use BDD software development process with traditional software development process what difference does it make?

Traditional software development process is this:

Business people want to talk to the software product demand software requirements analysts.

Software requirements analysts to software requirements obtained from the business people there to record and write software requirements specification products based on business needs.

Software developers write software code specification unit test code and software products based on demand.

Software testers according to the software product requirements specification testing requirements analysis, writing test cases (use cases), and the use of test cases for software product for testing.

Finally, the software development team to write software products based on the stable version of the software function descriptions and technical documentation.


2 traditional software development process

Problem with traditional software development model is that the description of the business requirements to software requirements analyst at business people after the software requirements analysts according to their own understanding to write software requirements specification, and R & D personnel software architecture based on software requirements specification and write software code, the last manual testers to write test cases for testing based on software requirements specifications. By the business process requirements to software coding, to software testing, there are different roles and different personnel needed for software development information is processed at different times, there are too many possible opportunity lost among this mistake, even directly ignoring the original requirements of business people. Many aspects of software development, just a link error, software development team it is difficult to deliver on time a software product meets the requirements of business people.

Behavior Driven Development (BDD), behavior-driven development is an agile software development technique that encourages collaboration between software project developers, QA and non-technical or business participants. Behavior Driven Development is particularly suitable for agile projects. Behavior Driven Development composed by a series of software engineering practice, the practice of software engineering can be used to help set R & D team to improve delivery efficiency, delivery quality and deliver value.

BDD introduces agile management, lean thinking research and development, including in particular the test driven development (TDD) and Domain Driven Design (DDD) and other software development methods. Behavior Driven Development (BDD) with simple formatting natural language (including English, Chinese and other languages) to improve the level of communication between the agile development team and product managers or business, making more agile enough R & D team a better understanding of business objectives so as to better meet product demand, product manager or business people.

BDD software development process is this:

Product Manager (operational staff) to tell the software the analyst that he (she) wants what kind of software products through specific scene user stories. Use of the software product use scenarios to describe the software requirements related personnel can avoid misunderstandings software requirements or increased demand for their own subjective imagination as much as possible.

Together with the product manager (business people) user stories software requirements analyst (BA) and R & D teams (developers, testers) analysis, and to tease out the specific software product usage scenarios, for example, these scenes, for example key using a structured word description natural language, such as Chinese, English and so on.

R & D team with BDD tool to user stories scene files into executable code for automated testing, whether developers run automated test cases to validate the developed software products meet the acceptance requirements of the user story scene.

Testers can carry out exploratory manual testing and automated testing based on the test results.

Product Manager (business people) can view real-time automation software development team BDD tool generates test results and test reports to ensure compliance with software product manager (business people) Software expectations.


Figure 3 BDD software development process

How to implement Behavior Driven Development (BDD) it? In fact, prior to this process is the main course section of BDD. We R & D process ticket sales system to sort out the children's shoes Xiao Ming, is the practice of BDD.

Bob summary process using BDD shoes R & D ticket sales system is as follows:
The first step: the boss of the strategic objectives. (Product vision)

Children's shoes are, increasingly fierce market competition, plane ticket booking business has become increasingly difficult. The Board asked us to increase turnover by 20% this year than last year, the cost is reduced by 10%. Today, we convened a meeting purpose is to please the market, sales and research and development of children's shoes brainstorming together, work together to complete this year's business goals.

Step two: the business sector to make specific business goals and software requirements.

Increase the use of frequent flyer points accumulation and function passengers to buy tickets through our e-commerce site or the relevant channels can accumulate mileage points. These points can be used the next time you purchase a ticket credits to purchase tickets, you can also set the points shared, let him (her) friends and family to use their points to buy tickets.
Increase access channel e-commerce site, for example, can be queried by micro-channel or Alipay platform tickets, buy tickets, view, and share the mileage credit
in order to increase the adhesion of the customer, the new user login integration and sharing of information integration, users log in using our e-commerce website more and more, the more points. Users post travel experiences in our e-commerce site or providing information for others to help the group can also earn points. Use these points can be replaced redeem mileage tickets.
The third step: Product Manager (the analyst) and R & D team combed with user stories, and instantiate user story acceptance criteria.

User Story Scene: After registering new members Bronze members of the initial state

# language: zh-CN

Scene: After registering new members Bronze members of the initial state

If: Xiao Ming children's shoes are not a frequent flyer members

When: children's shoes Xiao Ming registered frequent flyer membership, enter information when registering:
| username | password | Email |
|: -: |: -: |: - |: -: |
| xiaoming | 12345678 | [email protected] |

Then: After successful registration, the initial membership level for children's shoes Xiao Ming 'Bronze Membership'

Step four: R & D personnel (testers) use the BDD tools, such as Cucumber, into acceptance test documentation can be run, as well as automated acceptance test cases

@ If ( '^ Xiaoming children's shoes are not a frequent flyer $ ")
public void Xiaoming children's shoes are not a frequent flyer () throws Throwable {
// TODO: Register before Xiaoming children's shoes is not the frequent flyer
throw new PendingException ( );
}

@ when the ( "^ Xiao Ming shoes Register frequent flyer membership: $")
public void Xiaoming shoes Register frequent flyer members (DataTable arg1) throws Throwable {
/// TODO: Xiao Ming shoes registered as members of
the throw new new PendingException ();
}

@ so ( "^ after successful registration, the initial membership levels Xiao Ming children's shoes for 'bronze membership' $ ')
after public void successful registration _ Xiao Ming shoes of initial membership level _ bronze Member () throws Throwable {
// TODO: registration successful after checking Xiaoming shoes membership status
the throw new new PendingException ();
}
step five: R & D personnel based on the user story design software function, write unit tests and implementation code, when the software functionality through unit testing, represents software functionality to meet the design requirements.

{class WhenCheckingMinimumStatusPoints public

FrequentFlyer Member;

@Before
public void newFrequentFlyer () {
Member = FrequentFlyer.newMemberWithUsername ( "Xiaoming") password ( "12345678") In Email ( "[email protected]");..
}

@Test
public void should_have_bronze_status_initially () {
the assertThat (member.getStatus ()) isEqualTo (FrequentFlyerStatus.BRONZE);.
}
Enter code here Wallpaper

}
sixth step: a fourth step researchers running test code generated acceptance, the acceptance test may end the UI layer testing can also be interface testing.

UserRegisterPage the extends the PageObject {class public

@FindBy (name = "username")
Private WebElement username;

@FindBy (name = "password")
Private WebElement password;

@FindBy (name = "In Email")
Private WebElement In Email;


@FindBy (CSS = ".btn [value = 'Sign up']")
Private WebElement Signup;

public void signupAs (String username, the userPassword String, String userEmail) {
username.sendKeys (username);
password.sendKeys (the userPassword);
email.sendKeys (userEmail );

// click on the Register button
signup.click ();
}

}
step Seven: product manager can see real-time acceptance test reports, acceptance testing report is also the product documentation


FIG 4 BDD test generation document

Finally explain, BDD automated test code can use continuous integration platform or DevOps platforms running continuous integration according to the specified rules, which can improve teamwork efficiency, timely publication of unit testing, integration testing, state testing and user acceptance testing.

For more information, please visit:
GitBook: Ten Tips Fun Agile Testing
 

Guess you like

Origin www.cnblogs.com/jinanxiaolaohu/p/12190451.html