Tagged Questions

Ideally, each test case is independent from the others: substitutes like method stubs, mock objects, fakes and test harnesses can be used to assist testing a module in isolation. Unit tests are typically written and run by software developers to ensure that code meets its design and behaves as ...

learn more… | top users | synonyms

2
votes
2answers
82 views

How to unit test this method?

I have this method inside a class that is responsible for setting up and executing a model: public FlowJob PrepareAndScheduleFlowModelJob(string coordinates) { GeometryCoordinateString ...
0
votes
1answer
45 views

Mocking the class under test with private method calls

Consider the scenario below. It covers multiple methods of my unit under test. public class OriginalSample { public bool Foo(ISomeEntity entity) { return entity.IsThatSo ? ...
3
votes
2answers
129 views

Refactor to make intention clearer and testable

I'd like to improve the readability of the following code. The aim of this code is to apply formatting to row(s) in a WinForms DataGridView based on the Priority of an item, determined either by its ...
9
votes
5answers
244 views

Better test names

I have some simple tests written, however, the names are not good...I think, any suggestions on better names? I'm not really sure how these tests should be named. I'm looking for a format or pattern ...
1
vote
1answer
28 views

LPTHW - ex48 - Handling exceptions and unit testing

This is my solution to the exercise 48 of Learn Python the hard way by Zed Shaw. Please visit the link for testing suite and requirements. I'm worried about my the word banks I have created (COMPASS, ...
-1
votes
0answers
67 views

C# Coursework - Need Testers [closed]

I was wondering if anyone could help me speed up the testing of my Computing coursework. I would like to have several screenshots of my program running on several different operating systems. The ...
0
votes
0answers
20 views

Custom unit test engine

I am writing a fairly large hobby project in JScript and testing it on WScript. I decided that it would be a good idea to have some unit testing. This is what I came up with. var tests = []; ...
2
votes
1answer
114 views

my constructor is doing work. Is this a code smell in this example?

I have created a queue in javascript. This queue also has blocking take(). As you all probably know this is not really true, because javascript does not have threads. It just wait until element has ...
2
votes
1answer
73 views

Do I need to create more functions? And also, is this code difficult to unit test?

I'm new to production code. And also I'm learning how to test code, I'll use the unittest module that comes with python to do that. One more question, how can I make this code more safe? """ Sync ...
5
votes
3answers
225 views

Unit testing legacy code with static classes

I am developing new functionality into a legacy coded application. However, for my new classes I have introduced Unit Testing. I still need to work with existing code. One of the problems I face ...
0
votes
0answers
44 views

how to fake html content to unit test a method [closed]

I wrote a c# solution. I want to write unit tests for two classes: HtmlAgilityPackHtmlProvider, HtmlContentManager code can be download from: http://ge.tt/7lDhlFF But fails to write the simplest ...
2
votes
2answers
197 views

Ways to improve my coding test FizzBuzz solution for a TDD role?

I had an interview recently where I was asked to produce the traditional FizzBuzz solution: Output a list of numbers from 1 to 100. For all multiples of 3 and 5, the number is replaced ...
1
vote
2answers
135 views

should DRY apply to unit tests as much as production code

I have a unit test method that looks like this: ... 113 CPPUNIT_ASSERT( !m_pInputFilter[0]->SendPacket() ); 114 115 CppUnitUtil::CUnitTestTimeline::GetInstance().Advance( 1, CppUnitUtil::Seconds ...
0
votes
0answers
97 views

A simple JS mock, and unit testing the HTML 5 canvas

I've been fiddling with the HTML 5 canvas, and I attemt to do this JS stuff with more or less 100% test coverage. Would like some feedback on the testing process. What I do is that I give my objects ...
1
vote
1answer
81 views

monkeypatching builtin open and File Mock-Up for unit testing: satisfactory approach?

For a specific test-scenario i wanted: avoid accessing the filesystem through pythons builtin open-function don't want to use 3rd party libraries like Michael Foord's Mock library I would like to ...

1 2 3 4
15 30 50 per page