unit-testing

How stable is NSubstitute?

My company is looking to standardize on an Isolation Framework. I was looking at MS Stubs (cause Moles seemed cool and I thought I would keep it in the same framework). However, Stubs is not quite ready for prime time yet (it is still a bit buggy in normal functionality). So now I am looking at what else is out there. I have looked a...

How to make Gallio remember which categories of tests I want to run when reloading the Tests Explorer TreeView?

If I have a loaded assembly in Gallio, and I select a couple of Tests and click "Start" it will run those tests and still remember which tests were selected. On the other hand, if I hit "Reload", it will forget which tests I had selected (rendering the feature kinda useless). Is there any way to prevent this behaviour? I have my tests d...

How would I translate this to a Unit Test?

Most examples I see of Unit tests are simple tests like Assert.That(5, 2 + 3), but how would I incorporate a unit test a method that gets a users information and saves them to a database. For example, I have a Register method that takes a User object. The User object properties are populated from a web form and then it is saved to the ...

Is there an MBUnit attribute to run Row tests in the order they were defined

I've tried googling around for this but have found nothing. Basically, I'd like to run each row in the order I defined it. For example, if I have this: [Row("a")] [Row("b")] [Row("c")] [Test] public void Test(string s)... I want to be sure that test A is executed before test B, and test B is executed before test C. ...

Grails test-app: How can I disable junitreport?

Hello, I am trying to run some unit tests for my grails app, via "grails test-app -unit". This works as expected. However, when the tests are done, junitreport takes way too long to generate the HTML results, eg: [junitreport] Transform time: 33294ms 33 seconds (on top of the rest of the time) is ridiculous when I want to rapidly mak...

How to give a presentation on unit testing with nunit?

If you had to give an overview on unit testing with some practical examples to other colleagues and you yourself weren't up to speed on unit testing, how would you approach that? Examples would be shown in nunit, but I guess it could be any unit testing framework. ...

free automatic regression test tool for asp.net applications ?

we are working in a small team. We often had problems like developer1 did some changes in stored procedure or funtion and it affected work of developer2. Such issues are traced out by chance later. Please guide me how such issues can be stopped. Is there a free tool that we can run to test such issues. thanks ...

How can I store testing data for python nosetests?

I want to write some tests for a python MFCC feature extractor for running with nosetest. As well as some lower-level tests, I would also like to be able to store some standard input and expected-output files with the unit tests. At the moment we are hard-coding the paths to the files on our servers, but I would prefer the testing file...

Makefile for Unit Tests in C++

I'm struggling to write Makefiles that properly build my unit tests. As an example, suppose the file structure looks like this src/foo.cpp src/foo.hpp src/main.cpp tests/test_foo.cpp tests/test_all.cpp So, to build the executable test_all, I'd need to build test_foo.o which in turn depends on test_foo.cpp but also on src/foo.o. What...

WPF - Unit testing a custom markup extension

Hi, how would you recommend unit testing a custom markup extension in WPF? Presumably, I need to create an instance of my markup extension and call the ProvideValue method. However, this requires an IServiceProvider, which contains an IProvideValueTarget service. How would I generate this programmatically? ...

is it practically possible to do good TDD (or BDD) without using any DI framework in java?

IMO one of the main characteristics of a good TDD is: testing your class (or actually unit) in isolation. When you do so, you are able to actually test single behavior in each test -- only one test will fall for a single problem you have. For this you first must verify that there are no static references from your class (including cons...

unit testing frameworks for ASP.NET projects

I'm starting to study unit testing now and I'm trying to decide between MS test and nUnit. What do you recommend me? I'm not an "IT professional", so my knowledge aren't (yet!) so much advanced. I will implement this in a project with .NET 3.5 using NHibernate, but I'll implement it too in an MVC project. ...

Visual Studio 2010 Unit Test not showing in Dropdown menu

I installed NUnit to show up in the Test Framework dropdown menu in Visual Studio 2010. The setup went good and NUnit now shows up in the Test Framework dropdown menu for my ASP.NET MVC2 projects. My problem is the Visual Studio Test has disappeared from the Test Framework dropdown menu. I ran a repair on Visual Studio but that did not r...

Unit testing with datastructures

Hello everybody, i want to undertake some unit tests and a few functional tests on a working system. However i have a datastructure that mostly consists of a few arrays in an object (well its fortran, so not a real object, but you get the idea.) How would an example look like to unit test a datastructure? all examples i have seen so fa...

nosetest deprecation warnings

I am getting deprecation warnings from nosetest for 3rd party modules imported by my code. Does anybody know how to silence these warnings? I know of the following flag which works for arbitrary python runs of the same code: python -W ignore::DeprecationWarning But, calling nosetest does not appear to offer me a similar flag to...

How can I mock an OracleConnection and OracleCommand?

For my tests I need to mock out the data client, in my case they are Oracle. I have created my data access layer to allow this to be passed in: public static Int32? GetUserRoleId(string userName, OracleConnection cn, OracleCommand cmd) I am using Moq, though I can switch to another framework if needed, and when I go to create the Moc...

write a clean junit4 tests

with junit test , how could I start the application software then close it properly and do it for each test ? @test public void test1(){ // start appli //test Jtextfield //close appli } @test public void test2(){ // start appli //test ComboBox //close appli } @test public void test3{ // start appli //test Jbutton //close appli } ...

Verify the number of times a protected method is called using Moq

In my unit-tests I'm mocking a protected method using Moq, and would like to assert that it is called a certain number of times. This question describes something similar for an earlier version of Moq: //expect that ChildMethod1() will be called once. (it's protected) testBaseMock.Protected().Expect("ChildMethod1") .AtMostOnce() .Ve...

Unit Testing Virtual Methods in a Linq

I have the following class structure that I need to unit test: public interface IFoo { int Value { get;} int GetValue(); } public class BaseClass : IFoo { public virtual int Value { get { return 100; } } public virtual int GetValue() { return Value; } } public class ChildClass : BaseClass, IFoo { pu...

How can I disable a third party API when executing Django unit tests?

I'm trying to build some unit tests against some code I have in Django that runs operations against a third party API. Specifically, I'm synchronizing some user data with MailChimp and using a library that implements the MailChimp API. I have a custom class MailChimpAPI that essentially acts as a thin wrapper around the Python library I...