Skip to main content

Posts

Real-time test execution metrics (time-series)

We run most of the automated suites in a remote machine and thus the test results are accessible only at the end of the execution OR else, we need to check the console for the results for the progress. What if we can have a way that gives us the execution results while the tests are actually being executed in the remote machines? Yes, it's possible by using time-series database like InfluxDB, Graphite, etc. that supports insertion and real-time querying of data via a SQL-like query language, so we can use it to collect all the test metrics and then use Grafana or Kibana which is an excellent and powerful visualization tool to form a dashboard. How to install InFluxDB and Grafana on windows: Please go through these well elaborative articles by Antoine Solnichkin: https://devconnected.com/how-to-install-influxdb-on-windows-in-2019/ https://devconnected.com/how-to-install-grafana-on-windows-8-10/ For Sample queries, please go through these links: https://docs.i

Soft Assertions: Where and when we can use it?

To tackle the disadvantage of Hard Assertions where we want to continue the execution even if some assert fails and see the result at the end of the test. Soft Assertions are the type of assertions that do not throw an exception when an assertion fails and continue with the next step after assert statement. This is in the case where our test requires multiple assertions to be executed and we want all of the assertions to be executed first before marking (failing/skipping) the tests. Consider these 2 examples: 1) We're verifying many CSS values of the same element like background-color, font-family, and color in a single test case. element.getAttribute("background-color") element.getCssValue("font-family") element.getCssValue("color") Obviously, if any one of these fails we would like to catch it and mark the test case as fail but that doesn't mean if background-color verification fails it should mark the test case fail with

The Base class in the Selenium framework

Authoring automated tests is quite easy but authoring easily human-readable and maintainable tests is much tougher. Especially, when your project grows in size and complexity. There are many approaches that can help you build your tests in a Selenium framework like correct handling of your Base Class well. The Base class should have these things: - the setup() and teardown() test methods. - the WebDriver object. - load your configuration/properties file here (can be a part of its constructor) - common aspects of all tests like handling sync issues, ScreenshotOnFailure, etc. - have a method to visit the site that returns the Index page object. - and All test classes should inherit it. P.S. My view on this topic is purely subjective. And in many cases, you may not be able to apply this type of approach to your framework.

3 Selenium classes that are not so popular to locate elements

Here we have discussed 3 Selenium classes that are not so popular but that can help you locate elements in Selenium: - ByIdOrName - ByChained - ByAll 1) ByIdOrName - This helps the driver to locate an element either by name or by id. This is present under org.openqa.selenium.support package and to use this we have to call the constructor of the ByIdOrName class and pass the Name or ID. This method tries to find the element using ID first and it waits till the max implicit wait time for the element to locate using ID and if it is not able to find the element with ID then only it tries to locate with the Name. As soon as the driver finds the element with id, it will not check the element with a name attribute and won't want for max implicit wait time either. driver.findElement(new ByIdOrName("username")).click(); 2) ByChained - This helps the driver to locate the element based on the parent element, and it accepts an unlimited number of locators. This is prese

Transitive and Excluded dependency in Maven

Transitive dependency in Maven: Let say you have a library A1 that depends on library A2 and this A2 library further depends on the library A3. So your library A3 is a Transitive Dependency of your library A1. Excluded dependency in Maven: Let say you have a library A1 that depends on library A2, and this A2 library further depends on the library A3. If required,  we can explicitly exclude library A3 for the library A1. We can use the “exclusion” element to exclude it. Such dependencies are called Excluded dependencies in Maven.

TestProject- https://testproject.io/

I admit this when it comes to automation, I'm still old school and prefers using direct APIs/JARs but as TestProject is creating so much buzz recently so I thought of doing Hands-On to it by using their "free forever plan". Apart from being the first free community-powered cloud test automation platform, there are many things that intrigued me: - It collaborates very well with other popular frameworks such as Selenium and Appium. - Oh man, execution speed is really fast. - Addons: It supports lots of awesome addons that help to make our tests very powerful like "jRand" that lets you access random data generators for a variety of test data. - Most of the basic functionalities like scheduled execution using CI/CD pipeline with out-of-the-box integrations to Jenkins and other tools, scripting, etc. can be learned in a week max. For Novice test automation engineers to learn the programming syntax can take up to max 2 weeks. - Always wanted features lik

Installing and Uninstalling Add-ons in Firefox Browser

Almost a month back, we discussed how we can install an extension in Selenium 3: https://www.linkedin.com/posts/dheerajgambhir_seleniumautomation-chromeext-automationtesting-activity-6587948591678095361-Lr7m Or https://testersdigest.blogspot.com/2019/10/need-extension-while-running-your-se.html And now in Selenium 4, we have direct method installExtension and uninstallExtension for the firefox Driver. The installExtension installs a new addon with the current session which inturn will return an ID that may later be used to uninstallExtension the addon using uninstallAddon.