unit-testing

How do you unit-test controllers that oauth?

I like Spring MVC because you can unit test your controllers. But testing controllers that oauth is another thing. For instance if I want to get the authorization url because I want to Oauth to GData, I would have to deploy the web-app because Google will only accept authorization requests from my domain (the url of my web app), not my...

SubSonic GetPaged method - different index needed in unit test

I'm using SubSonic 3, and am using the ActiveRecord approach. I have a simple query in my controller: var posts = from p in Post.GetPaged(page ?? 0, 20) orderby p.Published descending select p; The "page" variable is defined as an nullable int (int?). Here's the problem, when I run the following test, it work...

Change Default MsTest Unit Test Wizard Template

My team is using the unit test wizard, but has found the amount of cruft generated annoying. Is there anyway to modify this template? Thanks ...

Designing Constructors for Testability

I'm working with some existing code, trying to add to it and increase the unit tests for it. But running into some problems with getting the code testable. Original Constructor: public Info() throws Exception { _ServiceProperties = new ServiceProperties(); _SshProperties = new SshProperties(); } I'm aware that this is bad, and ob...

How to handle unit tests in F#?

How do you create unit tests in F#? I typically use the UnitTest portion of Visual Studio with a [TestClass] and [TestMethod] attributes and use the Test View to run these. I know I can just create a script file and run these, but I like the way that it is currently handled. ...

Unit and integration testing in C++

I'm going to write a quite large application for school project in C++. So far I'm quite used to TDD in Java and Ruby using JUnit and RSpec. But as far as my experience goes, I've never seen any C/C++ project with any test suite. What library do you recommend for testing in C++? Are there any good mocking/stubbing frameworks for C++? ...

Unit test with accessors

This is a two part question. Background: We moved our C# application from VS2005 to VS2008 and in the process moved the application from .net 2.0 to .net 3.5. The transition went smoothly except for Unit Tests. First: Is the unit test framework based off Visual Studios or .NET? Second: This question is derived from the issues we have ...

Best Practice on unit testing XmlDocument

For unit testing XmlDocument, I'm a little bit worried about the way I write test case. To assert the XmlDocument, I'm creating XmlElements manually. sometime the XmlDocument to test is large, so I need to write a lot of code to build an expected xmldocument. the workload is huge. Is there any better implement on XmlDocument unit testi...

Using Eclipse SimpleTest plugin - SimpleTest not working

I'm using Eclipse 3.4.2 and installed the latest plug-in for simpletest using Help>Software Updates... The plugin installed correctly and I was able to set it up in Window>Preferences>SimpleTest. I have filled in the following fields : Php.exe file, php.ini file, and test file Suffix. I was not able to find the simpletest Path (not even...

Pass Parameters to Rails Unit Tests

I was wondering if there is a way to pass arguments to individual tests in rails similar, or similar in idea, to NUnit's TestCase Attribute. Thanx ...

Concept of, Framework for , How to Test View of MVC (Ruby on Rails)

I am now doing the UI from fresh so I want to make it fully test. Could anyone suggest the correct way to do this and where should be the good place to start? such as Concept, Framework. (I already know some concept of testing) ...

c# class-wide exception handling

Is it possible to catch exceptions in a single place in a c# class file? I'm coding some unit tests in NUnit to test for a WCF Web-Service, and on all methods/tests want to trap a "EndpointNotFoundException" without having to code this for each test. edit I guess i wanted to create a descriptive error in this case without having to pu...

Unit Testing with fakes or mocks?

I'm trying to follow good practices when writing my testing suites. Halfway through i realised that iam spending alot (Most) of my time on the Fake Objects...Most of my tests does something like this public interface ITemplateRepository { string get GetGenericTemplate {get;} } public FakeTemplateRepository : ITemplateRepository ...

Unit testing code coverage - do you have 100% coverage?

Do your unit tests constitute 100% code coverage? Yes or no, and why or why not. ...

Unit test with files system dependency - hidden files

I am writing a "Total Commander" like application in Java. There is quite obvious file system dependency here. I want to unit test it. I created directory structure for test purposes, I keep it in known location in SVN repository. It works great so far. Now, I have a method that should ignore hidden files. How can I go about this? Can...

Multi language testing framework

I need to write two versions of the same application, one in .NET and the other one in Java. So I'd like to write a single test suite, and then use it against both codebases. Which testing tool would you advise me to use? ...

How do I setup a call of an Equals with a specific type overriding the Equals in MoQ?

Working with the fine mocking-framework MoQ, I came across a somewhat surprising facet (and I don't like surprises). I'm mocking out a class which should be added to a collection after a method-call, like so: public class SomeClass{ } public class Container { private List<SomeClass> classes = new List<SomeClass>(); public IEnumerab...

output_buffer is null on helper spec

I am trying to test the html block method inside the rails helper: def dashboard_widget(header, &proc) concat('<div class="dashboard-widget">') etc end The code works perfectly in the development environment, but the following test is failed: it "should be created" do helper.dashboard_widget('My widget') do "hello world" ...

How to pass multiple parameters to tests that share the same setup code in Matlab xUnit?

According to "How to Write Tests That Share Common Set-Up Code" is it possible to: function test_suite = testSetupExample initTestSuite; function fh = setup fh = figure; function teardown(fh) delete(fh); function testColormapColumns(fh) assertEqual(size(get(fh, 'Colormap'), 2), 3); function testPointer(fh) assertEqual(get(fh, '...

wpf databinding testing

I'm in the process of learning WPF, where one of the strong suits is supposed to be data binding. When I do a win forms app, because I don't trust data binding much, I use what Fowler would call an assembler and just do it by hand, which makes it easy to test also. I've read Jeremy Miller's blog enough to see he has issues with data bin...