100 Tips about Java and Testing tools

This post is a list of 100 tips about Java and Testing tools. The tips are composed of the following tools and will be posted in this order:

  • JUnit
  • Selenium WebDriver
  • WireMock
  • TestNG
  • RestAssured

Every day I will post on my Twitter and LinkedIn account one tip for you.
This page is updated weekly.

#ToolTip
1JUnit 5With JUnit5 you can parameterize your tests using a ValueSource
https://junit.org/junit5/docs/current/user-guide/#writing-tests-parameterized-tests
2Selenium WebSelenium WebDriver has a Grid-based on Docker images where you can distribute and/or parallelize your web tests
https://github.com/SeleniumHQ/docker-selenium
3WireMockYou can run WireMock in different modes: standalone, JUnit 4.x Rule, or through the WireMockServer class
http://wiremock.org/docs/getting-started
4TestNGTestNG has an extensively Command Line Parameters to run your tests
https://testng.org/doc/documentation-main.html#running-testng
5RestAssuredWith RestAssured you can configure it to return BigDecimal instead of float or double
https://github.com/rest-assured/rest-assured/wiki/Usage#returning-floats-and-doubles-as-bigdecimal
6JUnitYou can use Composed Annotation to add more than one action for your tests, like the @Test and a filter using JUnit5
https://junit.org/junit5/docs/current/user-guide/#writing-tests-meta-annotations
7Selenium WebDriverSelenium WebDriver needs a binary for the browser you will use
https://www.selenium.dev/documentation/en/webdriver/driver_requirements
8WireMockYou can easily create a Mock Server with a few lines of code using WireMock
http://wiremock.org/docs/java-usage
9TestNGYou can create Test Groups to easily filter your test by any category with TestNG
https://testng.org/doc/documentation-main.html#test-groups
10RestAssuredWith RestAssured you can choose between #Jackson, #Jackson2, GSON or Johnzon to use the automatic serialization/deserialization
https://github.com/rest-assured/rest-assured/wiki/Usage#object-mapping
11JUnitWith JUnit5 you can use @DisplayName to add a custom name during the test execution instead of seeing the test method name.
https://junit.org/junit5/docs/current/user-guide/#writing-tests-display-names
12Selenium WebDriverYou can locate one or more elements using different locators in Selenium WebDriver
https://www.selenium.dev/documentation/en/getting_started_with_webdriver/locating_elements
13WireMockWith WireMock you can apply different configurations like network and port bindings, HTTP, proxy, file location, gzip, cors, etc…
http://wiremock.org/docs/configuration
14TestNGYou can inject data into your tests using the @Parameter annotation in TestNG
https://testng.org/doc/documentation-main.html#parameters
15RestAssuredWith RestAssured you can validate your JSON Schema.
In this link, you can find an example and the additional library to use
https://github.com/rest-assured/rest-assured/wiki/Usage#json-schema-validation
16JUnitWith JUnit5 you can use Java 8 lambdas inside the assertions
https://junit.org/junit5/docs/current/user-guide/#writing-tests-display-names
17Selenium WebDriverYou can perform actions like click, type, and drag-and-drop in Selenium WebDriver
https://www.selenium.dev/documentation/en/getting_started_with_webdriver/performing_actions_on_the_aut
18WireMockYou can run WireMock standalone creating service virtualization for your necessity using the jar file or writing Java code
http://wiremock.org/docs/running-standalone
19TestNGWith TestNG, you can add dependency between tests
https://testng.org/doc/documentation-main.html#dependent-methods
20RestAssuredWith RestAssured you can extract values from the JSON response using the JSON Path
https://github.com/rest-assured/rest-assured/wiki/Usage#json-using-jsonpath
21JUnitYou can use Assumptions on #JUnit5 to assume you are in the expected state/place, like on the dev environment
https://junit.org/junit5/docs/current/user-guide/#writing-tests-assumptions
22Selenium WebDriverYou can manipulate the browser doing actions like navigation, back, forward, refresh and manage different windows in Selenium WebDriver
https://www.selenium.dev/documentation/en/webdriver/browser_manipulation
23WireMockYou can create a Stub using WireMock, adding priority, sending response headers, and specifying the response body to it
http://wiremock.org/docs/stubbing
24TestNGYou can create tests dynamically using the @Factory annotation in TestNG
https://testng.org/doc/documentation-main.html#factories
25RestAssuredWith RestAssured you can extract values from the XML response using the XML Path
https://github.com/rest-assured/rest-assured/wiki/Usage#xml-using-xmlpath

Would like to follow me and see the tips daily? Just click on the social media below.


Would you like to have 5 specific examples?

You can download my eBook 5 Tools Java Developers Can Use To Deliver High-Quality Software.