tdd

What book on TDD for C# with treatment of Mocks

与世无争的帅哥 提交于 2019-11-28 04:33:10
问题 Can you recoment a book on on Unit Testing and TDD for C# with at least some treatment of Mock Objects? I have seen this question but it does not seem to mention mocking. 回答1: The Art of Unit Testing: With Examples in .NET by Roy Osherove (Amazon Page, Official Site) sounds like what you're looking for. He devotes one chapter introducing the concepts of stub and mock objects (using a "roll-your-own" approach), and then a second chapter on using mock object frameworks, particularly Rhino Mocks

TDD for Windows Store app development without mocks

我的未来我决定 提交于 2019-11-28 04:23:06
问题 Has anyone come up with a good TDD setup for Windows Store App development? I'm so used to using mocking frameworks, but this is no-longer an option since dynamic assembly generation is missing in WinRT. I have seen the alpha MoqRT framework, but I am hoping to avoid something in such experimental stages. I have also been so spoiled with using mock objects that I balk at using the stubs or shims offered as an alternative from Microsoft (Microsoft Fakes). Have any of you successfully figured

How would you unit test data annotations?

我怕爱的太早我们不能终老 提交于 2019-11-28 04:21:35
问题 Two of the class properties have the following annotations: [Key] [Column] [Required] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } [MaxLength(25)] public string Name { get; set; } I understand that testing Key, Column and Required attributes is no longer a unit test, it's an integration test as it would depend on the underlying database, but how do you go about testing MaxLength(25) attribute? One of the alternatives that I can think of, is to add a code

Simulating user input for TDD JavaScript

元气小坏坏 提交于 2019-11-28 04:03:31
问题 I'm finding it increasingly difficult to simulate actual user events using jQuery or native element trigger functions. For example, if you have a text input and you don't want the user to be able to add a character, you can call e.preventDefault() with the jQuery-normalised event object on the keydown event. However, there is no way to programatically verify this test scenario. The following test passes even without the call to preventDefault because the jQuery keydown trigger isn't a "real"

What do you test with your unit tests?

限于喜欢 提交于 2019-11-28 03:58:26
TDD is something that seems to be on everybody's lips these days, and I have tried some on my own but I don't think I'm getting the idea. I am getting a grip on how to write a unit test, but I don't understand exactly what my unit tests should test. If I have an action method that returns a list of data, what should I verify? Only that the view name is correct, or should I verify the data as well? If I should test the data as well, won't I be writing the same code twice? What is the use of testing the data, if I use the same method to retrieve the data I'm comparing to? Should I test the

NUnit Test Run Order

懵懂的女人 提交于 2019-11-28 03:52:35
By default nunit tests run alphabetically. Does anyone know of any way to set the execution order? Does an attribute exist for this? NeedHack Your unit tests should each be able to run independently and stand alone. If they satisfy this criterion then the order does not matter. There are occasions however where you will want to run certain tests first. A typical example is in a Continuous Integration situation where some tests are longer running than others. We use the category attribute so that we can run the tests which use mocking ahead of the tests which use the database. i.e. put this at

Unit testing Activity.startService() call?

旧城冷巷雨未停 提交于 2019-11-28 03:13:38
问题 Attempting to write my first Android-by-TDD app (I've written a few small Android apps without TDD, so am familiar with the environment), but I can't seem to get my head around how to write my first test. The scenario: I have an activity, TasksActivity, and a service, TasksService. I need to test that TasksActivity starts TasksService in its onStart() method. The test I've written is this: public class ServiceControlTest extends ActivityUnitTestCase<TasksActivity>{ public ServiceControlTest()

Design By Contract and Test-Driven Development [closed]

半城伤御伤魂 提交于 2019-11-28 03:09:27
I'm working on improving our group's development process, and I'm considering how best to implement Design By Contract with Test-Driven Development. It seems the two techniques have a lot of overlap, and I was wondering if anyone had some insight on the following (related) questions: Isn't it against the DRY principle to have TDD and DbC unless you're using some kind of code generator to generate the unit tests based on contracts? Otherwise, you have to maintain the contract in two places (the test and the contract itself), or am I missing something? To what extent does TDD make DbC redundant?

Mocha breakpoints using Visual Studio Code

梦想的初衷 提交于 2019-11-28 03:07:43
Is it possible to add breakpoints to ones Mocha tests using Visual Studio Code? Normally when debugging code one need to configure the launch.json, setting the program attribute to the javascript file to execute. I am not sure how to do this for for Mocha though. Frank Nocke Did you know, that you just go into your launch config, put your cursor after or between your other configs and press ctrl - space to get a current, valid mocha config auto-generated? Which works perfectly fine for me. Including stopping at breakpoints. ( I also had a prior, now outdated one, that did no longer for various

Testing browser extensions

蓝咒 提交于 2019-11-28 02:54:11
I'm going to write bunch of browser extensions (the same functionality for each popular browser). I hope, that some of the code will be shared, but I'm not sure about this yet. For sure some of extensions will use native API. I have not much experience with TDD/BDD, and I thought it's good time to start folowing these ideas from this project. The problem is, I have no idea how to handle it. Should I write different tests for each browser? How far should I go with these tests? These extensions will be quite simple - some data in a local storage, refreshing a page and listening through web