Context: you have a folder containing some files. You need to find all the files whose name contains some expected value in this folder and all its’ sub-folders. Or you need to find all files with a specified extension in the folder. Maybe you need to count how many files with a specified size are… Read More
Checkout my article for TechBeacon on Top 5 Apache Commons utilies for automation engineers: https://techbeacon.com/5-best-apache-commons-utilities-automation-engineers
Identify the OS tests are running on with os.Name or SystemUtils
In order to make your tests OS agnostic, sometimes, you need to create some additional logic to handle OS specifics. For example, if you are running Selenium tests, on a browser, you want the test to run on all OSs, not just one, and start the browser instance corresponding to the OS the tests run… Read More
Extracting substrings with StringUtils from the Apache library
Following on from some of my earlier posts, where I described some of the useful utils from the apache.commons.lang3 library (like that very nice RandomStringUtils class), this time I will focus a bit on the StringUtils class. As the name suggests, it provides developers and testers an easy way to deal with certain String related… Read More
Working with lists: ImmutableList
When you are faced with a task that involves using lists, you might want to consider the following question: are the elements in my list ever going to change, or is it enough to just add my elements to the list once and use them across my tests. Is my list a constant? In case… Read More
Useful: working with files and folders with FileUtils
When it comes to working with files (reading or writing their content, copying) or folders (copying their content, deleting them), the Apache FileUtils library offers a large number of methods for easily performing these tasks. Some of these are depicted below, together with their usage. For the full reference, check out this page: . Importing… Read More
Useful: generating random strings with RandomStringUtils
When writing tests that require the generation of random strings, a very useful class can come in handy, namely RandomStringUtils from the Apache Commons Langs utilities library. It can be used for generating string that contain only letters, only numbers, both, these and other characters.