unit-testing

BizUnit vs Visual Studio Team Test

With the release of BizTalk 2009 we can now use Visual Studio Team Edition 2008 to leverage some of the team test features. We can unit test maps, schemas, and pipelines ... but from what I can tell, that's about it. How would you unit test orchestrations for instance? Well I have been using BizUnit for years already and plan to contin...

Should .Net test classes reside in a different project?

The convention in Java is different - every "module" (equivalent to Java in IntelliJ) has a src and test directory. jUnit can thus run per project, and there's no need for a separate test project. ...

Debugging independent unit test bundle for iPhone?

I created an independent 'LogicTest' bundle as described in Apple's latest and greatest instructions for iPhone projects. I've successfully set up and debugged dependent test bundles on Mac OS, just fine. However I have not worked with independent bundles nor test bundles for iPhone before. The test bundle builds and executes tests ju...

Use Scala to unit test Java?

I'm familiar with using mock objects to help unit test my Java types, but find the inflexibility can lead to verbose and cumbersome test types and a lot of repetition. I've looked at using Groovy for unit tests with moderate success. I'm interested in learning Scala for itself, but would also like some advice on using it for testing Jav...

Using a friend class vs. adding accessors for unit testing in C++?

Is it better to add functions that return the internal state of an object for unit testing, as opposed to making the testing class a friend? - especially, when there is no use for the functions except for the case of unit testing. ...

Integrating CxxTest in XCode

I'm a complete newbie when it comes to XCode and I'm looking for something similar to Visual Studio integration for XCode. I'm developing on my Vista pc in VS 2008 and I want to be able to develop the same project on my macbook as well, but I don't know how to configure XCode to do the same things that VS does. ...

JUnit expected tag not working as expected.

I have the following test case in eclipse, using JUnit 4 which is refusing to pass. What could be wrong? @Test(expected = IllegalArgumentException.class) public void testIAE() { throw new IllegalArgumentException(); } This exact testcase came about when trying to test my own code with the expected tag didn't work. I wanted to see ...

Is there a set of stubs/mocks for JDBC available anywhere?

For the past few years I've continuously struggled with unit testing database code and all the pain that comes with it. I found this existing thread which I found very enlightening: What's the best strategy for unit testing databases? The author of the accepted answer suggests that it might be useful to mock the entire database layer...

Set a ServerVariable value when mocking HttpRequest using Moq?

I am mocking an HttpRequest object using Moq for unit testing in ASP.NET MVC. I need to set one of the ServerVariables (LOGON_USER) in the request. Is this possible? I have tried using the following method, but I get an exception because the ServerVariables collection is non-overridable. request.SetupGet(req => req.ServerVariables["...

Tests frameworks and tools for SOA Java developments

Currently, I'm looking for any experiences or advices about test tools on Service Oriented Architecture (SOA) Java developments. Which the bestpratices and best tools for this job ? Thanks for your time ...

Reflecting on a Moq Object produces 2 additional properties

I've got a couple of methods that use reflection to transform from one object type to another. I'm in the process of testing the transformation methods via Moq and have stumbled upon a behavior I don't know how to handle. When I reflect across a Moq object to obtain PropertyInfo's, I get two additional objects. Moq.Mock``1[Namespac...

How to unit test jQuery keyboard events?

Is there a way to test JavaScript keyboard event handlers (for keypress, keyup, keydown events)? I know I can declare event handlers like this: function keyUpEvHandler(e) { ... // code here } $('#myId').keyup(keyUpEvHandler); and then just run this function in unit tests, but I will have to prepare event argument object to be th...

How to create the vsmdi/testrunconfig file when importing a Visual Studio test project?

When I add an existing test project, my solution lacks the vsdmi and the testrunconfig files. How to create it? ...

Must every test-case undo their operation at the end?

Hi, The question may be a little vague but here's an example of what I want to know (pseudocode): //start test-case for CreateObject function { // initialization of parameters MyObject *obj = CreateObject(); // test results } //end test-case for CreateObject function Is it necessary in this case to also deallocate the memory by calli...

unit testing datastores in PHP

I'm using PHPUnit but find it difficult to make it create good mocks and stubs for objects used as datastore. Example: class urlDisplayer { private $storage; public function __construct(IUrlStorage $storage) { $this->storage = $storage; } public function displayUrl($name) {} public function displayLatestUrls($count) {} ...

How to go about organizing a unit test harness for legacy Visual C++ code?

I have a Visual Studio 2005 C++ project, it is a console application. I want to start getting bits of the code under a test harness but I've run into some issues that I don't know how to best handle. I don't want most of my testing code to end up in the normal .exe in production so I thought would be best to create a separate project f...

how do i get rid of duplicate clojure test-is unit tests on the REPL

I have a little script (use :reload-all 'com.example.package1 'com.example.package2 'com.example.package3 'com.example.testlib) (run-tests 'com.example.package1 'com.example.package2 'com.example.package3) that I use to quickly reload everything and fire off the unit tests. trouble is that each time (deftest ... ) is evalua...

Mocking VB.NET Methods With Moq

I am trying to unit test a controller action that uses the membership provider to update user details. I am using Moq which so far has been easy to use. The problem is I can't seem to get it to mock calls to methods that don't return anything. <TestMethod()> _ Public Sub Can_Update_User() ' Arrange _membershipService.Setup(Functio...

Web Service Unit Testing

This is an interesting question I am sure a lot of people will benefit from knowing. a typical web service will return a serialized complex data type for example: <orgUnits> <orgUnit> <name>friendly name</orgUnit> </orgUnit> <orgUnit> <name>friendly name</orgUnit> </orgUnit> </orgUnits> The VS2008 unit testing seems to...

Unit testing : nice to have feature question

I am testing a web service using VS2008 built in Unit testing , which btw isn't 1/2 bad. the webservice returns a complex datatype... What I would like to do now... is add code to serialize the return object, then display it as xml using internet explorer or ff (both of which show nicely formatted XML). What I really want to know is.....