unit-testing

iPhone SenTestingKit failing to find AppDelegate in UnitTestBundle target

Hi, I'm trying to set up my unit testing for an iPhone application using XCode 3.2.3. I followed the steps in http://developer.apple.com/iphone/library/documentation/xcode/conceptual/iphone_development/135-Unit_Testing_Applications/unit_testing_applications.html As closely as I could, but I am getting this error message upon trying to...

Xcode Testing - Followed Code from Docs but Getting Errors

Hi all, I am new to XCode and testing, and have followed the steps outlined in the iPhone Development Guide under "Unit Testing Applications". I added a unit-test bundle to my project, named it "LogicTests", set it as the active target, then added a sample "LogicTests" unit-test class under a new group called "Tests". I wrote the simp...

Determining which tests cover a line of code

Is there a way to determine the set of unit tests that will potentially execute a given line of code? In other words, can you automatically determine not just whether a given line is covered, but the actual set of tests that cover it? Consider a big code base with, say, 50K unit tests. Clearly, it could take a LONG time to run them all-...

Force controller to use current_user with mocking

I am trying to specify in my RSpec tests that my controller should use current_user.projects.find() instead of Project.find() I am using the Mocha mocking framework and was trying something like this: controller.current_user.projects.expects(:find).returns(@project) I have already mocked out controller.stubs(:current_user).returns(@pr...

OCMock on iOS 4

I've been having troubles to run OCMock with iOS 4. I've read that a possible solution os to build the library, and install libOCMock.a, but honestly, i don't know how. Any help would be usefull ...

Test-driven development vs. Test-first development

What is test-first development and how does it corelate to TDD? Is test-first development a general name for things like TDD? If yes, what other test-first practices do exist? ...

JavaScript Unit Testing integrated with CruiseControl.NET

I'm looking for framework which provides unit tests for JS. Later, I'll have to integrate it with CruiseControl.NET. I have a lot of asp websites using JS and I need to automate testing for them. For example I used local JSUnit (may be other framework), which was quite easy for me, but I have no idea how to integrate it with CC.NET. Mayb...

Should I test public class function, that changes only internal state of the object?

I decided to add unit tests to existing project (quite big one). I am using "google toolbox for mac" for various type of STAssert... and OCMock framework. But I think I'm testing wrong. For example, I have public function saveData, which doesn't return anything and only change internal state of the object. Should I test it? Due to enc...

Emulating/faking filesystem for testing C code?

I'm looking for the cross-platform way to test some features in my application which required access to the filesystem (to write and read binary data). In the real life my application running on Linux and store special data in /usr/local/etc directory. But main part of the application is cross-platform library and it should be tested bot...

Is this a good place to use PIMPL pattern?

I'm working on a library that defines a client interface for some service. Under the hood I have to validate the data provided by users and then pass it to "engine" process using Connection class from another library (note: the Connection class isn't known to the users of our library). One of my colleagues proposed using PIMPL: class Cl...

PDE headless build: howto run junit tests via ant and cruisecontrol

Hi all, I am working on the automated pde headless build of my rcp application. This works fine after I have solved this issue: target-platform-for-pde-headless-build-does-not-work Now I want to do 2 more things: Integration of that process into cruisecontrol and run my junit-tests which are located in a separate plugin after a successf...

How to compare 2 Websites after changes in Backend / Framework

Following "problem": Website build with PHP/HTML working We want to change this site to PHP + Zend Framework + HTML The Goal: After implementing the Framework the site should look like without the Framework. Is there any way to test this automaticly? If we just save the page before and compare it with the new version i will not work ...

run method in testcase.rb ,what type should the argument be of

For the run(result) method in test/unit/testcase.rb what attribute type should my result be of .It will store the result from the error and assertions from the TestCase class i dono if it should be TestCase object or something dono.. could someone help ...

How to mock web api in unit test

Hi, guys! Now my team working on a client application(c#), and I need to call some web apis that returns xml messages. I want to test the methods that calling these web apis, I know I should use mock objects in unit test. But I can't know how to use it correctly, because this is my first time to introduce unit test to my project. Can som...

Expectation for find not working, but expectation for find_by_id is

I have this controller code: # GET /cardsets/1 def show @cardset = current_user.cardsets.find_by_id(params[:id]) end And this RSpec test code (mocking with Mocha): # GET Show context "on get to show" do it "should assign cardset" do @cardset = Factory(:cardset) @profile = @cardset.profile @profile.cardsets.expects(:f...

Rspec: run just a few testcases from file

I have a bunch of tests in my spec file and in this way I run just one of them: rake spec SPEC=spec/integration/gardens_spec.rb SPEC_OPTS="-e \"should foo\"" If there is any way to run 2-3 of them with a single command(let's call those testcases "should bar" & "should baz")? ...

Writing Useful Unit Tests

I have a simple page with a Grid that I'm binding a collection of objects to. I also have some simple functionality on the grid to edit and save rows. I would like to write unit tests for this page, but it's not really making sense to me. For example: Private Sub LoadGrid() 'Populate Collection grid.datasource = MyCollection grid.datab...

Use reflection or a property when unit testing?

This is a class I'm a bit concerned about. My goal is to unit test the addresses list: public class LabelPrinter { private readonly IEnumerable<Address> _addresses; public LabelPrinter(IEnumerable<Address> addresses) { _addresses = addresses; } public Document Create() { // ... Generate PDF, etc...

VS2008 Unit Testing System.IO.FileNotFoundException on XML input file (with "Copy Always")

I added a HolidaysSchedule.xml file to my Unit Test, and set it's property "Copy to output directory" to "Copy Always". This file contains the holidays of my client. When I do a "Debug Tests in Current Context" on a specific test that I wrote to check to see if a date is a holiday, I get this error. Test method FRB.EC.Utils.MiscUni...

Failing in generating moles files for an assembly

I have been looking at Moles for testing my entity framework generated classes and followed the steps outlined in the video and also the tutorial help documents however I am failing at the first step. I get the following error when adding a new moles file item ensuring that the name of the .moles file matches the assembly I have in the ...