unit-testing

Questions on about TDD or unit testing in ASP.NET MVC

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 ...

How do I run a unit test against the production database?

How do I run a unit test against the production database instead of the test database? I have a bug that's seems to occur on my production server but not on my development computer. I don't care if the database gets trashed. ...

How do I display the validation which failed in my Rails unit test?

Summary: Failed unit tests tell me which assert (file:line) failed, but not which validation resulted in the failure. More info: I have 11 validations in one of my models. Unit testing is great, whether I run `rake test:units --trace' or 'ruby -Itest test/unit/mymodel_test.rb'. However, despite the fact that it tells me exactly which ...

Do you do unit tests for non production code?

I am interested in the following scenario specifically. Suppose you have team that writes production code and a team that writes automatic tests. The team that writes automatic tests has a dedicated framework intended to write the automatic tests. Should the testing team write unit tests for their framework although the framework is not ...

Is there a strategy to back-port C# code?

Hi all, I intend using the Argotic framework in support of a .Net Atom server. Unfortunately my target server (over which I have no control) only has .Net 1.1 - any the Argotic library is only in .Net 2 and 3.5. So, I now need to back-port the code to 1.1. Can anybody provide any strategic tips for this undertaking? I'm aware of the ...

Gallio TestDriven.Net testing problem

Hello , I have a tdd system , where I use Gallio 3.1 with TestDriven.Net . I've downloaded the patches for them. 1) I'm getting this stack and the test wouldn't stop - SRCSRV: cmd /c svn.exe cat "http://mb-unit.googlecode.com/svn/branches/v3.1/src/Gallio/Gallio/Framework/Pattern/PatternTestInstanceState.cs@2360" --non-interactive > "C...

NCover couldn't create a coverage report. 0 Passed, 0 Failed, 0 Skipped

Hi, I am using Visual Studio 2008 Professional with TestDriven.NET 2.14.2190, Windows XP (x86). When i right click on my unit tests project, test with - Coverage, I obtain the following output: NCover couldn't create a coverage report. and the result: 0 Passed, 0 Failed, 0 Skipped I have no other versions of NCover installed, jus...

Unit Testing with SubSonic, ActiveRecord and SqlQuery

I'm trying to use the built-in testing features of Subsonic 3.0.0.4 by setting my connection string to "Test". My data access routines use the SqlQuery class. When I try to run a test against the "in-memory" repository, I receive this error: System.ArgumentException: Format of the initialization string does not conform to speci...

Why does Coded UI Test Builder show MSAA for WPF controls instead of UIA

Question When I select a WPF control with the crossline of the Visual Studio 2010 Coded UI Test Builder (screenshots), it shows that the used accessibility technology was MSAA. Why is it not UIA? Additional information I am trying out the new Coded UI Test feature shipped with VS2010 and TFS2010. I know that there are basically two U...

In TDD, should tests be written by the person who implemented the feature under test?

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,...

Simulating Ajax failures for QA testing

Our first ASP.Net MVC/jQuery product is about to go to QA, and we're looking for a way for our QA guys to easily be able to simulate bad Ajax requests (without modifying the application code). A typical integration/UI test plan might be: Load page, click button "DoStuff" "DoStuff" fails Attempt button "DoStuff" again "DoStuff" succe...

What is the role of asserts in C++ programs that have unit tests?

Greetings, I've been adding unit tests to some legacy C++ code, and I've run into many scenarios where an assert inside a function will get tripped during a unit test run. A common idiom that I've run across is functions that take pointer arguments and immediately assert if the argument is NULL. I could easily get around this by disabl...

Unit test class inherited from ContextBoundObject and decorated with ContextAttribute

I am trying to retrofit unit tests on to some existing code base. Both the class and method I want to unit test is decorated with custom attributes that are inherited from ContextBoundObject and ContextAttribute. I dont want them to run as part of the unit test. The only solution I have come up with is to compile the attribute out when ...

Automated testing with Ruby on Rails - best practices

Curious, what are you folks doing in as far as automating your unit tests with ruby on rails? Do you create a script that run a rake job in cron and have it mail you results? a pre-commit hook in git? just manual invokation? I understand tests completely, but wondering what are best practices to catch errors before they happen. Let's tak...

Easy to get a test file into JUnit

Can somebody suggest an easy way to get a reference to a file as a String/InputStream/File/etc type object in a junit test class? Obviously I could paste the file (xml in this case) in as a giant String or read it in as a file but is there a shortcut specific to Junit like this? public class MyTestClass{ @Resource(path="something.xml"...

How to differentiate public methods and private methods during api testing?

Is it possible to test private methods of a web service, during api testing? If yes, how to differentiate public methods and private methods? I am using the object browser in VSTS to see the list of methods available. ...

How reliable is Verify() in Moq?

I'm only new to Unit Testing and ASP.NET MVC. I've been trying to get my head into both using Steve Sanderson's "Pro ASP.NET MVC Framework". In the book there is this piece of code: public class AdminController : Controller { ... [AcceptVerbs(HttpVerbs.Post)] public ActionResult Edit(Product product, HttpPostedFileBase image) ...

How to unit test that a Windows Workflow Foundation (WF) activity can be serialized?

Problem: during execution, instances of classes that derives from System.Workflow.ComponentModel.Activity is serialized by the workflow engine. I'd like to unit test these types in order to ensure that they can be serialized. As of now, these exceptions only show up in production. Non-working solution: public class UnitTestActivity : A...

VS.Net 2008 Unit testing path problem.

I want to have a good test setup but, I can't find a way to put files in the "In" folder under TestResuls. How do I put files in the "In" folder. ...

Mocking with Boost::Test

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...