unit-testing

Pointers on how to to get a test jar to run a separate war for testing (perhaps with cargo?)

Hello, Let me explain some of my constraints. We have a war that has a CXF Soap service and a Spring MVC REST Service. Both the CXF and Spring MVC implementations are in a separate jar and are brought in as dependencies. The REST service has its unit tests in its project. I was wondering if there was any way to, while doing something ...

XCode 3.2.3 STILL does not mark unit test assert failures in the editor

I asked this question before and now the problem seems to have returned with XCode 3.2.3. When I run unit tests and I get an assertion failure I don't seem to get the little message bubbles in the left gutter like I used to. I can hit Cmd+plus to highlight the errant assert and get a partial status at the bottom of the window but I don't...

Clojure test coverage tool?

Hello fine StackOverFlow'ers, I'm looking for a test coverage tool for my clojure project. Currently it's a pure clojure project. ...

unit testing package naming convention

Is there even a standard convention for this? I see a lot of different and perhaps misguided package naming that is very mixed in some projects and thus is never consistent: Let's say I want to write unit tests for something that falls under the 'stuff' package. com.company.product.amodule.submodule.stuff The unit test could be one ...

Java: Unit testing image manipulations

I have a method that deals with an image. The method takes one image, performs some manipulations over it and returns another image: public BufferedImage manipulateImage (Image image) { ... } I'm not sure if there are any best practices of writing unit tests for such activities. What characteristics of the image should be checked ...

Mock a web service used in an action filter

I have an external-to-my-solution web service that I'm using in an ActionFilter. The action filter grabs some basic data for my MasterPage. I've gone back and forth between using an action filter and extending the base controller class, and decided the action filter was the best approach. Then I started unit testing (Yeah, yeah TDD. ...

Why isn't the Rhino Mock expectation met?

Here is code: public interface IAccessPoint { int BackHaulMaximum { get; set; } bool BackHaulMaximumReached(); void EmailNetworkProvider(); } public class AccessPoint : IAccessPoint { private IMailProvider Mailer { get; set; } public AccessPoint(IMailProvider provider) { this.Mailer = provider ?? new D...

Problem doing logic tests after XCode 3.2.4 upgrade

The recent upgrade to XCode 3.2.4 and iOS SDK 4.1 lead to that my unit tests are not working any longer with my iOS project. The project is currently only running on the simulator, not real hardware. I tried to make a new blank project with a dummy test case added that will always pass, but it does not work either, giving me this result...

Testing a Class with a Static Class/method dependency

So I have a class that looks like this: public class MyClassToTest() { MyStaticClass.DoSomethingThatIsBadForUnitTesting(); } and a static class that looks like this: public static class MyStaticClass() { public static void DoSomethingThatIsBadForUnitTesting() { // Hit a database // call services //...

Should I test a model class which sync often to the server?

And how do I do it, since obviously there are a lot of async methods, and no way (that I know of) to check them in a unit test. For example: - (void) testSomeTest { // things [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(helperTestSomeTest:) name:connectionFinished object:nil]; // connect to server } - (void)...

How to test Models in Django with Foriegn Keys

I want to make sure I am testing Models/Objects in isolation and not as one huge system. If I have an Order object and it has Foreign Keys to Customers, Payments, OrderItems, etc. and I want to test Order functionality, I need to create fixtures for all of that related data, or create it in code. I think what I really need to be doing i...

Which Perl test module should I use?

There's Test::Simple, Test::More, Test::Builder (all part of the Test::Simple distribution), Test::Class, Test::Unit, Test::Moose... I'm starting a new project using Moose—which module should I use for writing my tests? ...

ScalaTest: check for contents of a sequence with ShouldMatcher

In my unit test, I want to express that a computed (result) sequence yielded a predefined sequence of result values. But without assuming anything about the actual implementation type of the sequence container. And I want to spell out my intent rather clear and self-explanatory. If I try to use the "ShouldMatchers" of ScalaTest and writ...

Is it a right case for Mockito spy?

Let's say I have a class class SomeClass { public void methodA() {} public void methodB() {} public void someMethod() { methodA(); methodB(); } } I would like to test behavior of someMethod() with Mockito. The only way I could think of is using spy(); Something like SomeClass someClass = spy(new SomeClas...

C# project with unit tests

I'm writing Master's thesis. I nead some open source projects (written in C#) with unit tests (NUnit or MSTest) for my experiments. Anyone knows, where can I download these projects? ...

How to test a NUnit helper?

I'm build a library inspired by RSpec on top of NUnit 2.5+ in order to improve my tests readability. The source code is available at http://github.com/educobuci/SpecUnit. This library allows me to write tests like this: [Test] public void It_should_returns_0_for_all_gutter_game() { var game = new Bowling(); for (int i = 0; i < ...

How to run test methods in spec order in JUnit4?

I want to execute test methods which are annotated by @Test in spec order. For example: public class MyTest{ @Test public void test1(){} @Test public void test2(){} } I want to ensure to run test1() before test2() each time I run MyTest, but I couldn't find annotation like @Test(order=xx). I think it's quite important featur...

unit testing DAOs

Let's say I'm doing unit testing methods for a UserDAO. I'm writing the test for the UserDao's deletion method. I would first insert a user into the db, then call the deletion method, and verify if the object still exists. My question is: for the deletion unit test, when I'm inserting a user to test, should I be calling the UserDao's in...

Testing code in GAC deployed assemblies

Quite often I have unit tests using MSTest for code that is in a GAC deploy assembly. Typically on my development machine I also have a version of code deployed to the GAC. This results in an issue when making changes in the code under test because the unit tests keep running against the GAC deployed assembly. So, to actually test the ...

Unit Testing broken in iOS 4.1 SDK?

After upgrading to the 4.1 iOS SDK my unit test bundles always return with the following two errors and one warning: An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance An internal error occurred when handling command output: -[XCBui...