unit-testing

Why does my Perl unit test fail in EPIC but work in the debugger?

Has anyone ever experienced a unit test that fails and when they tried to debug it to find out where the failure was occurring, the unit test succeeds when running the code in the debugger? I'm using Eclipse 3.5.1 with EPIC 0.6.35 and ActiveState ActivePerl 5.10.0. I wrote module A and module B both with multiple routines. A routine...

AppConfig in a VS 2008 test project?

I've just added my first test project to a VS 2008 solution. I have a component I'd like to use in a unit test; the component calls System.Configuration.ConfigurationSettings.GetConfig() to get a setting, and I'd like for that call to work in my test. Any ideas how I can do this? I don't see any app.config in the project, so I'm not s...

Where should you unit test your validation?

Hi This is bothering me for some time now. I put all my validation in a service layer. However when I unit test I usually pass everything through action method. Then that goes into my service layer what contains the validation. So I am not sure now if that is the best way to do it. Since usually they say you should just test that metho...

Method is called from my TestMethod only when running in debug mode

Hi, I'm writing Unit test cases in Visual Studio 2008. I'm facing a weird problem. From my TestMethod I'm calling a library method. This method is being called when I debug the TestMethod, but when I run the TestMethod this method is not being called. I checked the references of the dll's, they are perfecly intact. Please help me to ...

How to test that observer of org.jboss.seam.postInitialization works correctly

Hi I've created SEAM component which checks that at least one user with global admin rights exists and creates one if no. @Name("installer") @Stateless public class InstallerBean implements Installer, Serializable{ @Observer("org.jboss.seam.postInitialization") public void install() { ... } public boolean isInstalled...

Is it possible to Assert a method has been called in VS2005 Unit Testing?

I'm writing some unit tests and I need to be able to Assert whether a method has been called based upon the setup data. E.g. String testValue = "1234"; MyClass target = new MyClass(); target.Value = testValue; target.RunConversion(); // required Assertion Assert.MethodCalled(MyClass.RunSpecificConversion); Then there would be...

XCode missing inline test results

Everywhere there are pretty pictures of failing tests shown inline in the code editor, like in Peepcodes Objective-C for Rubyist screencast and in apples own technical documentation: When I build my test-target, all I get is a little red icon down in the right corner, stating something went wrong. When clicking on it, I get the Build...

Easymock partially mocking (EasyMock ClassExtension), good or bad?

I have written quite a few Mock objects using EasyMock. However, often i find writing partial mocks time consuming, and it does not feel 'right'. I'd say its a design fault as my class I try to mock has multiple concerns into one, therefore I should create seperate classes in order to seperate concerns. What do you think? Is partially ...

What is the preferred unit testing tool for C development in Visual Studio?

What is the preferred unit testing tool for C development in Visual Studio? ...

Use of Mocks in Tests

I just started using mock objects (using Java's mockito) in my tests recently. Needless to say, they simplified the set-up part of the tests, and along with Dependency Injection, I would argue it made the code even more robust. However, I have found myself tripping in testing against implementation rather than specification. I ended u...

How to not pass around the container when using IoC in Winforms

I'm new to the world of IoC and having a problem with implementing it in a Winforms application. I have an extremely basic application Winform application that uses MVC, it is one controller that does all the work and a working dialog (obviously with a controller). So I load all my classes in to my IoC container in program.cs and crea...

How to test method call order with Moq

At the moment I have: [Test] public void DrawDrawsAllScreensInTheReverseOrderOfTheStack() { // Arrange. var screenMockOne = new Mock<IScreen>(); var screenMockTwo = new Mock<IScreen>(); var screens = new List<IScreen>(); screens.Add(screenMockOne.Object); screens.Add(screenMockTwo....

Unit testing function XPath query results?

I'm having a little bit of a dilemma. I have a very basic class with functions returning specific XPath query results. Here is the code I'm currently using. [TestFixture] public class MarketAtAGlance_Test { private XmlDocument document; private MarketAtAGlance marketAtAGlance; [SetUp] public void setUp() { thi...

unit testing file parsing routines?

Hello, I am struggling a bit with how I can unit test parsing a file... Let's say I have a file with 25 columns that could be anywhere from 20-1000 records long... How do I write a unit test against that? The function takes the file as a string as parameter and returns a DataTable with the file contents... The best I can come up with i...

Database Unit Test in Visual Studio Compare Vars/Columns?

I have a Visual Studio 2008 GDR Database Unit Test (Data Dude) with some TSQL that calls a sproc. I then have a single select statement that produces a 1-row result set with 2 columns. I want to pass the test if the values are equal and fail if it is not equal. I do not understand how to config/code this, can anyone point me in the right...

System.OutOfMemory Exception in VS2008 when loading TestResults

Hi. I'm experiencing some problems when loading a TestResults list (.trx) from the nightly builds on the buildserver. I get a System.OutOfMemory exception very often. I just checked the memory and the devenv process loading the .trx file threw the exception at roughly 700 MB. The .trx file has a size of 167 MB. Furthermore I can load...

Migrating from SUnit to Phexample

Hi, I'm trying out Pharo's Phexample and I like it, but it feels clumsy to have half my unit tests in SUnit and the other half in Phexample. Does Phexample have like an import feature for my existing tests? ...

How to do unit testing in Visual Studio 2005?

Hi, Is there any support for unit testing in Visual Studio 2005? After googling for some time, I found out that we can do unit testing with Visual Studio Team System, but I do not have it. I cannot install NUnit also because of some stupid rules of my organization. Does anyone knows how to do unit testing in Visual Studio? Many Thank...

JUnit java.lang.OutOfMemoryError when running all tests in a package

When loading all unit tests in a package, the make task throws a java.lang.OutOfMemoryError: Java heap space error. If I run all the tests in each subpackage, though, all tests load and complete just fine. It is only when I try to run all tests in the parent package that the OOM error occurs. I don't think this problem should be solved...

What approach should I use to test a VBScript?

I've been asked to help out with a project which has made extensive use of VBScript to process a whole bunch of text files and generate certain outputs - sanitized files, SQL entries etc.. The script is going to be scheduled to run as a Scheduled Task with operation based on the parameters passed to the script. There's no user interfac...