unit-testing

Performance testing using FlexUnit

FlexUnit is quite an impressive framework for testing and with the new integration in Flash Builder 4 it's a no brainer to use it. However, I'm not sure why it's necessarily exclusive to just unit testing. In my opinion, I think the tools are great candidates for performance testing as well. It should also be mentioned that by performan...

UNIT Test Fails, throws COMException "There is no MTS object context"

Hi: I have a unit test that contains several test cases. I set them up through the Test Project wizard. It is pretty standard procedure. When I choose to run one of the test, I got the following error Test method et.Exec.ProductionBase.Test.etProcessQCItemExecTest.CreateTest threw exception: System.Runtime.InteropServices.COMException...

NUnit global initialization - bad idea?

We need some global one time setup code in our test suite. We can do it more than once but it takes quite some time. It's required by all fixtures so [TestFixtureSetUp] does not work. It has to run before all [TestFixtureSetUp] code. Put it in Main() since we keep test assemblies as executables. However Main doesn't get executed under...

Using PDO Sqlite in-memory Db for PHPUnit tests

Hello I recently got PHPUnit working with xDebug for testing my Zend Framework applications. The fact I use ZF shouldn't make any difference to this question- just mentioned it for completeness. Anyway, it all works fine, but now I want to set up an in-memory database using PDO SQLite. I have done this successfully and have created tab...

Capture an argument in Mockito

I'm testing a certain class. This class is internally instantiating a "GetMethod" object that gets passed to a "HttpClient" object that gets injected into the tested class. I'm mocking the "HttpClient" class, but I would need to modify the behaviour of one method of the "GetMethod" class too. I'm playing with ArgumentCaptor but I don't ...

Automated Testing For Heavy UI Apps

How do people test heavy UI applications? Specifically, the UI is in a web browser in an SVG or Canvas element. Like, say most of the application is drag/drop and resizable and different things that happen as a result of dragging to a certain place or resizing to a certain size. What are some strategies people use today? ...

ASP.NET MVC - Unit testing RenderPartialViewToString() with Moq framework?

I'm using this helper method to turn my PartialViewResult into string and returning it as Json - http://www.atlanticbt.com/blog/asp-net-mvc-using-ajax-json-and-partialviews/ My problem is that I'm using Moq to mock the controller, and whenever I run unit test that uses this RenderPartialViewToString() method, I got the "Object reference...

What is the purpose of mock objects?

I am new to unit testing, and I continously hear the words 'mock objects' thrown around a lot. In layman's terms, can someone explain what mock objects are, and what they are typically used for when writing unit tests? ...

RSpec Mock Object Example

I am new to mock objects, and I am trying to learn how to use them in RSpec. Can someone please post an example (a hello RSpec Mock object world type example), or a link (or any other reference) on how to use the RSpec mock object api? ...

How to impersonate a non-existent user

We have a 3rd party webservice used to authorise users. Primarily it takes the calling user, checks their identity, and returns a cookie for subsequent requests. I would like to unit test it, making sure it throws the appropriate exception. Ideally something like this: var dummyIdentity = WindowsIdentity.GetAnonymous(); using (dummyId...

Best practices or patterns for writing unit test results/reports to text file as well as to console

Hello Stackfolks, We have our own unit test framework for blackberry application. And now we need to generate unit test report in text file, before we were just printing on console. CommandController.java - Sends commands to blackberry simulator and receive response in string format. It displays which commands has sent to simulator an...

QT Qtestlib, Unit Test

Hi, If I were to create a unit test for class implementation using QTestlib ( trying to figure it out) how would I do it. (I know unit testing for the simple class below can be done other simple way I trying to understand QTestlib framework and whether its really what I want) Consider a simple class ( just to make things really clear )...

Check for my code coverage ratio from my build process

I am using Visual Studio 2008 Code Coverage and I have many classes that are 100% covered by my unit tests. How could I check during my build process that these classes remain 100% covered by my unit tests (also executed during my build process after compilation) ? ...

Unit testing of WCF webservice with Gallio/MbUnit

I have a WCF service with a simple Gallio unit test that calls the service. However, I am confused by the framework's behavior. When I start visual studio for the first time, and try to run the unit test, I get the following error: System.ServiceModel.EndpointNotFoundException: There was no endpoint listening at http://localhost:4367...

How to add test cases to a suite using junit?

Howdy, I have 2 test classes, both extend TestCase. Each class contains a bunch of individual tests which run against my program. How can i execute both classes (and all tests they have) as part of the same suite? I am using jUnit 4.8 Thank you ...

How do I check what version of java im using in c++

I have a testing script that checks what version of java the user is using and then executes some commands. But we are trying to convert all of our testing into cxxtests. I would like to know how to convert my version checking script into c++ code. I know I could just use the system() command but I would like that to be a last resort....

NUnit - assembly that reads and writes file

I am unit testing an assembly that uses File.WriteAllLines() and File.ReadAllText() to read and write persistent data. When I run the unit test with the NUnit Gui the test fails with an unauthorizedAccessException. The path that the file is attempting to read and write is being affected of course by the location of program execution. ...

Is it bad to add code just for unit testing?

I am writing a class to help me unit test my code. It looks like this: /// <summary> /// Wrapper for the LogManager class to allow us to stub the logger /// </summary> public class Logger { private static ILogger _logger = null; /// <summary> /// This should be called to get a valid logger. /// </summary> /// <retu...

Unit Testing, Web Services and Database Transactions

I'm trying to write test cases for my web services in a way that I can rollback any database changes they may make. I can try to surround them with a transaction scope, but how do I specify a context for the transaction? In other words, how does the transaction know which database and server to rollback on? In my case, the SQL server ...

resharper unit test inheritance

Has anyone got a strategy for unit testing heiarchies in Resharper? I typically use both TestDriven.Net and Resharper's test runner, with NUnit tests. TestDriven is awesome for everything but quickly finding a bad test out of a batch run (which could be thousands), which is where Resharper's runner comes in. I typically use a pattern ...