testng

Construct unique safe filenames in TestNG

In order to save files for investigating failures from within TestNG it’s important to have a safe filename that is unique to the test – otherwise you may overwrite important files. I have written the following simple method in Java that is called from a listener with an ITestResult parameter to construct a unique file name that should be safe on most file systems.

Read More »Construct unique safe filenames in TestNG

Using soft assertions in TestNG

One of the big differences between Selenium IDE and a Selenium RC solution is the ability to perform ‘soft’ assertions. Selenium IDE users can append commands with verify or assert to determine whether the test execution should stop when a failure is observed. A popular use for this is to first assert that you are on the correct page (assertTitle) and then verify elements on the page. If you were only able to assert then your tests may fail early on, not revealing further failures that may exist.

Read More »Using soft assertions in TestNG