Tag Archives: Testing

KVO Quick Spec unit tests

Swift Language

If you’re using KVO, how can you test the changes on your classes/structs?

Posted in Swift, Testing, Uncategorized | Also tagged , | Leave a comment

Unit testing async network calls in Swift

Swift Language

Asynchronous unit testing in Swift You have probably written code with a NSURLSessionDataTask that notifies a delegate when the data is received. How do you write a unit test for that? Introduction The Test Summary Resources Introduction Let’s stub out some typical code. Here a an API function that takes perhaps a REST endpoint and […]

Posted in iOS, Swift | Also tagged , | Leave a comment

Spring Test Framework CoC suggestion

Let’s say you’re using JUnit 4 and the Spring Testing classes (the 2.5+ versions) for your unit tests. You can specify parameters as shown in the TransactionConfiguration annotation as shown in this example. But you can also get away with leaving them out in a nod to the uberhip Convention Over Configuration gods as shown […]

Posted in Spring Framework, Testing | Also tagged , | 1 Response

Spring and Transactions

I’ve been taking a legacy codebase, putting testing in place and refactoring. For DB access I retrofitted the persistence classes to be injected via Spring with a DataSource instead of looking them up via JNDI. IN my Spring context I defined a PlatformTransactionManager.

Then I refer to it in the the test case class. […]

Posted in DB, Spring Framework, Testing | Also tagged | Leave a comment