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 (1)

0
votes
0answers
72 views

Model Driven Design with Bean Validation

If I have a rich domain library that gets included into a Java web application, but I want to achieve a level of dependency isolation with that domain library such that it is possible to build and ...
0
votes
0answers
385 views

How to integrate unit testing process into legacy software development process? [duplicate]

I'd like you to share your insights of how have you successfully turned the direction of rotting legacy code base to modular application design where it's easy and useful to add unit tests? What I'm ...
0
votes
2answers
93 views

How should I test the functionality of a function that uses other functions in it? [duplicate]

Suppose there is a function get-data which returns a map of information about the id of the user passed in. now this function uses 3 functions source-a, source-b and source-c to get three different ...
10
votes
3answers
544 views

How do I stress the importance of unit tests to my manager [duplicate]

I've recently started a new job, & I've been tasked with completing a feature that another developer didn't finish before he left the company. The existing tests are out of date (i.e ...
11
votes
4answers
642 views

Is there a better way of writing unit tests than a series of 'AssertEquals'?

Here's a basic example of what my unit test needs to be, using qunit: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> ...
0
votes
2answers
223 views

How do I read the Entity Framework Model and validate it against a given connection?

I have a Entity Framework Database First Model. I want to write a MSTest/nUnit test to verify that all the stored procs, tables and views that are defined in my edmx model are still valid on the ...
0
votes
0answers
68 views

Unit Testing in iOS — Should I split out my Data Model into it's own class?

I'm attempting to try out using unit test in for the first time in new iOS activity for work. I love the idea of unit testing, but always find the specifics to be... messy. I get the general ...
-1
votes
1answer
110 views

How should I test my application? [closed]

I have made a simple application which searches for files and folders on users computer. Since, I am a student currently in my 1st year and don't have any formal training and have made my application ...
2
votes
2answers
222 views

How do I integrate a browser-based JavaScript unit testing framework into my workflow?

I'm wondering how I seamlessly include a JavaScript unit testing framework into my workflow. The context is, we have an existing data processing algorithm + webapp to display it, with no automated ...
2
votes
0answers
69 views

How to manage success dependency between unit tests [duplicate]

How do you manage the dependency of one unit test on another unit test succeeding? So, supposed I have a class and this class has say 5 methods. I create like 2 dozen unit tests (test methods) for ...
1
vote
2answers
160 views

TDD - Making assertions about C# Expression trees

How would you unit test the PerformUpdate method in the sample below? This is a (very) simplified version of some code that performs updates against a database where the schema is dynamic and ...
3
votes
1answer
2k views

How do I decide what testing framework to use?

The situation is this. I'm a junior developer for a small government IT project. We don't have anything of continuous integration or a automated testing framework. But the idea is to be developing ...
3
votes
2answers
169 views

TDD workflow for (implementation specific) edge cases

When developing features with TDD, I create a test for each combination of feature and case. So, one test for creating user successfully, one for validation errors, and one for database errors. I ...
1
vote
3answers
609 views

How to use mock objects [C++] without passing them as arguments to functions

I'm in the process of integrating a Unit Testing Framework for an existing code base in C++. I've zeroed down on CxxTest, but as it turns out we can use other Mocking Frameworks (like googlemock) in ...
27
votes
7answers
2k views

Is it sufficient to use acceptance and integration tests instead of unit test?

Short introduction to this question. I have used now TDD and lately BDD for over one year now. I use techniques like mocking to make writing my tests more efficiently. Lately I have started a ...
2
votes
1answer
140 views

How can I automatically test a large, complex spreadsheet?

So, I've inherited one of those "Engineer's Special" spreadsheets -- the kind developed by Mort the Engineer, with lots of hairy VBA and WTF, complicated calculations, and no documentation. ...
3
votes
1answer
103 views

Testing: Should I wrap system notifications and send my own?

In the current Cocoa app I'm working on, I've got an object, RecordScheduler, which responds to two types of notifications, "day did pass" and "quicksaving interval did pass". In both cases, the ...
3
votes
2answers
189 views

Unit testing method name standard for overloaded methods

I have read several posts which discuss coding standard for naming the unit test methods for improving readability. I follow this NameOfMethod_ExpectedBehavior_WhenSomeScenario, but now I am confused ...
15
votes
6answers
946 views

TDD and complete test coverage where exponential test cases are needed

I am working on a list comparator to assist sorting an unordered list of search results per very specific requirements from our client. The requirements call for a ranked relevance algorithm with the ...
16
votes
6answers
1k views

what kind of functions and/or classes are impossible to unit test and why

Main excuse from the developer for not having a good unit testing is "Code is not designed in a unit testable fashion." I am trying to understand what type of design and code that can't be unit ...
3
votes
2answers
173 views

Writing a unit test for a platform dependent unit

I have a method to be tested which depends on the OS, what's the best approach for testing the method depending on the OS? Is it to test on every OS that I have I require? Is there a better approach ...
4
votes
1answer
349 views

Understanding unit testing concept

I've just started writing unit tests and I'm not sure am I doing it the "right way." Should I test every class "by removing dependencies"? In other words, does unit testing mean: "test part of a code ...
7
votes
2answers
214 views

To load or not to load data for unit tests from external files

When unit testing I often find myself debating how much of the data I feed to, and expect back from my units under test, I should include in the actual test files. The tradeoff I constantly ...
3
votes
1answer
183 views

Inheritance in test classes

I have an interface Serializer with methods serialize and isSerializerFor. I created a first implementation of this using TDD, and ended up with a nice clean test case fully covering a nice clean ...
1
vote
1answer
111 views

Loading data for ShoppingCart item

I'm currently trying to cover our shopping cart with unit tests. Class ShoppingCartItem has property Term. It also loads available terms for this item upon object creation. Currently this is done ...
1
vote
2answers
146 views

