Unit testing is a method by which individual units of source code are tested to determine if they are fit for use.
13
votes
5answers
235 views
Automagic testing framework for VBA
Building on @RubberDuck's recommendations, I now have something I find... beautiful. I'm sure there's a couple of things left to polish - this site is about making great code out of good any code, ...
7
votes
1answer
376 views
Timing analysis of many test cases in Python
I am learning about timing analysis in Python. I used time module before it was pointed out that timeit module would be better ...
8
votes
4answers
965 views
Align Strings for Output
I wrote a class which can format input so that it is properly aligned.
I'm interested in all suggestions (regarding structure, usability, style, naming, comments, etc).
I'm especially wondering ...
17
votes
3answers
662 views
Writing better JUnit tests
I am using Spring Framework, Hibernate and JUnit. I am testing persisting of a UserEntity.
The UserEntity has the following associations:
ManyToMany - City
ManyToMany - ActivityCategory
ManyToOne ...
14
votes
3answers
617 views
Trading Card Game's Hand class and tests
As part of a Trading Card Game, I have created a Hand that will need to hold all cards that a player currently has in his hand. The code is built using Java 8.
The ...
21
votes
4answers
10k views
Unit-testing a controller in Ruby on Rails
I intend this to be a general question on writing an effective set of test cases for a controller action.
I include the following ingredients:
Ruby on Rails
RSpec: A testing framework. I considered ...
11
votes
2answers
263 views
Concerns about the correctness of my Repository and Controller tests
Lately I have been researching how to best unit test an EF repository and given a properly tested repository, what to test in the controller.
My research did not reveal many sound examples or ...
10
votes
1answer
298 views
Unit Testing in VBA
Unit testing in VBA is... lacking. (What isn't lacking in VBA though?) Since I've become more interested in unit testing lately, I decided I needed something better than ...
21
votes
4answers
2k views
Just a lowly counter that turned out to be surprisingly complicated
While writing this review, I saw a need for a Counter object similar to Python's. It seemed like it would be easy to write such a class, but it turned out to be ...
18
votes
4answers
2k views
Rainfall challenge
About a year ago when I was applying to jobs for the first time, I had an interview at a company and they posed the following problem to me, which I preceded to bomb.
A year later I actually came up ...
15
votes
4answers
970 views
Extensible and testable FizzBuzz
There seem no end to fizzbuzz implementations.
Something I rarely see is an implementation that's easy to extend with more name-divisor pairs.
Another thing that usually annoys me is the lack of ...
13
votes
4answers
717 views
Coin dispenser program
I've decided to go tech and learn a language. I have been reading Java for a week and here is my first attempt. I am making a habit to write JUnit test cases so that I start on correct path. Here is ...
8
votes
2answers
165 views
Unit Testing - A Better Solution
Following-up on the Automagic testing framework for VBA review, I've refactored much of the TestEngine static class, and introduced a ...
6
votes
1answer
4k views
Hypothetical SalesTax challenge
I have a small solution to the following hypothetical problem:
Basic sales tax is applicable at a rate of 10% on all goods, except
books, food, and medical products that are exempt. Import duty ...
3
votes
1answer
5k 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 ...
2
votes
1answer
508 views
Logger to syslog with error_log fallback
Below is an implementation of a typical Logger interface that uses syslog() as the default means to store messages and falls ...
7
votes
1answer
53 views
Catch-style unit testing in JavaScript (phase 1)
I decided to port my favorite unit testing framework, Catch, to JavaScript. So far I'm focusing on test cases and sections. I'll add assertions in phase 2, and output in phase 3.
The goal for this ...
7
votes
2answers
121 views
7
votes
1answer
1k views
Measuring a method executing time
I have been playing around with some improvements to some sort algorithms like Selection Sort and Merge Sort and I ended up needing some sort of measurement to check if my versions were any faster ...
6
votes
1answer
79 views
A hacked-up testing framework
Inspired by this post, I wanted to be able, in any vba project I could be working on, to create a test class and write test methods. Like this:
ThisWorkbook Workbook | class module (client code)
...
5
votes
3answers
290 views
Implement strtod parsing
In this comment the OP wrote,
I am a newbie so i would like to know how would i parse the negetive numbers/arguments ?
In this answer @200_success showed an implementation using the strtod ...
4
votes
1answer
40 views
Catch-style unit testing in JavaScript (phase 2)
Continued from phase 1; please read it first for background.
Overview
This phase focuses on assertions. Here's where things get ugly. Catch uses macro expansions to decompose assertion ...
4
votes
2answers
2k views
Robust logging solution to file on disk from multiple threads on serverside code
I have implemented a socket listener that runs on my Linux Ubuntu server accepting connections and then starting up a new thread to listen on those connections (classic socket listener approach). ...
3
votes
1answer
104 views
Unit testing Backbone Model
I would like to hear other people's opinion on how I unit tested a functionality in a Backbone Model. As you see below, the code under test, upon being called to toggle, toggles its completed state ...
3
votes
2answers
244 views
How can I optimize this code for unit testing
How can i optimize this code with less number of loops and return values for unit testing
...
1
vote
1answer
492 views
Unit testing - test class inheritance vs single test class [closed]
Which unit testing approach and WHY do you prefer?
Inheritance-driven-testing
...
0
votes
1answer
134 views
Command line multipart or single file downloader
I am looking for a code review for this multipart or single file chunk downloader using threading and queues.
downloader.py
...