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

  • Home
  • SEARCH
  • 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 9188563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:02:33+00:00 2026-06-17T20:02:33+00:00

I am trying specflow for the first time for a WPF project with MVVM

  • 0

I am trying specflow for the first time for a WPF project with MVVM pattern. So, I have repository, controller, view and view model. Repository makes calls to webservice wich hits the database and gives back the data. View model has methods to validate the input from the user and make calls to repository methods.

In my specflow, should I be making a complete call including the repository methods or should I mock those methods using Moq? Does it make sense?

  • 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-17T20:02:35+00:00Added an answer on June 17, 2026 at 8:02 pm

    The short answer:
    You could make you calls hit the database, but I would recommend mocking them out, unless you have logic in your DB

    The long answer:
    There’s two competing ways of looking at this question. Firstly what kind of testing are you expecting to use SpecFlow for, and secondly how easy is it going to be to access your database.

    If you are using SpecFlow to test your low level technical requirements, then you really are doing unit testing in a Specification by example style. So this really ought to dictate that you use mocking to isolate your units. (Personally I’d stick to using NUnit for these tests.)

    If however you are using SpecFlow to test your business scenarios (i.e. Acceptance testing) then your scenarios are reliant on more than one unit to provide the functionality. This is more like Integration or System testing and so many components will need to be involved and in theory since we are testing the whole system, we should include a DB in that, particularly if you have even one stored procedure or view that you might want to regression test later.

    However, the second way of looking at this is how much pain is required to have a database available for your testing.

    • If there is more than one person in your development team, what strategies would you need to avoid failing if you run your tests at the same time?
      • For example you could generate a new unique customer in each run and only access updates and queries against that customer, then you won’t end up with the wrong number of orders.
    • How will you reset your database after your tests run?
      • E.g. If you use the right kind of database you can check an empty .mdb into your source control and just rollback/revert to that.

    I’ve personally found that for a simple DB without stored procs and views, mocking is better, but as soon as you’ve added business logic into the DB, well, you need to test that logic somehow.

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

Sidebar

Related Questions

Trying a simple project to create my own (very basic) data binding. I have
Trying to get along with Sphinx/Thinking Sphinx for the first time. I've got my
I'm trying to use SpecFlow in our (Visual Studio 2008) project to define executable
Trying out PDO for the first time. $dbh = new PDO(mysql:host=$hostname;dbname=animals, $username, $password); $stmt
trying to get my first HTML/CSS uni assignment sorted but have become a bit
trying to figure out why this is happening - I have an input text
Im trying to get our specflow watin tests to run on our new teamcity
I'm trying to use xUnit.net as the test runner for SpecFlow. The SpecFlow 1.2
Trying to loop thru a result that has items. Items have a type and
Trying to implement search functionality in list view having problem in search,here i am

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.