Blog All Machine Learning Business Analysis Consultancy Artificial Intelligence DevOps Solutions Architect Delivery Manager Rozwój w PGS Data science Cloud Software Development Quality Assurance Design News Events Java Java 8 JUnit testing tests unit testing JUnit 5 – a New Java Unit Testing Method Testing your application should be a development step just as important as programming. Of course, testing everything manually would be very time-consuming and tiring. When you think of “unit testing”, I bet you think of JUnit. The new, fifth version of this framework caught my attention some time ago and so I decided to share a few facts and code samples. .NET mocking tips & tricks unit testing Mocking Linq to Sql DataContext In one of our projects, we are using Linq to Sql to work with database. It is really nice to use, because it allows you to query a database using Linq. Everything is fine, until you want to unit test your code... How to mock DataContext? Not so easy. DataContext… .NET mocking unit testing Mocking out method parameters in Moq Recently I had a situation, when I was writing an unit test and I need to mock a method with an 'out' parameter. I had an import functionality where the import service was using a parser for processing input data before doing actual import. I wanted to test whether the… .NET unit testing Pex – first impressions Pex is a Microsoft Research Project for Automated White box Testing for .NET. It finds input-output values of your methods which can be used in unit testing to provide high code coverage. I heard about it some time ago and I finally decided to give it a try. Installation There… .NET unit testing New features in NUnit 2.5. Part 2 – testing exceptions In part 1 I have presented how to use parameterized test methods in NUnit 2.5. In this post I want to show a new way of testing exceptions by NUnit. Previously, we could use ExpectedException attribute. It looked like the one below. [Test] [ExpectedException(typeof(ArgumentNullException))] public void ExceptionTest() { ... someObject.MethodThatThrowsException(null);… .NET mocking unit testing Mocking with Moq There are many mocking frameworks in the .NET world. Probably, the best known is Rhino Mocks. I used it and I found it a little tricky. I had to browse its documentation many times to find out how to do something. Recently, through some technical reading, I have found another… .NET unit testing New features in NUnit 2.5. Part 1 – parameterized tests At the beginning of May 2009, NUnit 2.5 was released. It was a big release and brought a lot of new functionalities. The main changes were the following (full changelist): added support for parameterized tests, added support for theories, changed way of testing expected exceptions - Assert.Throws instead of ExpectedExceptionAttribute,… .NET unit testing Mocking DateTime.Now We often use DateTime.Now without thinking, because it is easy and natural. However, this approach has one drawback. It tightly couples the application with the system clock. When it comes to testing, especially unit testing, we are in trouble. How to cope with this? Quite easily. Just enclose DateTime.Now in… Popular posts JUnit 5 – a New Java Unit Testing Method Mocking Linq to Sql DataContext Mocking out method parameters in Moq Pex – first impressions 1