Tagged Questions
Unit testing is a method by which individual units of source code, sets of one or more computer program modules together with associated control data, usage procedures, and operating procedures, are tested to determine if they are fit for use.
0
votes
1answer
21 views
Reusable Setup for Unit Tests
I am using xUnit and Moq to write my unit tests, and I have a lot of duplicate code in my various tests that I would like to pull out into some reusable fashion.
Duplicate Code
var note = new Note { ...
0
votes
1answer
33 views
Share procedure for different units
I have 4 units in my Delphi project (4 forms too) and I have a procedure in Unit 2 that is called "controlla".
procedure TForm2.controlla(numero:TEdit);
var a:string;
begin
// the code
end;
I ...
0
votes
0answers
10 views
Why does java service method successfully write out to a file but JUnit calling the same method in a unit test fail to write out?
I am using Java 7, JUnit 4.10.0, Mockito 1.9.5, and Eclipse Juno running in Windows 7 as my IDE. I am using JEE annotations for my Java classes. I have created a rest service and am running into an ...
1
vote
1answer
22 views
Play Framework & Scala: Mocking a method from with class
I have a method inside my Controller that I want to unit test using Spec2.
object MyController extends Controller with MyAuth {
def article(id: String) = {
authenticate {
......
}
}
...
0
votes
0answers
6 views
JerseyTest with AbstractTransactionalJUnit4SpringContextTests
I am trying to write a unit test that will test a REST service. The resource takes an id in the url and checks the database for this id. I am having trouble getting my jerseyTest object and the unit ...
0
votes
1answer
36 views
Junit: Separation of test cases
This is more of a junit logic question than anything else.
The scenario I have is below:
I have a standalone java application that consumes data from a web service and saves data from that service ...
1
vote
0answers
4 views
FitNesse Test Page Runs Alone But Not in Suite
I have a FitNesse test report (GroupByTest) that runs fine if you run the test by itself. It has about 500 rows of data in the table.
The test passes when run, however when I run the report in the ...
0
votes
0answers
13 views
Unit Tests, Inheritance and Visual studio
I've created an abstract test base class prefixed with [TestClass], that has a number of public methods prefixed with [TestMethod]. There are 4 classes that inherit from this base class, and each ...
6
votes
1answer
25 views
Target individual XCTest unit test cases in Xcode 5 to a specific iOS device for a universal app?
I'm building a universal iPhone/iPad application, and the UI is significantly different in some cases (i.e. on iPhone we use a Master/Detail paradigm with TableViews, whereas on iPad we're using a ...
1
vote
2answers
35 views
NUnit how can I prevent code repetition
I'm trying to work on Unit Test best practices, and I've come across a problem that I can't get my head around. The production code has a function that transforms a given object into another, like so:
...
1
vote
1answer
15 views
TDD the WCF service class itself first
So I started to create TDD tests for a new WCF service I wanted to create. In TDD, you create the test, and start adding objects that don't exist yet into your tests. First object I wanted to test ...
1
vote
0answers
17 views
When mocking an object, use spy or when?
I want to test a method, which gets an object with information as a parameter:
//mocking a user object with some random data
User user createMockUser(loginName, firstName, lastName, salutation, ...
0
votes
2answers
39 views
JUnit Test Class failure test
In my program in the GradeBook Class i was supposed to add a toString method to the GradeBook class that returns a string with each score in scores separated by a space.
This i have done and when i ...
0
votes
1answer
24 views
Is there a mocking framework that allows me to define new default behavior?
In our tests, we have mock objects which have just slightly different behavior. It would be nice to be able to override default behavior with new default behavior, so we would only have to define the ...
2
votes
0answers
16 views
How to write testable requirejs modules
I am new to unit testing so I might be missing something, but how am I supposed to structure requirejs modules in order to make them fully testable? Consider the elegant revealing module pattern.
...