DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Newsletter
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Latest Articles - DZone

article thumbnail
Bad or Good? Behavior Driven Development within Scrum.
I wanted to explore the possibility of using JBehave to formalize scrum's definition of done. The idea being to encapsulate a definition of done as a JBehave scenario. So in true scrum style I decided to timebox 4 hours of work dedicated to JBehave. From a scrum point of view BDD can be used to turn the definition of done into a test artifact. The team produces scenarios for each task. With JBehave a scenario file describes the required behavior and test steps it will need to pass to be considered done. I.e Given some prerequisites, perform some action and expect some results. See the JBehave project for more detail as this is only a simple example. Why Examine This Topic? It is useful to examine anything that a programmer may use in the course of doing their work. Not only should we challenge the assumptions that are floating around out there about different programs, but it may also be useful to look at the resources that are available to us and ask ourselves if we are truly using them in the most effective ways possible. There is always the chance that just taking a hard look at some of the elements of the work that we do may help us understand where it can be improved upon when the time comes. Indeed, many people find the concept of examining such things quite appealing, and that leads to major research into these topics. There are a lot of people making incredible strides towards getting things done that the world never believed was possible, but those changes are happening rapidly, and we should all be thankful that this is the case. BDD in 4 hours? So scenarios are just text files describing the required functionality in terms of expected behavior. Even before development though, it's possible to run them and see the pending expectations. Let's wizz through a simple example showing who in a scrum team is responsible for what. I already have a project that I use to explore test patterns so I thought I would just introduce it to that. If you want the working version just take a fork from GitHub. Nb. I have a data fixture used in testing a complex page component. So whilst not a pure scenario I can make its existence part of the Givens. In this project, it's likely that no real given is required, but a developer would add it during the build. First the product owner and tester produce a simple scenario file describing behavior and expectations. Given a data fixture When a page is created with 20 items on a page Then expected lines on a page is 4 with data items in a line 5 Next developers write a harness and flesh out the steps required to meet the behavior. We need to bootstrap the scenario and add steps to it. The general idea is to have a scenario test, that then includes the steps. This is one way of bootstrapping in the steps, other ways are available including a spring system that uses SpringStepsFactory. I ran into problems with the spring system as my project uses spring 3 and JBehave is still locked into spring 2.5.6. In addition, I am using junit 4.8 and spring 2.5.6 requires 4.4. This is ultimately an issue as on many projects. I would not want to tie in those older versions. In fact, other ideas in my project prevent me from doing this too. So in my timebox, I avoid the issue and bootstrap manually. The Bootstrap test class public class SimplePageScenario extends JUnitScenario { public SimplePageScenario() { super(new MostUsefulConfiguration() { @Override public ScenarioDefiner forDefiningScenarios() { return new ClasspathScenarioDefiner( new UnderscoredCamelCaseResolver(".scn"), new PatternScenarioParser()); } }); addSteps(new SimplePageSteps()); } } Before adding the call to addSteps()) running the scenario shows the steps that are pending. (org/testpatterns/scenarios/example_scenario.scn) Scenario: Given a spring data fixture (PENDING) When a page is created with 20 items on a page (PENDING) Then expected lines on a page is 4 with data items in a line 5 (PENDING) Finally the developers fill in the Steps class adding sections that match against the scenario keywords, Given, When and Then. Development is done until the behavior passes the test. public class SimplePageSteps extends Steps { private SimplePage page; private final PageDataFixture dataFixture = new PageDataFixture(); @Given("a data fixture") public void givenASpringDataFixture() { notNull(dataFixture); } @When("a page is created with $itemsOnAPage items on a page") public void createPage(int itemsOnAPage) { page = SimplePage.newInstance(dataFixture.getDataItem(), itemsOnAPage); } @Then("expected lines on a page is $linesOnAPage with data items in a line $itemsInALine") public void validatePage(int linesOnAPage, int itemsInALine) { Map expectedLines = dataFixture.createPageExpectation(linesOnAPage, itemsInALine); Map actualMap = page.getMap(); ensureThat(actualMap, is(expectedLines)); } } Good Points I like the potential to get key scrum members interacting. The collaboration between the testers and the product owner is an important one as it should flesh out questions about behavior at an early stage. Similar benefits occur when the development team starts to get to grip on the behavior. Having a simple scenario artifact means the product owner can get involved with something that actually becomes part of the continuous integration. Bad Points The bootstrap is clumsy. Having to add steps means that after producing the new scenarios development has to get involved before the pending steps appear. There are other ways to bootstrap. The spring system is a step in the right direction, in fact I would like to use injection throughout the application. This still does not solve the problem of having to edit something before the steps appear. I would prefer that once the scenario is in place, steps are automatically found as they are written, and appear as not started until they are cut. Extending the Junit Testcase is also a problem. It's highly likely that in more complex projects we would need mocking techniques or spring-based tests. These have their own runners brought in with the @RunWith annotation. It would be better if there were some way to bootstrap the behavior into any other test framework. In my 4-hour timebox, I did not get the reporting working. Unfortunately, the reporting requires more coding, and setup and is far from being just a bit of maven configuration. When running from maven, things didn't work until I configured the maven-resource-plugin to copy over the scenario files. This should have just worked out of the box. Most of my 4 hours were taken up with configuration which was compounded by the slim documentation. Conclusion Attempting a behavior-driven approach using scenarios is worth doing. I could see the benefits. Not sure if JBehave is the solution for me though. Difficult to configure, and incompatibilities with other frameworks would put me off at the moment. I will find some time to have a look at easyb another Java BDD system next.
August 12, 2022
by $$anonymous$$
· 14,269 Views · 1 Like
article thumbnail
The Digital Finance Revolution, Open Banking, and APIs
Open banking and APIs are at the heart of the digital finance revolution. Monitoring APIs helps protect banks from issues including failures and slow-downs.
August 12, 2022
by Mehdi Daoudi
· 4,949 Views · 1 Like
article thumbnail
How to Govern Terraform States Using GitLab Enterprise
Most companies relying on Terraform for infrastructure management choose to do so with an orchestration tool. How can you govern Terraform states using GitLab Enterprise?
August 12, 2022
by Sefi Genis
· 5,067 Views · 1 Like
article thumbnail
How I Created a Smart Video Clip Extractor
Learn how to integrate a highlight video extractor into a video editor app for easy vlog creation.
August 12, 2022
by Jackson Jiang
· 3,567 Views · 2 Likes
article thumbnail
Custom Validation in Mule 4 Using Mule SDK
This article describes Currency Code Validation in Mule 4 using the Mule SDK.
August 12, 2022
by Shyam Raj Prasad
· 5,526 Views · 3 Likes
article thumbnail
Rust’s Ownership and Borrowing Enforce Memory Safety
By using an ownership model, Rust takes a novel approach to ensure memory safety at compile time.
August 11, 2022
by Senthil Nayagan
· 5,726 Views · 2 Likes
article thumbnail
5 Data Models for IoT
This blog presents five data modeling approaches to solve IoT data problems with Apache Cassandra.
August 11, 2022
by Artem Chebotko
· 8,152 Views · 1 Like
article thumbnail
4 Reasons MSPs Should Monitor Their GitHub Footprint
In this article, we will see why monitoring in real-time code-sharing platforms such as GitHub should be a top priority for any MSP.
August 11, 2022
by Thomas Segura
· 4,080 Views · 3 Likes
article thumbnail
How to Choose the Right Digital Experience Monitoring Solution
It would be best if you had digital experience monitoring for a transparent view of your IT infrastructure and how well it supports the needs of your customers.
August 11, 2022
by Mehdi Daoudi
· 3,626 Views · 1 Like
article thumbnail
Five Steps To Building a Tier 1 Service That Is Resilient to Outages
If Tier 1 services fail, it can mean disaster for a business. To ensure resiliency from outages, follow a proven five-step process.
August 11, 2022
by Pradeep Chinnam
· 7,067 Views · 4 Likes
article thumbnail
On Some Aspects of Big Data Processing in Apache Spark, Part 1: Serialization
In this post, review the basics of how Apache Spark runs its jobs and discover how to avoid serialization errors.
August 11, 2022
by Alexander Eleseev DZone Core CORE
· 7,262 Views · 2 Likes
article thumbnail
Conceptual Architecture: Conversational AI/NLP-Based Platform
Conceptual Architecture for Conversational Artificial Intelligence (AI) / Natural Language Processing (NLP) based Platform for Customer Support and Agent Services.
August 11, 2022
by Chandra Manohar
· 10,747 Views · 3 Likes
article thumbnail
Hide Your API Keys With an API Proxy Server
The main goal of this article/tutorial is to demonstrate how to conceal public API keys by building an API proxy server using NodeJS.
August 11, 2022
by Pantelis Theodosiou
· 5,795 Views · 2 Likes
article thumbnail
3 Must-Knows on Secure B2B Communication and AS2: The One-Stop Solution
Read an overview of the basics of cryptographically secured communications, with some real-world use cases to highlight the importance of this security measure.
Updated August 11, 2022
by Janaka Bandara
· 6,148 Views · 3 Likes
article thumbnail
How Big Data Is Shaping the Future of HR Analytics
Big data in HR enables organizations to make better decisions regarding hiring, firing, and managing their employees.
August 11, 2022
by Ryan Kh
· 5,049 Views · 3 Likes
article thumbnail
Key Highlights from the New NIST SSDF
In this article, we’ll be going over the 1.1 revision of the Secure Software Development Framework that was published earlier this year.
August 11, 2022
by Shimon Brathwaite
· 5,329 Views · 1 Like
article thumbnail
5 Steps to Rethink High Severity to Save Developer Productivity
Security remediations occupy a growing portion of developers’ time. We can reframe how we define a "critical" vulnerability and ask: Is it attackable?
August 11, 2022
by Arun Balakrishnan
· 5,071 Views · 1 Like
article thumbnail
GitHub Events Are Booming! Are Bots the Reason?
This article dives deeply into GitHub event trending, why GitHub events are surging, and whether GitHub's architecture can handle the increasing load.
August 11, 2022
by Mia Zhou
· 4,834 Views · 3 Likes
article thumbnail
Why Should You Choose ReactJS for Your Next Project?
Apart from creating high-performance apps, do you know why ReactJS is the best choice for your project?
August 11, 2022
by Kiran Beladiya
· 5,204 Views · 3 Likes
article thumbnail
Azure Databricks Automated Testing Using Great Expectations and C#
This article will show you how to use the Great Expectations library to test data migration and how to automate your tests in Azure Databricks using C# and NUnit.
August 11, 2022
by Mohammed Basil
· 11,602 Views · 3 Likes
  • Previous
  • ...
  • 692
  • 693
  • 694
  • 695
  • 696
  • 697
  • 698
  • 699
  • 700
  • 701
  • ...
  • Next
  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook
×