Все вопросы: [tdd]

536 вопросов

похожие теги:
22
голосов
4ответов
3543 просмотров

How to write tests without so many mocks?

I am a heavy advocate of proper Test Driven Design or Behavior Driven Design and I love writing tests. However, I keep coding myself into a corner where I need to use 3-5 mocks in a particular test case for a single class. No matter which way I start, top down or bottom up I end up with a design ...

5
голосов
6ответов
3373 просмотров

What is Best for Defect Rate Tracking? Defects per KLOC?

I'm trying to create some internal metrics to demonstrate (determine?) how well TDD improves defect rates in code. Is there a better way than defects/KLOC? What about a language's 'functional density'? Any comments or suggestions would be helpful. Thanks - Jonathan

1
голосов
3ответов
170 просмотров

What is the name of the pattern?

I often design system where I have a class in my system that has a bunch of protected methods. The protected methods are that because they should be accessible to specializations, and as such, I consider the protected methods to be a contract between my general class and any specialized classes. ...

8
голосов
7ответов
1110 просмотров

Recommended thing for a TDD newbie

I'm very new to TDD world. I have a few questions regarding TDD. Do I have to do test-first in TDD? I heard that TDD is not about test. It's about design. I'm agreed that it's good to do test-first but what I like to know is that is it still TDD if we follow the test-last approach? Shall we pr...

15
голосов
5ответов
2422 просмотров

How do I go about setting up a TDD development process with Google App Engine?

I'm primarily a Ruby guy, but lately I've been working on a lot of Python stuff, in particular, App Engine code. In Ruby, I'd use automated continuous integration (autotest), code coverage tools (rcov), static analysis (reek), and mutation testing (heckle) in my development process, but I'm not ...

1
голосов
5ответов
497 просмотров

Testing only the public method on a mid sized class?

I have a class called FooJob() which runs on a WCF windows service. This class has only 2 public methods, the constructor, and a Run() method. When clients call my service, a Dim a new instance of the Job class, pass in some parameters to the ctor, then call Run()... Run() will take the paramet...

15
голосов
12ответов
4287 просмотров

How to unit test private methods in BDD / TDD?

I am trying to program according to Behavior Driven Development, which states that no line of code should be written without writing failing unit test first. My question is, how to use BDD with private methods? How can I unit test private methods? Is there better solution than: - making priva...

3
голосов
2ответов
382 просмотров

Test driven development for C++ XPCOM component?

I want to create a Firefox extension using c++ XPCOM component which in turn uses javascript XPCOM component. Is there any framework that allows test driven development of C++ XPCOM component/firefox extension ?

1
голосов
2ответов
1213 просмотров

Basic NMock database examples for CRUD application

I'm looking for some basic examples of using NMock2 to mock database calls for a CRUD application. Thanks, Chris

2
голосов
2ответов
560 просмотров

Running Tests From a Module

I am attempting to run some unit tests in python from what I believe is a module. I have a directory structure like TestSuite.py UnitTests |__init__.py |TestConvertStringToNumber.py In testsuite.py I have import unittest import UnitTests class TestSuite: def __init__(self): ...

3
голосов
10ответов
624 просмотров

In test driven development, do you write every possible test first, then the code?

In doing test driven development I have been in the habit of writing the first unit test for a new piece of functionality first, then writing the code for that functionality. If I have additional tests to write to cover all scenarios, I usually write them after the code is written. Is this consid...

8
голосов
6ответов
779 просмотров

If you change code that has a unit test against it, which do you change first?

I have a project that I am building that I have to change a method to behave slightly different. I have several unit tests already built against that method, but I will need to add more to cover the new behavior I am going to add to it. Is it good form to change/add those tests first before makin...

10
голосов
13ответов
1226 просмотров

Has anybody used Unit Testing as a way to learn programming?

I understand the concept of Unit Testing as coming up with simple ideas about what your code should output - then outputting it. So it's thinking about what you want a piece of code to do - then making a test to ensure it works. At which point in learning programming should TDD (unit testing) be...

0
голосов
1ответов
534 просмотров

Unity XML Config Test

We are constantly having problem with our application being broken due to the Unity configuration not being able to resolve dependencies, either the dll or namespace has been changed or is initially wrong. Can anyone point me in the right direction for writing a Test that will ensure all the Uni...

13
голосов
9ответов
3637 просмотров

Books that will cover TDD, DDD and Design Patterns in .NET

I would like to get book(s) that will really give me a complete view of modern ASP.NET development using C#, TDD, ASP.NET MVC, DDD and Design Patterns such as the Repository pattern. I'm very competent with C# and ASP.NET MVC, but want to fill in the gaps. If you've had a good experience with a...

5
голосов
4ответов
803 просмотров

unit test installers

I am starting to do some installer work using WiX (yay, not Installshield) and I was hoping to do some TDD of the installer. Does anybody know of an easy way to do this?

