tdd

What are the primary differences between TDD and BDD?

做~自己de王妃 提交于 2019-11-27 16:43:21
Test Driven Development has been the rage in the .NET community for the last few years. Recently, I have heard grumblings in the ALT.NET community about BDD. What is it? What makes it different from TDD? I understand BDD to be more about specification than testing . It is linked to Domain Driven Design (don't you love these *DD acronyms?). It is linked with a certain way to write user stories, including high-level tests. An example by Tom ten Thij : Story: User logging in As a user I want to login with my details So that I can get access to the site Scenario: User uses wrong password Given a

Meteor test driven development [closed]

断了今生、忘了曾经 提交于 2019-11-27 16:42:54
I don't see how to do test driven development in meteor. I don't see it mentioned anywhere in documentation or FAQ. I don't see any examples or anything like that. I see that some packages are using Tinytest. I would need response from developers, what is roadmap regarding this. Something along the lines of: possible, no documentation, figure it out yourself meteor is not built in a way that you can make testable apps this is planned feature etc Blackcoat Update 3 : As of Meteor 1.3, meteor includes a testing guide with step-by-step instructions for unit, integration, acceptance, and load

How do I unit test a custom ActionFilter in ASP.Net MVC

本小妞迷上赌 提交于 2019-11-27 15:42:23
问题 So I'm creating a custom ActionFilter that's based mostly on this project http://www.codeproject.com/KB/aspnet/aspnet_mvc_restapi.aspx. I want a custom action filter that uses the http accept headers to return either JSON or Xml. A typical controller action will look like this: [AcceptVerbs(HttpVerbs.Get)] [AcceptTypesAttribute(HttpContentTypes.Json, HttpContentTypes.Xml)] public ActionResult Index() { var articles = Service.GetRecentArticles(); return View(articles); } The custom filter

How to check if method has an attribute

百般思念 提交于 2019-11-27 15:39:35
问题 I have an example class public class MyClass{ ActionResult Method1(){ .... } [Authorize] ActionResult Method2(){ .... } [Authorize] ActionResult Method3(int value){ .... } } Now what I want is to write a function returning true/false that can be executed like this var controller = new MyClass(); Assert.IsFalse(MethodHasAuthorizeAttribute(controller.Method1)); Assert.IsTrue(MethodHasAuthorizeAttribute(controller.Method2)); Assert.IsTrue(MethodHasAuthorizeAttribute(controller.Method3)); I got

TDD …how?

最后都变了- 提交于 2019-11-27 15:16:28
问题 I'm about to start out my first TDD (test-driven development) program, and I (naturally) have a TDD mental block..so I was wondering if someone could help guide me on where I should start a bit. I'm creating a function that will read binary data from socket and parses its data into a class object. As far as I see, there are 3 parts: 1) Logic to parse data 2) socket class 3) class object What are the steps that I should take so that I could incrementally TDD? I definitely plan to first write

Is there such a thing as excessive unit testing? [closed]

跟風遠走 提交于 2019-11-27 14:41:34
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 7 years ago . I'm not brand new to the concept of unit testing but at the same time I've not yet mastered them either. The one question that has

Unit testing factory methods which have a concrete class as a return type

那年仲夏 提交于 2019-11-27 14:33:46
问题 So I have a factory class and I'm trying to work out what the unit tests should do. From this question I could verify that the interface returned is of a particular concrete type that I would expect. What should I check for if the factory is returning concrete types (because there is no need - at the moment - for interfaces to be used)? Currently I'm doing something like the following: [Test] public void CreateSomeClassWithDependencies() { // m_factory is instantiated in the SetUp method var

Static class/method/property in unit test, stop it or not

喜欢而已 提交于 2019-11-27 14:20:24
Update should a static class/method/property be used in a unit test development environment, given that it is no way to test it without introducing a wrapper that is again not testable? Another scenario is that when the static members are used within the unit tested target, the static memeber cannot be mocked. Thus, you have to test the static meembers when the unit tested target is tested. You want to isolate it when the static member performs calculation. k.m Testing static method is no different than testing any other method. Having static method as a dependency inside another tested module

AngularJS + Jasmine: Comparing objects

百般思念 提交于 2019-11-27 14:18:28
问题 I'm just starting out writing tests for my AngularJS app and am doing so in Jasmine. Here are the relevant code snippets ClientController: 'use strict'; adminConsoleApp.controller('ClientController', function ClientController($scope, Client) { //Get list of clients $scope.clients = Client.query(function () { //preselect first client in array $scope.selected.client = $scope.clients[0]; }); //necessary for data-binding so that it is accessible in child scopes. $scope.selected = {}; //Current

Insert blob in oracle database with C#

。_饼干妹妹 提交于 2019-11-27 14:12:54
I have to persist a .csv in my database, but for a more testable application I prefer don't use procedures. Basically I just generate a file and the next instruction is put this in database. Someone have some clue about best way to do this in code? ayush Here is an example to insert blob data in oracle using c# and procedures (you said prefer that means you may). using System; using System.Data; using Oracle.DataAccess.Client; using Oracle.DataAccess.Types; using System.IO; using System.Text; //Step 1 // Connect to database // Note: Modify User Id, Password, Data Source as per your database