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 3442510
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:40:40+00:00 2026-05-18T08:40:40+00:00

Say that I have an application where user can upload his avatar, and then

  • 0

Say that I have an application where user can upload his avatar, and then he is redirected to crop page where he crops it. I might have Cucumber scenario like this one for upload

Scenario: Registered user wants to upload avatar
  Given I follow "Upload picture"
  When I attach the file "spec/fixtures/kitten.jpg" to "user_avatar"
  And I press "Upload"
  Then I should see "Picture was successfuly uploaded."
  And I should be on the user crop page

and then I want to create scenario for cropping the avatar, which would directly follow the first one. It might look like this

Scenario: User just uploaded avatar
  Given I just uploaded "spec/fixtures/kitten.jpg" as my avatar
  When I crop it to 100x100 px
  And I press "Crop"
  Then my avatar should have 100x100 px
  And I should see "Picture successfuly cropped."

However here I have to define the

Given I just uploaded "spec/fixtures/kitten.jpg" as my avatar

to do exactly the same thing as the previous scenario, which to me looks like huge duplication. Not to mention that if I wanted to continue with a third scenario just after this one, I’d have to duplicate the second one.

For small examples it might work to put all this in one big scenario, however even in this case it would look very ugly.

What is the correct strategy in general to make a few scenarios follow one another and pass on their state to the next one?

  • 1 1 Answer
  • 3 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-05-18T08:40:41+00:00Added an answer on May 18, 2026 at 8:40 am

    In general you don’t want to make tests conditional on each other. They should be able to run independently and in any order. At the point when you start coupling your tests together it’s going to start making failures harder to debug.

    The Given I just uploaded “spec/fixtures/kitten.jpg” as my avatar is doesn’t need to be an exact duplicate of the first cuke. You could just as easily just create the file on the file system and any needed models in the Cucumber step. You already know the upload part works so you don’t need to do the full upload before the crop for the second example.

    Or, alternatively, you could make a single step that contains:

    Given I follow "Upload picture"
    When I attach the file "spec/fixtures/kitten.jpg" to "user_avatar"
    And I press "Upload"
    

    And re-use that in the specs. That way, you can test the landing page and the flash in the first test and the cropping in the second. The values of the flash and the landing page don’t matter for the second test.

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

Sidebar

Related Questions

Let say, I have a web application that allows users to upload images and
In my application, I would like to have DataTemplates such that I can say:
I have an application where a user can upload files and associate the files
Let's say I have an application where the user can attribute scores to movies,
Say that you have an application where different kind of users can sign: Firms,
Let's say that I have an application which manages users. You can add new
I have an application where the user can type in a color name, say
Let's say that I have an application frame, and I want to show a
Lets say that you have a following simple application: <form action=helloServlet method=post> Give name:<input
I am having a problem with structuring rails application. Let's say that I have

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.