How to do BDD in a winforms app

Afraz Ali

I have a scenerio where I have to get some data from the DB and display it in a Grid View in a Win forms app. I have written a unit test for Presenter mocking my repository and view. The test checks that the presenter calls the GetData() method of the repository and then calls the Bind(data) method of the view.

I have also another Integration test for the repository that verifies that if there is some data in the DB it is returned by the repository.

Now comes the part of testing my view. I can think of no way to test my form and check if it indeed binds data to the Grid view but that is a separate question.

My question is that if I wanted to test the above scenario in BDD style then in Win forms there is no way for me to test that when I call a method of the presenter is the Grid View filled with the correct data. Does that mean that I can not do BDD on Win forms as I cannot verify the complete behaviour without mocking the view. If we mock the view then the entire concept of BDD is lost because one key player that is involved in the completion of the scenario is mocked and not real.

It is really confusing for me and don't know if anyone else out there has had similar question in their mind ever.

Ben Smith

Yes it is possible to use BDD when creating a winform application.

TestStack have a framework called White. Quoting their website:

White is a framework for automating rich client applications based on Win32, WinForms, WPF, Silverlight and SWT (Java) platforms. It is .NET based and does not require the use of any proprietary scripting languages.

As you are using C# I also strongly recommend you use SpecFlow for your behaviour-driven development; it allows you to define feature and scenarios for your application in a technology agnostic format and creates boilerplate code to aid you in your BDD process.

Here is a good article which works through an example using Specflow for BDD and White for winform automation.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to select from winforms app

From Dev

How do I use Unity Container to Instantiate a DAL class From a BLL class in a Winforms App

From Dev

How do I use Unity Container to Instantiate a DAL class From a BLL class in a Winforms App

From Dev

How do I skip a test in the behave python BDD framework?

From Dev

How do I structure BDD style tests in multiple files?

From Dev

How to make multi-language app in Winforms?

From Dev

How to create a custom clipboard format in a WinForms app

From Dev

How to Publish a Winforms App with SQLite using ClickOnce

From Dev

How to tell if an app is a Winforms app or WPF app by looking at project properties

From Dev

How BDD complements TDD

From Dev

How to detect a Winforms app has been idle for certain amount of time

From Dev

how to read external app.config as xml file in winforms?

From Dev

How can I stop my WinForms app for 10 minutes?

From Dev

How to create global user in C# WinForms app (credentials)?

From Dev

How do i write BDD scenarios in fitnesse with .Net like Given when then format using Fitsharp

From Dev

How do we know what Cucumber jar files are needed to run Selenium Java in BDD approach?

From Dev

How do I set up a Jenkins CI server to run automated BDD selenium tests using a remote webdriver?

From Dev

Publishing winforms app

From Dev

WinForms app not closing completely

From Dev

How do I save a Winforms panel's drawing content to a file?

From Dev

How do I paint custom borders on .Net WinForms controls

From Dev

How do I make the winforms controls resize with the window?

From Dev

How to do Chat Bubbles in VB.NET WinForms application

From Dev

How Do i save data on form closing event in winforms

From Dev

How do you measure responsiveness and load time for WinForms

From Dev

How do I save a Winforms panel's drawing content to a file?

From Dev

How do I set the background color of a readonly textbox in Winforms?

From Dev

How do I make my controls inside a winforms UserControl private?

From Dev

Winforms how do I set datagridviewtextboxcolumn's text?

Related Related

  1. 1

    How to select from winforms app

  2. 2

    How do I use Unity Container to Instantiate a DAL class From a BLL class in a Winforms App

  3. 3

    How do I use Unity Container to Instantiate a DAL class From a BLL class in a Winforms App

  4. 4

    How do I skip a test in the behave python BDD framework?

  5. 5

    How do I structure BDD style tests in multiple files?

  6. 6

    How to make multi-language app in Winforms?

  7. 7

    How to create a custom clipboard format in a WinForms app

  8. 8

    How to Publish a Winforms App with SQLite using ClickOnce

  9. 9

    How to tell if an app is a Winforms app or WPF app by looking at project properties

  10. 10

    How BDD complements TDD

  11. 11

    How to detect a Winforms app has been idle for certain amount of time

  12. 12

    how to read external app.config as xml file in winforms?

  13. 13

    How can I stop my WinForms app for 10 minutes?

  14. 14

    How to create global user in C# WinForms app (credentials)?

  15. 15

    How do i write BDD scenarios in fitnesse with .Net like Given when then format using Fitsharp

  16. 16

    How do we know what Cucumber jar files are needed to run Selenium Java in BDD approach?

  17. 17

    How do I set up a Jenkins CI server to run automated BDD selenium tests using a remote webdriver?

  18. 18

    Publishing winforms app

  19. 19

    WinForms app not closing completely

  20. 20

    How do I save a Winforms panel's drawing content to a file?

  21. 21

    How do I paint custom borders on .Net WinForms controls

  22. 22

    How do I make the winforms controls resize with the window?

  23. 23

    How to do Chat Bubbles in VB.NET WinForms application

  24. 24

    How Do i save data on form closing event in winforms

  25. 25

    How do you measure responsiveness and load time for WinForms

  26. 26

    How do I save a Winforms panel's drawing content to a file?

  27. 27

    How do I set the background color of a readonly textbox in Winforms?

  28. 28

    How do I make my controls inside a winforms UserControl private?

  29. 29

    Winforms how do I set datagridviewtextboxcolumn's text?

HotTag

Archive