Posts

Showing posts from February, 2018

Essential Gradle Commands

I use some of the gradle commands everyday in my project and many times I had to randomly search in the internet (as I don't remember these commands by heart). This article is for my personal reference, so that I don't have to search it in random places. These commands include running tests, generating binaries, filtering tests, changing property values during runtime, listing available tasks for a project, executing task in a subproject, printing dependencies information etc.. If you have reached this paragraph and your are still interested in reading further down, then happy reading.. :) For developers working on Windows platform, please replace './gradlew' with gradlew.bat in the following commands General gradle tasks List available projects ./gradlew projects List available properties ./gradlew properties List available tasks for root project and sub-project ./gradlew tasks :SomeProject:tasks --all Build a project Clean the buil

JUnit's stopwatch to capture time taken per integration test in csv file

I was looking to improve my integration test suite, which contains large number of integration test (more than 900 test cases). My immediate focus was to tackle the slowest running tests in my test suite. TestNG reports provide the information of slowest running test out of the box, however my project was using JUnit 4. Being a lazy developer, I didn't want to migrate my entire test suite to TestNG in order to get reports about slowest running test. Hence I was looking at other options available in JUnit test framework. JUnit offers a Rule called stopwatch, which notifies us the time taken to complete each test as callback methods. However, most of the examples showed how to print the information on console or some logger. Printing on the console or logger is particularly not very helpful, as it doesn't allow us to analyse the data in an easy way. Hence I had created a custom stopwatch rule which extends JUnit's stopwatch rule and capture the information provided by