I work with a lot of web applications that are driven by databases of varying complexity on the backend. Typically, there's an ORM layer separate from the business and presentation logic. This makes unit-testing the business logic fairly straightforward; things can be implemented in discrete modules and any data needed for the test can b...
How do you perfom Unit-Test like tests in C? Which framework or do you do other Tests as Unit-Tests on code level?
...
I have an object that I'm testing that raises an event. What is the best way of using Rhino Mocks to check that it was raised?
Best I could come up with (I am certain it gets better than this):
public void MyCallback(object sender, EventArgs e) { _flag = true;}
[Test]
public void DoSomethingRaisesEvent() {
_flag = false;
using(...
How to unit test WCF services? Any 3rd Party tools available?
...
Anyone have any experience or tools for unit testing PL/SQL. The best looking tool I've seen for this seems to be Quests Code Tester, but i'm not sure how well that would integration with continuous integration tools or command line testing?
...
For simplicity, I generally split a lot of my configuration (i.e. the contents of app.config and web.config) out into separate .config files, and then reference them from the main config file using the 'configSource' attribute. For example:
<appSettings configSource="appSettings.config"/>
and then placing all of the key/value pairs in...
I do TDD, and I've been fairly loose in organizing my unit tests. I tend to start with a file representing the next story or chunk of functionality and write all the unit-tests to make that work.
Of course, if I'm introducing a new class, I usually make a separate unit-test module or file for that class, but I don't organize the tests ...
The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill?
My question is to what level of granularity do you write you unit tests at?
..and i...
I am currently using JUnit 4 and have a need to divide my tests into groups that can be run selectively in any combination. I know TestNG has a feature to annotate tests to assign them to groups, but I can't migrate to TestNG right now. It seems this could easily be accomplished in JUnit with some custom annotations and a custom JUnit Te...
I have some code that uses the shared gateway pattern to implement an inversion of control container. I have several hundred NUnit unit tests that exercises the code that uses this IOC. They all work (on my machine!) but I am concerned that these tests might fail under load. I seem to remember that NUnit (and MSTest) attempts to run t...
What are the best practices for naming unit test classes and test methods?
Previously
I don't know if this is a very good approach but currently in my testing projects I
have a one to one mapping between a
class and a test class, e.g. Product
and ProductTest
In my test classes I then have methods
with the name of the me...
With more and more code pushed to the Views in Asp.Net MVC (i.e. AJAX, JQuery, etc...), how do you maintain the 'testability'?
How do you test your Views?
How do you test your views with client-side jscript code?
How do you test your Views with Async behavior?
It seems that most examples on the testability of MVC deal with controller...
This might be an interesting question. I need to test that if I can successfully upload and fetch the PDF file. This works for the text based files but I just wanted to check for PDF. For this unit test to run I need a PDF file. There are couple of options. I can create a dummy PDF file and store it some folder and read that file and sav...
I simply could not make it work, and I am wondering if I am wasting my time, or if I am simply stupid!
Sorry I don't have the exact error I have right now. But I just want to know if it work or not!
...
I have a Selenium test case that enters dates into a date selector made up of three pulldowns (year, month, and day).
select validity_Y label=2008
select validity_M label=08
select validity_D label=08
This part gets repeated a lot throughout the test case. I'd like to reduce it by defining my custom action "selectValidity", so that I...
I have been thinking a lot about unit testing and how to improve the readability of the unit tests. I thought why not give a character to the classes in the unit test to clarify what they do.
Here is a simple unit test that I wrote:
[TestFixture]
public class when_dave_transfers_money_from_wamu_account_to_the_woodforest_account
...
I am not really familiar with Maven program but I've been using Eclipse for quite a while for Unit testing, code coverage, javadoc generation, code style checking, etc. Probably, the only main thing that I didn't really like about Eclipse is the "compilation errors" that it generates when you are running Eclipse and Ant simultaneously. S...
Bear with me, this is a beginner question: I'm a solo developer, quite familiar with C# and web development and I'm currently trying to shift to TDD since I believe I've understood the advantages in the long run. The classes I usually create do not implement any Interfaces (except from IDisposable and other standard candidates) since I n...
Any failed ASSERT statements on Windows cause the below debug message to appear and freeze the applications execution. I realise this is expected behaviour but it is running periodically on a headless machine so prevent the unit tests from failing, instead waiting on user input indefinitely.
Is there s a registry key or compiler flag I ...
I have been asked to write a testing application that needs to test a new stored procedure on multiple rows in a database, in essence I want to do something like this:
[Test]
public void TestSelect()
{
foreach(id in ids)
{
DataTable old = Database.call("old_stored_proc",id);
DataTable new_ = Database.call("new_...