unit-testing

Include NUnit in my Open-Source Project Download?

I'm considering two possibilities: include NUnit with the source code of an open-source project - to make it very easy for the potential contributors to run automated tests right away. I feel it is important to promote the "tests-first" culture in this project (or at least make it clear to everyone that tests matter). distribute the ...

How to verify a certain javascript function has been called during unit testing

Hi all: I'm using JsTestDriver and a bit of Jack (only when needed). Does anyone know how to verify that a javascript function has been called during unit testing? E.g. function MainFunction() { var someElement = ''; // or = some other type anotherFunction(someElement); } And in the test code: Test.prototype.test_mainFunct...

Why using Integration tests instead of unit tests is a bad idea?

Let me start from definition: Unit Test is a software verification and validation method in which a programmer tests if individual units of source code are fit for use Integration testing is the activity of software testing in which individual software modules are combined and tested as a group. Although they serve different purposes ...

Best Practices for improving Software Quality

We are looking for methods to improve our internal processes when developing software. We have already adopted TDD contiguous integration and Agile. Any obscure features of visual studio or TFS? All suggestions welcome. ...

Is it okay to run for loops in functional test methods?

Is it okay (conceptually) to run for loops in test methods? I'd like to test a range of parameter values into a controller, to determine if the different inputs return the correct values. test "logged in user - add something - 0 qty" do @app = Factory.create(:app) (0..5).each do |t| @qty = t login(:user) ge...

Why or how to use NUnit methods with ICollection<T>

Some of NUnit's Assert methods are overloaded to use ICollection but not ICollection<T> and thus you can't use them. Is there anyway around this? Heck, am I doing something stupid? I'm having to drop back to using Assert.AreEqual rather than specialised methods and its making my tests ugly. Any advice? Edit: Thanks for the responses...

Best Practices for how to include unit tests in a library

I'm working on a general code library for ActionScript 3.0 called as3lib which includes several extensions to the core API and some useful functions. I've written several unit tests (using FlexUnit) to make sure everything is working correctly. What is the best way to organize these tests in the library? Currently, I have all my code in...

Does Team System Test support running tests under a specific identity?

Hi, Is it possible to configure unit tests in Team System Test to run under a specific identity (similar to runas)? Thanks much, Jon ...

How to setup a unit test in VBA Excel Macro?

Hello, I am working on an Excel VBA macro that will take some excel file, scrub / clean it, and produce a workbook with 2 sheets - sheet 1 being the original 'dirty' file, sheet 2 being the cleanly scrubbed file. Since we have 10 different formats right now, and down the road 40+.. I would like to save this output for a given set of f...

C#, NUnit: Is it possible to test that a DateTime is very close, but not necessarily equal, to another?

Say I have this test: [Test] public void SomeTest() { var message = new Thing("foobar"); Assert.That(thing.Created, Is.EqualTo(DateTime.Now)); } This could for example fail the constructor of Thing took a bit of time. Is there some sort of NUnit construct that would allow me to specify that the Created time don't have to be ex...

easiest way to get continual unit tests running locally with visual alerts, with xUnit for C#/VS2008?

Hi, I'm currently using MSTest in VS2008 for unit tests, but I am looking at going to xUnit.net. Question - What would be the easiest way to get my unit tests running continually locally (on my PC) and with some sort of visual alert of pass / # of fails. i.e. similar to what we do in Ruby on Rails with autospec. THanks PS Interseste...

Testing Model binding in ASP.NET MVC 2

First; I know that I should not need to test the internals of MVC but I REALLY need a suite a tests around data flowing into our system. How can I, I hope without mocking all of HTTP context, test that objectA (form collection, dict, collection, object, etc) does or does not conform to objectAModel? I'd like to not have to instantiate...

Creating Javascript object from JQuery object

Hi all: Currently I'm unit testing the following code: if ($(selectedElement).innerText == 'blah') { // do something } with selectedElement being an anchor object selected from the UI. In my test code, I have created a DOM structure which has that anchor in the proper position ready to be selected. The problem here is that sinc...

getResourceAsStream works differently on Mac OSX vs. Windows 7?

Hi all, I have a set of unit test cases that depend on a test.properties file. When I run the tests under Mac OSX or Linux using Maven ('mvn test'), they work fine. But when running under Windows 7, they can't find the file unless I copy it directly to the class folder. The code to return the properties is the following two methods: ...

Concurrent debugging / unit testing alternitive to MS CHESS

I was recently reading a question here (some time this week), which I can't find again ><, where someone was asking about concurrent testing. One of the suggestions was CHESS however I can't use this due to the licence for the VS2008 Pro version being only for academic use, and I don't have Team System. Does anyone know of an alterna...

jQuery matching ID with a ' = ' in it

Hi all: Has anyone tried matching an id with an equal sign (=) in it, and WORKED? E.g.: // DOM structure /*DOC += <span id='Test=Test' class='something'></span> */ var test = $('#Test=Test'); I tried the above code. jQuery doesn't like it and returned undefined. However if I match the span's class, I could actually find the span (...

Best Practice: Organize Unit Tests.

Hello there, I have solution with >270 projects, it contains various folders and etc. Imagine each project have Unit Tests, what do you think what is the best way to organize them? Should each project have Unit Tests near by, or I should create special folder for them, or even different solution for just unit tests. How do you organi...

how to use cpp unit

Is there a good book or online site discussing the use of the CppUnit, for a beginner? ...

How to unit test a WCF server/client?

I have a WCF server that is a library assembly. (I am writing it so I can mock the level below it) It is called var a client helper class that is in a different assembly. As the data that is transferred is complex and the server has to send call-backs to the clients I wish to test the WCF code in isolation. (I am only interested in t...

How to map and test a "Many to Many Relationship" in NHibernate using Fluent NHibernate

Hi! When I test my many to many classes an error occurs: System.ApplicationException: Actual count does not equal expected count. Entities: public interface IEntity { int Id { get; set; } } public abstract class Entity : IEntity { public virtual int Id { get; set; } public virtual bo...