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
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
View Events Video Library
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Integrating PostgreSQL Databases with ANF: Join this workshop to learn how to create a PostgreSQL server using Instaclustr’s managed service

Mobile Database Essentials: Assess data needs, storage requirements, and more when leveraging databases for cloud and edge applications.

Monitoring and Observability for LLMs: Datadog and Google Cloud discuss how to achieve optimal AI model performance.

Automated Testing: The latest on architecture, TDD, and the benefits of AI and low-code tools.

Trending

  • Build a Serverless App Fast With Zipper: Write TypeScript, Offload Everything Else
  • GenAI-Infused ChatGPT: A Guide To Effective Prompt Engineering
  • Spring WebFlux Retries
  • LTS JDK 21 Features

Handling Work-in-progress with Thucydides and JBehave Using @pending and @wip Tags

John Ferguson Smart user avatar by
John Ferguson Smart
·
Sep. 02, 14 · Interview
Like (1)
Save
Tweet
Share
3.70K Views

Join the DZone community and get the full member experience.

Join For Free

thucydides version 0.9.268 has just been released, with a few very interesting new features. thucydides is an open source reporting library that helps you write more effective bdd-style automated acceptance criteria, and generate richer test reports, requirements reports and living documentation. in this article, we will look at some of the new ways this version lets you handle work-in-progress or pending scenarios with thucydides and jbehave.

in jbehave, a scenario is considered passing if all of the step definitions are implemented, even if there is no code. this is because there is no obligation to use step libraries within the step definitions, though it is a good practice for more complex tests. consider the following scenario:

scenario:logging on via facebook
givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

when you execute this with no step definitions, it will be reported as pending, as illustrated here:

pending_steps

when you implement the steps, they will be considered successful unless an exception is thrown or a step is marked as pending. so the following will indeed pass:

 @given("$username has registered online via facebook")

    public void has_registered_via_facebook(string username){}

this is because there is no way to know that a step definition is empty - we can only know that no @step methods were called, which does not necessarily mean that it is empty.

you can make this a pending step by using the org.jbehave.core.annotations.pending pending annotation, e.g:

@pending
    @given("$username has registered online via facebook")
    public void has_registered_via_facebook(string username) {}

jbehave and thucydides will now report this scenario as pending, even though it has an "implemented" (albeit empty) step definition:

step-details

this is also a good way to keep track of work if you are driving the code from the step definitions, as you can easily see which steps have been done at any point in time.

the @ignore tag lets you skip a story during test execution, so that it does not appear in the reports.

meta:
@ignore

scenario:logging on via facebook
givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

if you want a scenario to appear in the report, but to mark it as 'pending' even if it fails, you can use the @pending tag directly within the story files, e.g.

meta:
@pending

scenario:logging on via facebook
givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

scenario:logging on via twitter
givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

or, for an individual scenario:

scenario:logging on via facebook
meta:
@pending

givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

in this case, the entire scenario or story/feature will be reported as 'pending':

screen shot 2014-08-20 at 4.48.10 pm

you can also distinguish between work that hasn't been started yet and work that is in progress but not yet complete. the @skip or @wip tags will act like the @pending tag, but will report the scenario or story as "skipped".

scenario:logging on via facebook
meta:
@wip

givenjoeis a frequentflyer member
andjoe has registered online via facebook
whenjoe logs on with a facebook token
then he should be given access to the site

these will appear differently in the reports, as shown here:

screen shot 2014-08-20 at 5.10.59 pm

this is a good way to identify what features are currently being worked on.

the following table summaries these options:

what where outcome
@pending annotation step definition code individual step is flagged as 'pending'
@pending tag scenario metadata in the .story file the whole scenario is flagged as 'pending'
@pending tag story metadata in the .story file all the scenarios in the story file are flagged as 'pending'
@skip or @wip tag scenario metadata in the .story file the whole scenario is flagged as 'skipped'
@skip or @wip tag story metadata in the .story file all the scenarios in the story file are flagged as 'skipped'
@ignore tag story or scenario metadata in the .story file the story/scenario will not be executed and will not appear in the reports

Published at DZone with permission of John Ferguson Smart, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.


Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

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

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: