unit-testing

Is there a usable standards-compliant (168/286) portlet testing framework? (especially one that works with Spring PortletMVC)

I've not seen anything in this area I would recommend to a client. If you've used Spring PortletMVC, how did you test it? It's easy to test under the level of portlet code, and relatively easy to test on the client side through HtmlUnit, Selenium and the like, but I haven't seen anything that is a "Gray Box" test in the spirit of JSFUn...

What constitutes an Integration test

I have my unit tests. Each test method tests a logical UNIT of functionality in my system. In my unit tests external dependencies (db, file etc) are dealt with by using Mocks and Fakes. Now iam not 100% sure how i should approach the integration test. Should i repeat the unit tests and replace then with the actual resources (DB, File...

Why is Eclipse using JUnit 3 when I have junit-4.3.1.jar in my build path?

I'm using Ganymede on Ubuntu Linux and I have junit-4.3.1.jar in my build path. I click File > New > Java > "JUnit 4 Test Case" when I create a new test, but when it's run, Eclipse appears to be using JUnit 3. I believe this is the case because it's ignoring my annotations. When I remove all test* methods, JUnit complains "No tests fo...

Making the shift from writing tests for MVP to MVC

I'm migrating a webforms application written w/ MVP to leverage the MVC framework and wanted to know how I should be testing a simple controller action that returns a partialview. When using MVP i would assert true for each property on the view = the expected value. Controller action under test <OutputCache(Location:=OutputCacheLocati...

How to unit-test sequential logic?

Suppose I have class Car with following methods: LoadGasoline(IFuel gas) InsertKey(IKey key) StartEngine() IDrivingSession Go() the purpose of Car is to configure and return an IDrivingSession which the rest of the application uses to drive the car. How do I unit-test my Car? It looks like it requires a sequence of operations done b...

How to mock the Request on Controller in ASP.Net MVC ?

I have a controller in C# using the ASP.Net MVC framework public class HomeController:Controller{ public ActionResult Index() { if (Request.IsAjaxRequest()) { //do some ajaxy stuff } return View("Index"); } } I got some tips on mocking and was hoping to test the code with the following ...

OCUnit testing NSNotification delivery

For a game I'm developing, I have several model classes that trigger notifications when their state changes. Then, the view subscribes to those notifications and can react on them. I'm doing my unit tests for the model with OCUnit, and want to assert that the expected notifications were posted. For that, I'm doing something like this: ...

Comparing the schema of two databases for integration testing.

We use NHibernate generated schema to run unit tests against a database (integration tests I guess they are). I wondered if it was feasible to compare the generated schema against our development database. This would tell us when we had misspelt column names in our mappings or other issues like that. It would also go a long way toward ke...

What replaces regexp for XML response assertions in SOAP UI?

My team has switched from J-meter to SoapUI for testing purposes.We are testing regular WSDL-based services. We used this nifty feature in J-meter where you could write assertions in the form of regular expressions to check the XML responses. For example if I wanted to make sure there were so many xml tags contained in the response you c...

Has anyone created a DataContract testing tool?

Has anyone seen a library that tests WCF DataContracts? The motivation behind asking this is that I just found a bug in my app that resulted from my not annotating a property with the DataMember attribute - as a result, that property wasn't being serialized. What I have in mind is an API that, given a particular type of DataContract, wi...

JSF unit testing

I'm trying to find a practical unit testing framework for JSF. I know about JSFUnit, but this is very impractical to me. I need to include about 10 JARs to my project, and jump through many other hoops just to get it running. I realize that -- due to the need to simulate a platform and a client -- unit testing web applications is diff...

Unit testing , approval testing and datafiles

(Leaving aside hair-splitting about if this is integration-testing or unit-testing.) I would rather first test at the large scale. If my app writes a VRML file that is the same as the reference one then the VRML exporter works, I don't then have to run unit tests on every single statement in the code. I would also like to use this do s...

Spring Transaction Management Test

I want to test my Dao Class using the SpringContextTests. In my method class I extended the AbstractTransactionalJUnit4SpringContextTests in order for my test class to integrate with JUnit4. I have also set up the configurations and made the initialization and database clean up in the @Before and tearDown in the @After. My test class wor...

Unit testing for shell scripts

Pretty much every product I've worked on over the years has involved some level of shell scripts (or batch files, PowerShell etc. on Windows). Even though we wrote the bulk of the code in Java or C++, there always seemed to be some integration or install tasks that were better done with a shell script. The shell scripts thus become par...

How do I unit test an ASP.NET MVC controller that uses DotNetOpenId?

I have an AccountController whose constructor takes an object derived from my custom IOpenIdAuthentication interface. By default, this is an OpenIdAuthenticationService object that wraps an OpenIdRelyingParty. The interface looks like this: public interface IOpenIdAuthentication { IAuthenticationResponse Response { get; } IAuthe...

Setting messages.properties in a Spring Webflow unit test

I'm using Spring Web Flow 2.0.7, and just started setting up my unit tests. I've got my flows directory, containing the flow xml files and my messages.properties files on my classpath. It's loading fine, but it doesn't seem to be automatically picking up the messages.properties file for the flow, and thus my validation unit tests are...

UnitTesting Static Classes

Scenario. Language C#, Unit testing using VS2008 Unit testing framework I have a static class with a static constructor and 2 methods. I have 4 test methods written to test the entire class. My Static Constructor has some important initializations. Now if I run all the 4 unit test cases in tandem, the static constructor will be called...

How to find the unit tests

I have a bunch of unit tests in my visual studio project and code coverage coloring shows the covered lines of code in blue. Is it possible to jump to the unit test(s) that covers that line of code? ...

programmatically create a spring context

Does anyone know if there any way that I can programmatically create a bean context? I want to be able to do something like: ConfigurableApplicationContext c = new ConfigurableApplicationContext(); BeanDefinition bd = new BeanDefinition(); bd.setId("id"); bd.setClassName("classname"); bd.setProperty("propertyName", propertyValue"); ......

Why do COM events cease to work when we use unit testing with Microsoft Visual Studio 2008?

We have some C# code that uses COM (its calling legacy code). When an event happens, a COM event is fired. Everything works perfectly. However, if we call that same code from within a unit test, then suddenly the COM events cease to be fired - its just silence, like some sort of empty room with no party. Any ideas why? Environment: ...