Tagged Questions

Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.

learn more… | top users | synonyms

2
votes
1answer
74 views

Better way to Unit Test this?

Basically I have some methods that access the file system and to avoid that in the unit test I have broken those sections out into a protected virtual method. In the Unit Test I then use Moq to setup ...
3
votes
1answer
85 views

Designing a listener method and making it Testable

I have a java based server application that needs to support multiple clients. In the main class I have a method that runs in an infinite loop and waits for client connection. Following is this ...
3
votes
1answer
142 views

Tips for Making this Code Testable

So I'm writing an abstraction layer that wraps a telephony RESTful service for sending text messages and making phone calls. I should build this in such a way that the low-level provider, in this case ...
3
votes
1answer
81 views

Unit Testing Code that Calls RESTful API

So I'm writing a library which calls a RESTful API and then performs some work on the data. I've architected my code like this: I have a class, let's call it APIRequestor that initiates a call to the ...
1
vote
1answer
45 views

Creating many random test database entries (updated with stored procedure)

Working on a simple time sheet webapp, I have created the following query (simplified - I actually have several mapped columns of a similar type to project_id) to generate test data: INSERT INTO ...
3
votes
1answer
598 views

Convert number to words (web application)

I'm looking for a new job, and a company who had a role I was going for asked me to do a programming exercise. It consisted of making a web application of two or more pages that took a person's name ...
1
vote
2answers
84 views

Get resources inside or outside constructor?

I need your opinion on writing a constructor that's clean code and unit test friendly. Option 1 : var res1 = bigObject.GetResource1(); var res2 = bigObject.GetResource2(); var res3 = ...
0
votes
0answers
49 views

Testing Backbone Model using Jasmine

It is the first time I write a javascript test for a Backbone Model. Looking in the web resource there are not so many items about this subject. I found this one, Testing Backbone applications with ...
2
votes
2answers
255 views

Tesing a simple calculator class with JUnit/JMock

I'm playing around with JMock and trying to understand whether I understand the idea correctly. There's an interface Printer aimed to print integers somewhere. There's an interface Calculator aimed ...
1
vote
0answers
55 views

How to refactor my controller specs?

In my project (https://github.com/GCorbel/comment-my-projects) I have this kind of code to test my controllers. #encoding=utf-8 require 'spec_helper' describe ProjectsController do let!(:project) ...
1
vote
1answer
96 views

Spotify Best Before puzzle

I thought to spent my free time by solving a puzzle: Best Before Spotify Puzzle. I coded in Java, and yeah I did not clean up my code (just a rough work) and I have yet to optimize... so I did check ...
1
vote
2answers
146 views

PHP class library

I am a PHP newbie, gone through a couple starter tutorials which went ok, so I thought I'd try creating a more complex project to get some experience. It is a NetBeans PHP project where I try to ...
3
votes
2answers
137 views

Homework Review - Storing three integer values

Consider an 8-bit complier, in which we have an integer of size, say 2-words i.e. 16-bits or 2 bytes. You need to store three integer values which are supposed to be as: Name Range Size ...
0
votes
0answers
84 views

How to use inversion of control within a strategy when using the strategy pattern

I am creating a skeleton application to demonstrate use of the Strategy design pattern and inversion of control inside a Strategy. The application is the backend of a simple board game, which also ...
1
vote
1answer
116 views

How should I test this class?

I've been trying to figure out how to (reasonably) test a builder-type class I've created, or whether (and how) I should refactor some portion of the design. Specifically, I created a builder ...

1 2 3 4
15 30 50 per page