Posts

Showing posts from July, 2020

Tools for testers - Series 1

When it comes to the Android native app, testing on the real device is a pain. After all who likes to hold the device and strained their eyes and fingers for a longer duration. The solution is to use screencast. I have found a lot many testers use Vysor . It's a good tool, but nowadays it has become annoying due to a lot of advertisement that breaks up the session. I prefer to use  https://github.com/Genymobile/scrcpy Check it out and let me know how do you find this tool.

Apply Java 8 features in Test Automation - Scenario 2

As we know Selenium-webdriver is a UI automation library that supports a lot of browsers. In automation framework, we have to provide a capability where based on the input, aa specific browser should be launched. So if you see the problem statement, it gives an idea to apply Factory Design Pattern. So let's try to implement and understand it via code. Here we will be using Java 8 - Supplier Let's create a class DriverFactory public class DriverFactory { private static final Supplier < WebDriver > chromeSupplier = () -> { WebDriverManager . chromedriver () .setup () ; return new ChromeDriver () ; } ; private static final Supplier < WebDriver > firefoxSupplier = () -> { WebDriverManager . firefoxdriver () .setup () ; return new FirefoxDriver () ; } ; private static final Map < String , Supplier < WebDriver >> MAP = new HashMap <>() ; static { MAP .put ( "chrome...

Apply Java 8 features in Test Automation - Scenario 1

Jaba 8 has a lot of new features. In this blog series, we will see how to apply these features in Test Automation both UI and service. Instead of theory, I will show the feature in the form of a Challenge or a problem statement. Challenge:- How to get the list of the links which are not empty from google.com. Also, print the names of the link in uppercase and count of these links? WebDriverManager.chromedriver().setup(); WebDriver driver = ChromeDriver(); driver.get("http://www.google.com"); Thread.sleep(5000); // I know bad practice :) List<WebElement> lists=driver.findElements(By.tagName("a")); int count= (int) lists.stream() .filter(e -> !e.getText().isEmpty()) .map(e-> e.getText().toUpperCase()) .peek(a -> System.out.println(a)) .count(); System.out.println("count of links "+ count); driver.quit();

Automation is fun !!!

Image
The other day, I was thinking, does learning new technology really has to be hard with no fun. I have seen lot of people who wants to add automation skill set sometimes gives up , may be they just need more time or some way to make learning a fun. So how about, we pick a game and automate it. I stumbled upon a game fastest 1 to 50. The objective of the game  is to click from 1 to 50 as fast as possible. https://zzzscore.com/1to50/ Tools Used : Selenium (Java) Approach:-  In layman language, UI automation is all about identify the target element , perform an action and validate it. So, the first step is to find the element "1" , since thats what we need to click first, Lets also look at the DOM for element "2" and "3" too to figure out if we can identify a pattern out of it <div style="opacity: 1;"><span class="box" style="z-index:99"></span>1</div> <div style="opacity: 1;"><span class...