Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7802411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:15:25+00:00 2026-06-02T01:15:25+00:00

I need to write a class for enforcing rules about items which may or

  • 0

I need to write a class for enforcing rules about items which may or may not be added to the same container in a warehouse, and I’d like to translate the requirements in to Cucumber before implementing it.

Each item has several attributes, such as “Item Family” (eg: electronics, book), “Item Status” (eg: main stock, faulty stock), and “Batch” (eg: 1050, 1051).

I can think of several strategies for writing a Cucumber test for this, and I’d like to know which is the recommended one:

Firstly, you could enumerate all of the attributes per product:

Given I have a tote containing:
  | sku    | client  | family  | status | batch | weight |
  | 100000 | Foo     | garment | main   | 1234  |     10 | 
When I add the item:
  | sku    | client  | family  | status | batch | weight |
  | 200000 | Bar     | garment | main   | 1234  |     10 |
Then I should be told there is a Client conflict

Secondly, you could have a basic product hard-coded, and try specifying the minimum differing attributes from it:

Given I have a tote containing an item that's client "Foo"
When I add an item that's client "Bar"
Then I should be told there is a Client conflict

This assumes the step definitions hold the basic attributes, and override them when attributes are mentioned in the steps.

Finally, you could go a further step of abstraction:

Given I have a tote containing an item
And I add an item with a different client
Then I should be told there's a client conflict

Any guidance on the correct approach here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T01:15:27+00:00Added an answer on June 2, 2026 at 1:15 am

    The answer from The Cucumber Book would be whichever is most readable to the non-technical members of your team. Sit down with the QA lead and project manager, and ask them the same question. I had a similar problem, and started with something like your first suggestion. Then I decided it was too detailed and jumped to #3. Then I sat down with the project manager and found out that when I was creating the data I did not need any detail, but when we changed the data (in our case updating line item values on an invoice), we wanted to see what those values were in the steps.

    Chapter 6 from The Cucumber Book “When Cucumbers Go Bad” was really helpful in directing to the right level of detail. I really think you should give it a read, especially the part about coming up with an Ubiquitous Language. I think that will help you decide on the right level of detail for your organization.

    If you are tempted to use the first test, my question to you would be, “How often are you going to change those values?” If the answer is “not very” or “never”, then you should consider whether they are adding to or detracting from the readability of the test.

    P.S. I’m still reading The Cucumber Book, but so far it has been extremely helpful, for example pointing me towards FactoryGirl as socjopata suggested.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to write the class which will accept boost::format() through the operator like
I need to write Domain class constraint in Grails which says that one integer
I'd need to write a class with an overloaded operator [] which has different
I'm about to write a class called CurrentDate and need a solid package name.
I need to write a class for different configuration objects that hold something like
I need to write a container template class <T, R> where T is an
I need to write a generic class where the type parameter must be something
When I write class templates, and need to fully-specialize members of those classes, Doxygen
I have a program for a C class I need to write. The program
I need to know whether I can write the whole class in C++ and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.