Testing Framework Selection: xUnit family theory

Background: I am familiar with xUnit family frameworks and have had experience with (shunit2, PhpUnit and simpletest). I am currently trying to find a testing framework for C++. I did a quick search ...
6
votes
3answers
904 views

How to mock method with hard coded object?

I am working on an application which have multiple layers. Data access layer to retrieve and save data from data source, business logic to manipulate data, user interface to show the data on screen. ...
5
votes
1answer
166 views

Managing false positives in TDD or BDD

I'm relatively new to TDD and have been thinking a lot about how to manage the perpetually growing pool of tests that comes with it. One of my biggest concerns is about false positives. In my ...
2
votes
1answer
248 views

When NOT to unit test? [duplicate]

I am hitting a stumbling block with TDD flow. We are using PHPUnit+FuelPHP and I am stuck on how to write a unit test for our image upload/cropping feature. FuelPHP is notoriously hard to unit test ...
3
votes
3answers
130 views

Should test fixtures be added to code repositories?

I'm unit testing some code that processes data from an external API. That external API serves up a large pile of JSON data. The right thing to do here, of course, is to use fixtures in the unit ...
8
votes
2answers
336 views

Unit testing side effect-heavy code

I'm starting to write C++ code to run a robot, and I don't know how to incorporate unit testing, if indeed I can. I have been provided with a library which allows the creation of "commands" for the ...
0
votes
2answers
205 views

Unit test DAO code using SQL Lite when the application database is Oracle

We have an application with Oracle backend. The DAO layer is written in C# and uses nHibernet to perform the data operations. To unit test our DAO code, we use SQL Lite which creates the database ...
6
votes
3answers
234 views

Unit (regression) testing scientific algorithms given floating point behavior

I have been working on a project and running into a very difficult problem. The problem can be stated simply as how to unit-test numerical algorithms. However if you just took this simple statement ...
0
votes
1answer
183 views

How would you create useful tests for Oracle BI Publisher reports?

I'm curious about how to test reports that seem rather straightforward. I'm supposed to create test cases for an Oracle report(XML Publisher/BI Publisher). So for example, a report is supposed to just ...
8
votes
6answers
1k views

Why did Java make package access default?

I'm asking this question because I believe they did it for a very good reason and that most people do not use it properly, well from my experience in industry so far anyway. But if my theory is true ...
2
votes
3answers
229 views

How should I go about bringing this code under test?

I'm working on an open-source test framework. 90% of my codebase has good test coverage. My main problem area is the command-line entry point. This module began life as a very short script for ...
2
votes
1answer
524 views

How to unit test a web client?

I am having a lot of trouble understanding how to unit test my web client. I have just finished a project using TDD for the first time - this project hd no external dependencies such as API calls or ...
1
vote
3answers
450 views

Unit Testing Wrapper (Facade?) Method

I have to write unit tests for some classes my group is developing. The classes are fairly simple, and I'm not sure how to best test them. public class MyObjectRegistry { private ...
1
vote
3answers
94 views

Is it okay to test multiple similar files in one functional test

I've a functional test using Junit which tests delivery of xml file to an end-point. XML file is sent by client, so I copied it to a test folder, read it from there in my test and do asserts. We ...
20
votes
2answers
596 views

How do I create an environment where fixing tests is seen as a priority?

I am a software engineer at a medium sized company. We have a fairly robust testing platform running on TeamCity. It does unit tests on every checkin, and a daily unit test/BVT run. The problem is ...
2
votes
2answers
447 views

Unit testing to prove balanced tree

I've just built a self-balancing tree (red-black) in Java (language should be irrelevant for this question though), and I'm trying to come up with a good means of testing that it's properly balanced. ...
3
votes
1answer
131 views

unit testing on ARM

We are developing application level code that runs on an ARM processor. The BSP (low level code) is being delivered by a 3d party so our code sits just on top of this abstraction layer (code is ...
2
votes
2answers
356 views

Unit-testing code that relies on untestable 3rd party code [duplicate]

Sometimes, especially when working with third party code, I write unit-test specific code in my production code. This happens when third party code uses singletons, relies on constants, accesses the ...
0
votes
3answers
95 views

How can I unit test that a class uses a trait in the expected manner?

A class has a trait. The class is expected to call a function provided by the trait during a certain method invocation. How do I write a unit test to ensure that that happens? The difficulty, to ...
4
votes
2answers
340 views

Looking for a very subtle unit testing example [closed]

In the context of Continuous Integration, I need to teach unit testing to a 20-people audience of programmers. Everything will be all right, but I am still trying to find the perfect unit testing ...
2
votes
2answers
262 views

Why is it not standard to implement abstraction layers for the file system?

I have been taught to access databases through abstraction layers. I was wondering why it is not also standard practice to access the file system through an abstraction layer? It seems to me unit ...
0
votes
1answer
251 views

how to architect this to make it unit testable

I'm currently working on a project where I'm receiving an object via web service (WSDL). The overall process is the following: Receive object -> add/delete/update parts (or all) of it -> and return ...
0
votes
2answers
79 views

Area of testing

I'm trying to understand which part of my code I should to test. I have some code. Below is example of this code, just to understand the idea. Depends of some parametrs I put one or another currency ...
0
votes
1answer
122 views

unit level testing, agile, and refactoring [duplicate]

I'm working on a very agile development system, a small number of people with my doing the vast majority of progaming myself. I've gotten to the testing phase and find myself writing mostly ...
0
votes
1answer
77 views

Test Doubles : Do they go in “source packages” or “test packages”?

I've got a couple of data access objects (DefaultPersonServices.class, DefaultAddressServices.class) which is responsible for various CRUD operations in a database. A few different classes use these ...