Spock Stepwise

In some situations it would be useful to run certain tests only if some other more basic tests succeed. Not because they depend on data the basic tests produce (which would be a bad practice) but because they use functionality which is tested by the basic test. TestNG for example supports this with it’s dependsOnMethods … Continue reading Spock Stepwise

Advertisements

How to give dynamic file name in the appender in log4j.xml

In log4j.xml define variable as ${variable}: Then make sure you set the system property when you start your JVM such as: java -Dlogfilename=my_filename example.Application That will create a dynamic log file name: my_filename.log Alternatively, you can set the system property in code so long as you do it before you create a logger (this is useful … Continue reading How to give dynamic file name in the appender in log4j.xml

Changing HTTP headers for a Selenium WebDriver request

There are two ways to tackle this : Using a Firefox browser extension that would modify the headers for you Using a reverse proxy, like the Browser Mob Proxy The BMP is complicated especially if you are behind a corporate proxy. So modify headers extension is the approach we can use. Loading the extension Just … Continue reading Changing HTTP headers for a Selenium WebDriver request

Gradle – How to Display Test Results in the Console in Real Time

Problem Statement: Most of the times we would like to see test results ( system.out/err, log messages from components being tested ) as they run in the same console I run: And not wait until tests are done to look at the test reports. Solution :  OR We can use Gradle Test Logger Plugin to … Continue reading Gradle – How to Display Test Results in the Console in Real Time

Using ‘chmod’ on an NTFS (or FAT32) partition

For NTFS partitions, use the permissions option in fstab. First unmount the ntfs partition. Identify your partition UUID with blkid sudo blkid Then edit /etc/fstab # Graphical gksu gedit /etc/fstab # Command line sudo -e /etc/fstab And add or edit a line for the ntfs partition # change the "UUID" to your partition UUID UUID=12102C02102CEB83 /media/windows ntfs-3g auto,users,permissions 0 … Continue reading Using ‘chmod’ on an NTFS (or FAT32) partition