1
голосов
1ответов
315 просмотров

Testing Target-Action wiring

i came across the following blog post that explained the topic. However I do have troubles with the given samples. It verifies target-action binding like so: STAssertEquals([doSomethingButton action], @selector(doSomething:), @"The button should send -doSomething: to its target."); STAssertE...

2
голосов
1ответов
296 просмотров

Unit testing Linq 2 Sql lazy-loaded properties

Lets say I have a Customers table and an Orders table with a one-to-many association (one customer can have multiple orders). If I have some code that I wish to unit test that accesses a specific customer's orders via lazy-loading (e.g. a call to customer.Orders), how do I mock / stub that call ...

10
голосов
6ответов
5359 просмотров

Writing an OS for Motorola 68K processor. Can I emulate it? And can I test-drive OS development?

Next term, I'll need to write a basic operating system for Motorola 68K processor as part of a course lab material. Is there a Linux emulator of a basic hardware setup with that processor? So my partners and I can debug quicker on our computers instead of physically restarting the board and stu...

1
голосов
1ответов
2118 просмотров

How do I have a negative scenario with Cucumber in Rails?

I have a negative scenario to test with Cucumber. Specifically, I want to make sure that when someone posts a URL with an invalid handle then the site returns an error. My scenario looks like: Scenario: create person with too short a handle When person named "Fred" with handle "toosho...

6
голосов
1ответов
1066 просмотров

Mocking FormsIdentity.Ticket.UserData with Moq

As part of a unit test I am trying to mock the return value of FormsIdentity.Ticket.UserData The following will NOT work but it should give an idea of what I am trying to do: var principal = Mock<IPrincipal>(); var formsIdentity = Mock<FormsIdentity>(); formsIdentity.Setup(a => a...

10
голосов
2ответов
3232 просмотров

check for (the absence of) `puts` in RSpec

I am using rspec for my test in a ruby project, and I want to spec that my program should not output anything when the -q option is used. I tried: Kernel.should_not_receive :puts That did not result in a failed test when there was output to the console. How do I verify the absents of text ou...

41
голосов
10ответов
20964 просмотров

How to write good Unit Tests?

Could anyone suggest books or materials to learn unit test? Some people consider codes without unit tests as legacy codes. Nowadays, Test Driven Development is the approach for managing big software projects with ease. I like C++ a lot, I learnt it on my own without any formal education. I neve...

8
голосов
5ответов
662 просмотров

On Test Driven Development BUT in REVERSE

I appreciate TDD and think it indispensable but always write my tests ONLY after I write my source code then refactor accordingly. I can never bring myself to write the test first then the source to pass the test. So I always reverse the process. Is this a bad practice on my part? What are the di...

8
голосов
3ответов
3153 просмотров

Unity and WCF Library: Where to load unity in a wcf library?

can anyone help? I have created a WCF library (not application) and i will be hosting this in a SVC IIS page.. But i was wanting to load the unity stuff in generic place... I could load it in the global.asax but then its tied to the IIS Asp.net container and when doing TDD this part wouldn't ex...

1
голосов
3ответов
914 просмотров

How to test business logic (Doman Model Rules) while using ADO.net entity framework?

I am trying to test that the business rule of not allowing to share the same space with a user twice. Below is the method being tested. The line having the issue is marked below. public void ShareSpace(string spaceToShare,string emailToShareIt) { SharedSpace shareSpace = new SharedSpace(); ...

2
голосов
7ответов
1573 просмотров

Designing a poker parser in Ruby

I'm writing a small program in Ruby to parse a hand history log from a poker site. The log is split over several lines and looks a bit like this: Table 123456 NL Hold'em $1/$2 5 Players Seat 3 is the button Seat 1: randomGuy112 $152.56 Seat 2: randomGirl99 $200 Seat 3: PokerPro $357.12 Seat 4: F...

1
голосов
3ответов
221 просмотров

Tell me what is stupid about my Entity Validation (and how to improve it)

I have an IEntity interface that implements an interface, IValidatable public interface IValidatable { bool IsValid { get; } bool IsValidForPersistence { get; } // Rules applied at UI time (please enter your name, etc) IEnumerable<RuleViolation> GetRuleViolations(); // ...

19
голосов
8ответов
2467 просмотров

Is there any open source mocking framework resembling TypeMock?

TypeMock is too expensive for a hobbist like me :) Moq or the next version of RhinoMocks have no plans on listening to the profiling API, why is that? EDIT: This enables features such as: Mocking non-virtual methods and properties (!). Mocking browser environments. simpler syntax which is...

2
голосов
3ответов
224 просмотров

VSTestHost is crashing and would not work anymore

For my project I am using the integrated Visual Studio unit-testing framework but I am having some issues that I never saw before. One of my classes is causing VSTestHost to crash. So first I though it was because there was a bunch of code causing a stack overflow. What is really strange is that...