Posts

Showing posts from 2019

JUnit 5 and Selenium - improving project configuration

Selenium is a set of tools and libraries supporting browser automation and it is mainly used for web applications testing. One of the Selenium’s components is a Selenium WebDriver that provides client library, the JSON wire protocol (protocol to communicate with the browser drivers) and browser drivers. One of the main advantages of Selenium WebDriver is that it supported by all major programming languages and it can run on all major operating systems.In this part of the JUnit 5 with Selenium WebDriver - Tutorial you will learn about additional capabilities of JUnit 5 that will help you in decreasing the execution time of your tests by running tests in parallel, configuring the order of your tests and creating parameterized tests.You will also learn how to take advantage of Selenium Jupiter features like tests execution configuration through system properties, single browser session tests to speed up tests execution or screenshots taking in your tests. Finally, you will learn how to …

macOS: Preview source code files in Finder with Quick Look plugins

Image
macOS Finder offers a possibility to preview the files of any type without opening them with Quick Look. By default Quick Looksupports most commonly used file formats which may not be enough if you are a developer and you want to preview source code files i.e. Java or Python or any other un-common file types.Quick Look pluginsQuick Look can be extended with plugins to allow previewing the content of any file format. Plugins can also add additional functionality to Quick Look like for example syntax highlighting.The list of freely available Quick Look plugins for developers can be found here: https://github.com/sindresorhus/quick-look-pluginsThe most useful ones from my point of view:Preview files with no extension with QLStephen:brew cask install qlstephenExample: preview .gitignore:Preview Markdown files in Finder with QLMarkdown:brew cask install qlmarkdownExample: preview README.md:Syntax highlighting for source code files with QLColorCodebrew cask install qlcolorcodeExample: previ…

JUnit 5 and Selenium - Using Selenium built-in `PageFactory` to implement Page Object Pattern

Selenium is a set of tools and libraries supporting browser automation and it is mainly used for web applications testing. One of the Selenium’s components is a Selenium WebDriver that provides client library, the JSON wire protocol (protocol to communicate with the browser drivers) and browser drivers. One of the main advantages of Selenium WebDriver is that it supported by all major programming languages and it can run on all major operating systems.In this part of the JUnit 5 with Selenium WebDriver - Tutorial I will go though the implementation of Page Object pattern with Selenium’s built-in PageFactory support class. PageFactory provides mechanism to initialize any Page Object that declares WebElement or List<WebElement> fields annotated with @FindBy annotation.

Spring Boot testing with JUnit 5

JUnit 5 (JUnit Jupiter) is around for quite some time already and it is equipped with tons of features and as of Spring Boot 2.2 JUnit 5 it the default test library dependency. In this blog post you will find some basic test examples in Spring Boot and JUnit 5 against basic web application.

JUnit 5 and Selenium - Setup the project with Gradle, JUnit 5 and Jupiter Selenium

Selenium is a set of tools and libraries supporting browser automation and it is mainly used for web applications testing. One of the Selenium’s components is a Selenium WebDriver that provides client library, the JSON wire protocol (protocol to communicate with the browser drivers) and browser drivers. One of the main advantages of Selenium WebDriver is that it supported by all major programming languages and it can run on all major operating systems.In this tutorial I will go through the setup of the test automation project for the popular TodoMVC application using Gradle with Java, JUnit 5 and Selenium Jupiter. You will learn about Selenium’s PageFactory to implement Page Object pattern. You will also learn about parallel test execution, test execution order, parameterized tests and much more.

macOS: Annotate - simple yet productive screenshots tool

Image
After switching from Windows to macOS I was looking for a simple screenshots taking tool to support my daily workflow. The built-in tools offered by macOS are not sufficient for me, mainly because of the image annotating tools and limited keyboard shortcuts support. For couple of days I used Skitch, but then I found Annotate, a light-weight and simple app with quite good keyboard shortcuts support. In this short blog post, I share how I currently work with Annotate app.Note: Looking for a powerful screenshots taking tool for Windows? Checkout Greenshot.Why built-in tool are not sufficient?What is my usual screenshots workflow?Take a screenshot, annotate it quickly with tools like arrow, shape and text, copy to clipboard and paste it anywhere (e.g. Slack, JIRA, e-mail or a document editor)Open an image from clipboard, annotate it quickly, copy to clipboard and paste it anywhereWith Annotate this is all possible and it can be done pretty quickly with keyboard shortcuts.Taking screenshot…

Test Execution Order in JUnit 5

The general practices say that automated tests should be able to run independently and with no specific order as well as the result of the test should not depend on the results of previous tests. But there are situations where a specific order of test execution can be justified, especially in integration or end to end tests.By default, in JUnit 5 the execution of test methods is repeatable between builds hence deterministic but the algorithm is intentionally non-obvious (as authors of the library state). Fortunately, execution order can be adjusted to our needs using either built-in method orderers or by creating custom ones.

Temporary directories in JUnit 5 Tests

JUnit 4 TemporaryFolder@Rule allowed developers to create tests utilizing temporary directories. With JUnit 5, the @Rules are not supported hence testing files and directories requireds a little bit of additional work. Fortunately, with JUnit 5.4 there is a new built-in extension to handle temporary directories in tests. And it is extremely easy to use.