Can anyone point me in the direction of how I could get a NUnit test to run a .sql file to Create / Setup a database.
I know about the the TestFixtureSetUp and TestFixtureTearDown attributes / methods in NUnit.
So I KNOW how to call methods before and after all or each unit tests.
I'm just unsure of how to load and execute the conten...
Hi,
I am using the sharp architecture so I can easily use mocks etc. in my unit tests and/or during TDD. I have quite complicated business rules and would like to test them at the controller level. I am just wondering how other people do this?
For me validation tests business rules at three levels:
(1) Property level (e.g. property is...
Hi,
I am recently introduced to the test-driven approach to development by my mentor at work, and he encourages me to write an unit-test whenenver "it makes sense." I understand some benefits of having a throughout unit-test suite for both regression testing and refractoring, but I do wonder how often and how throughout we should write u...
I think shoulda is really neat, but what I don't understand is why some of the macros exist, such as:
should_validate_uniqueness_of :title
should_validate_presence_of :body, :message => /wtf/
should_validate_presence_of :title
should_validate_numericality_of :user_id
I'm relatively new to testing, but what purpose do these serve? The...
With an existing n-tier web application using ASP.net WebForms what is the best approach to get TDD acceptance on the application. What is a good plan to gain acceptance by developers to move forward to write test first code opposed to ignoring the tests while the TDD implementation is in limbo?
Knowing there will be a large "in-limbo" ...
I'm trying to write a unit test that will raise an event on a mock object which my test class is bound to.
What I'm keen to test though is that when my test class gets its eventhandler called, it should only call a method on certain values of the eventhandler's parameters.
My test seems to pass even if I comment the code that calls Pro...
Greetings,
I'm fairly new to TDD and ran across a unit test that I'm not entirely sure how to address.
Basically, I'm testing a couple of legacy class methods which read/write a binary stream to a file. The class functions take a serializable object as a parameter, which handles the actual reading/writing to the file.
For testing this...
[EDIT] Based on feedback yes, VS2010 seems to support SL4 Library TDD despite a couple strange messages when first creating the tests which said the test could not target Silverlight - problem seemed to go away - chalk it up to an RC bug I guess. I think my real out-standing question now is how to TDD a standalone library that uses eleva...
I'm trying to start unit testing on my application (should have done so from the beginning). I've got an Eclipse project structure set up and everything seems to work well, but...
I'm subclassing SQLiteOpenHelper to access the application database. This works well for the application, but when using the same class in the unit tests, it ...
I currently use a block eval to test that I've set an attribute as read-only. Is there a simpler way to do this?
Example from working code:
#Test that sample_for is ready only
eval { $snp_obj->sample_for('t/sample_manifest2.txt');};
like($@, qr/read-only/xms, "'sample_for' is read-only");
UPDATE
Thanks to friedo, Ether, and Robert P...
Is Test Driven Development limited to OO? Or is it possible/useful to use it in conjunction with a procedural language? I have to start a greater project in C the next few weeks and I'm thinking of ways how to the developing.
...
Is there an easy way to detect if you're running in the context of a Visual Studio Test as opposed to debug or release?
Here's the scenario - we have a factory class that we use heavily throughout our existing codebase, and I figured instead of refactoring it out in each class so we can substitute the default factory with one that wou...
I've been searching on how to do Unit testing and find that it is quite easy, but, what I want to know is, In a asp.net mvc application, what should be REALLY important to test and which methods you guys use?
I just can't find a clear answer on about WHAT TO REALLY TEST when programming unit tests.
I just don't want to make unnecessary ...
We run a project in which we want to solve with test driven development. I thought about some questions that came up when initiating the project. One question was: Who should write the unit-test for a feature? Should the unit-test be written by the feature-implementing programmer? Or should the unit test be written by another programmer,...
Hello everyone :)
I'm using the Boost::Test library for unit testing, and I've in general been hacking up my own mocking solutions that look something like this:
//In header for clients
struct RealFindFirstFile
{
static HANDLE FindFirst(LPCWSTR lpFileName, LPWIN32_FIND_DATAW lpFindFileData) {
return FindFirstFile(lpFileName...
Autotest will rerun all tests every time my tests start passing when they were failing. I have a lot of tests, and for reasons I won't go into, rerunning all of them is painfully slow.
How can I make it so autotest will never rerun all tests unless I Ctrl-C?
...
I'm still having issues justifying TDD to myself. As I have mentioned in other questions, 90% of the code I write does absolutely nothing but
Call some Windows API functions and
Print out the data returned from said functions.
The time spent coming up with the fake data that the code needs to process under TDD is incredible -- I lite...
Hi, I just started practicing TDD in my projects. I'm developing a project now using php/zend/mysql and phpunit/dbunit for testing. I'm just a bit distracted on the idea of encapsulation and the test driven approach. My idea behind encapsulation is to hide access to several object functionalities. To make it more clear, private and prote...
I am studying TDD using FitNesse and I am looking some tutorials and examples. I would like to know where to find a good material.
...
I get the following error when testing a named route
1) Failure:
test_settings_route(ProjectsControllerTest) [/test/functional/projects_controller_test.rb:15]:
The generated path <"/projects/1/edit"> did not match <"/projects/1/settings">
Here's the test and what I put in my routes file
# projects_controller_test.rb
require 'test_h...