Dave Hunt

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

Select an option from an ExtJS ComboBox

Automating an ExtJS web application can be difficult due to the dynamic nature of the page. For example, the majority of unique ID attributes in the HTML will be different between builds, which causes problems locating elements reliably. Another issue is selected items from a ComboBox, which is not a normal HTML <select> element, but an <input> that is populated from data in a completely separate section of the DOM.

Read More »Select an option from an ExtJS ComboBox