unit-testing

JUnit: @Before only for some test methods?

I have some common set up code that I've factored out to a method marked with @Before. However, it is not necessary for all this code to run for every single test. Is there a way to mark it so the @Before method only runs before certain tests? ...

QUnit output: visual separation of modules

My tests may look like this: module("some module"); test("test A", ...); test("test B", ...); module("other module"); test("test C", ...); test("test D", ...); The output of QUnit will look like this 1. test A (0, 0, 0) 2. test B (0, 0, 0) 3. test C (0, 0, 0) 4. test D (0, 0, 0) Is it possible to make QUnit output the module nam...

Unit Testing and SharePoint Development

Hi, I am interested in writing unit tests for the SharePoint development work I am doing. Can anyone suggest practical approachs to implementing unit tests in MOSS? Note that any third party tools have to be free (but not necessarily open-source); the company I work for will not pay for additional tooling. In particular, any alternati...

Unit test, NUnit or Visual studio ?

Hi all, I'm using Visual studio (sometimes resharper) to run my unit test. I heard about NUnit, but I don't know many things about it... Should I care about it ? Can it offer something better than visual studio ? Should I Use NUnit and why ? Thanks for your help Tim ...

Is it good practice to have a table referenced by two different entities?

I am building a application with these patterns: Silverlight, RIA, EF, Prism, SL Unit Testing. This project will have lots of entities and lots of modules referencing those entities. Each entity is in its own RIA Service Library along with the RIA domain service and associated metadata. I am running into problems when I reference a ce...

Specify configuration file when running Tests on TFS Buid server

We do not have VS Test Edition. So we are running tests by specifying the dll which contains the tests: <TestContainer Include="$(OutDir)\%2a.Test.dll;$(OutDir)\%2a.Tests.dll" /> This works OK, except for the Integration tests that need to read information from the configuration file (App.config) Is their a way to specify the confi...

Testing: is there a framework allowing embedding Tomcat to simulate request/response cycles without involving HTTP?

For automated functional testing purposes, I would like to run a servlet container from my test driver without actually issuing HTTP requests over the network. The main goal is to test fairly elaborate conditions of servlet filtering, forwarding, and includes. I would like a system that embeds the servlet container in a way that: does...

Unit Testing in VB 6 with SimplyVBUnit

I've recently decided to start using some light unit testing to see if it adds any value to our project, but I'm having trouble finding documentation for SimplyVBUnit. Any suggestions? ...

Should I duplicate tests for convenience overloads?

It's really common for me to make convenience overloads for methods. Here's an example of something I might do: public void Encode(string value) { Encode(value, DefaultEncoding); } public void Encode(string value, Encoding encoding) { // ... } I'm starting to pay more attention to unit testing, and testing methods like thi...

xUnit Testing Framework for Mac/iPhone

Does anyone know of any xUnit testing frameworks for the Mac OS, more specifically for the iPhone OS? I've seen a couple online, google-toolbox-for-mac & objcUnit, but they don't seem to have had any development on them for a long time. Are there any Objective-C developers out there that perform unit testing and if you do what tools do...

Unit testing Linq 2 Sql lazy-loaded properties

Lets say I have a Customers table and an Orders table with a one-to-many association (one customer can have multiple orders). If I have some code that I wish to unit test that accesses a specific customer's orders via lazy-loading (e.g. a call to customer.Orders), how do I mock / stub that call out so that it doesn't hit the database? ...

Run an NUnit test without using the mouse?

When I want to run 1 test, I always have to right-click the method declaration and click "Run Test". Is there a way to do this without using the mouse? ...

How do I test that all my expected web.config settings have been defined?

I am using the built in test framework in VS2008 and I would like be able to write a test that makes sure all the expected web.config settings have been defined so that if by accident one is removed or changed my suite of tests will detect it and not have to be tested in a runtime scenario. How would I set this up? I do not want to set...

Continous Integration: PowerShell vs. CI Server (CC.NET or Hudson)

So, a friend and I have been discussing continuous integration and bat/powershell scripts versus CI servers like CruiseControl.Net or Hudson. The following powershell pseudo script works to update from SVN, build using msbuild, deploy/copy out, update a build/revision number in the app, and emails on failed builds. The next step would ...

How do I Unit Test a function that inserts a record into a RIA Services DB?

Hi, This is a sample function that works with an entity, saves it to a db and then causes problems because we can't write a Unit Test for it. Check it out: // this class exists in a Silverlight Class Library public class EmployeeSaver { .... public void Go() { Employee e = new Employee(); e.Name="Jeremiah"...

Testing ASP.NET MVC View Model

Hi! I'm using Nunit and Moq to test my asp.net mvc solution. Is this a good way to test that the model passed to the view is a correct object/collection? [Test] public void Start_Page_Should_Display_Posts() { var posts = new List<Post> {new Post {Id = 1}, new Post {Id = 2}}; var mock = new Mock<IRepository>(); mock.Setup(x...

What test framework should I use to test my Rails model?

With the many testing framework that is available in the Ruby community namely: unittest, rspec, shoulda, and coulda, what would be the most appropriate testing framework to test my Rails model? Do they basically have the same functionality, which is to unittest my model? When should I use which? What is the advantage of using one and ...

How to get Visual Studio Unit Test to copy a file to the tests area? (which works when running/debugging)

Hi, BACKGROUND: I have a sqlite file that is marked as COPY in it's properties. When I debug my WinForms application in VS2008 (or run it) it does the right thing and copy it to the debug/run area. QUESTION: When I run unit tests (using VS2008 unit tests) it is not performing this copy. Anyone know how to get this working? So that m...

Mocking without IoC or Dependency Injection

Hi All, Is there a way to use mocks or fakes in your unit tests without having to use dependency injection or inversion or control? I found this syntax can be used with TypeMock Isolator (http://learn.typemock.com/). It is a comercial product though, so I was hoping that other frameworks (such as RhinoMocks) would be introducing such s...

Is there any value in using abstract test classes ro run Unit and Integration testing?

I have this abstract test class [TestFixture] public abstract class BaseTests { private IRepository _repository; public BaseTests(IRepository repository) { _repository = repository; } [Test] public virtual void CanGetResultsFromSearch() { var results = _re...