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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:02:53+00:00 2026-06-18T10:02:53+00:00

I have been studying acceptance based tests and they look quite nice as they

  • 0

I have been studying acceptance based tests and they look quite nice as they fit more naturally with feature based development.

The problem is that I do not know how to lay them out in code. I would like to try and avoid pulling in another framework to handle this so I am just looking for a simple way to get these tests up and running.

I am open to any changes needed to the code structure. I am also using specs to build up complex acceptance criteria.

Sample of what I am trying to do:

public class When_a_get_request_is_created
{
    private readonly IHttpRequest _request;

    public When_a_get_request_is_created()
    {
        _request = new HttpRequest();
    }

    // How to call this?
    public void Given_the_method_assigned_is_get()
    {
        _request = _request.AsGet();
    }

    // What about this?
    public void Given_the_method_assigned_is_not_get()
    {
        _request = _request.AsPost();
    }

    // It would be great to test different assumptions.
    public void Assuming_default_headers_have_been_added()
    {
        _request = _request.WithDefaultHeaders();
    }

    [Fact]
    public void It_Should_Satisfy_RequestIsGetSpec()
    {
        Assert.True(new RequestUsesGetMethodSpec().IsSatisfiedBy(_request));
    }
}

I may be completely off the mark here but essentially I would like to be able to run tests with different assumptions and givens. I don’t mind if I have to make more classes or minor duplication as long as I can point someone to the test to validate a given criteria.

  • 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-18T10:02:54+00:00Added an answer on June 18, 2026 at 10:02 am

    I would strongly recommend using an ATDD framework like SpecFlow or even MSpec for creating tests of this nature. Implementing SpecFlow is then a case of writing your specification using domain specific language, in collaboration with domain expert(s) if that’s approriate, and then satisfying the scenario steps defined in the feature through code. It’s difficult to pad out the code aspect without understanding more about your exact requirements, but a sample feature might look something like this:

    Feature: HTTP Requests
        In order to validate that HTTP requests use the correct methods
        As a client application
        I want specific requests to use specific methods
    
    Scenario Outline: Making HTTP Requests
        Given I am making a request
        When the method assigned is <Method>
        And the <Header> header is sent
        Then it should satisfy the requirement for a <Method> request
    
    Examples:
    | Method | Header   |
    | Get    | Header 1 |
    | Get    | Header 2 |
    | Get    | Header 3 |
    | Post   | Header 1 |
    

    Then in your steps that are bound to the feature you can write the code that satisfies the specification steps. Here’s one example:

    [Binding]
    public class HttpRequestSteps
    {
        [When(@"the method assigned is (.*)")]
        public void WhenTheMethodAssignedIs(string method)
        {
            // not sure what this should be returning, but you can store it in ScenarioContext and retrieve it in a later step binding by casting back based on key
            // e.g. var request = (HttpRequest)ScenarioContext.Current["Request"]
            ScenarioContent.Current["Request"] = _request.AsGet();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been studying python for quite sometime now and very recently I decided
I've recently been studying TDD, attended a conference and have dabbled in few tests
I have been studying for my Software Development course and came across the question
I have been studying EF and LINQ for quite a while now and I'm
I have been studying framework development for a few weeks, and I ran across
I look after a large site and have been studying other similar sites. In
I have been studying Grails for quite a while now. And scanned a little
I have been studying DDD in-depth on my own time; reading everything about it
I have been studying unicode and its Python implementation now for two days, and
I am new to Python and have been studying its fundementals for 3 months

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.