Sunday 11 March 2018

Cracking The Puzzle Code - Top Puzzles Asked During Interviews

Puzzles are the big part of the interview process especially for the person who is going to QA, SDET, Developer or programmer positions.

Puzzles are to test out software engineer's analytics and logical thinking ability. It's not a hard and fast rule to ask the puzzles during the interview but now these days most of the startups and top tech companies have started the trend of asking such brain teasers and riddles and during the interviews.

Better be prepared for such scenarios, solving a couple of puzzles before your interview will give a boost to you and your brain and will be helpful in tackling similar questions related to puzzles when asked during your interview.

So let's get started Braining:



Top Tech Puzzles:

Puzzle 1: When is Cheryl's birthday?

Puzzle 2: Winning Tactics For Crossing The Bridge Puzzle






Here is How To Verify The Broken and Loaded Image In The Page

You might have faced scenarios where you had to verify the images loaded completely on the page or loaded broken. Doing it manually could be one way but it may become difficult if you have to actually verify the images is loaded using Automation, but Selenium has the solution for this problem.


Let's see how we can validate broken and loaded images :

So what you can do is use JavaScriptExcecutor interface which has a method executeScript(). You can check if the image is getting displayed or not by calling the executeScript method of the  JavaScriptExcecutor Interface.

public void verifyImageLoaded(String imageSrc){
    WebElement image = driver.findElement(By.xpath("//img[@src='"+imageSrc+"']"));
    Object checkResult = ((JavascriptExecutor) driver).executeScript(
            "return arguments[0].complete && "+
                    "typeof arguments[0].naturalWidth != \"undefined\" && "+
                    "arguments[0].naturalWidth > 0", image);

    boolean loaded = false;
    loaded = (Boolean) checkResult;
    Assert.assertTrue("Image was not rendered properly", loaded);
}

This method validates if the image with the given source has been loaded completely or not. checkResult will be returned as an object so to get the Boolean value you need to typecast checkResult to fetch the boolean value.

To Validate Broken Image: To check if the method works fine with broken images, just try to send the wrong URL for the image source and the method will fail at the Assert statement with the false value for the 'loaded' variable. The broken image looks something like below image :


Try the code and write to me if you face some issue.

Learning Selenium Can Be Addictive. Get Yourself Hooked

Learning test automation is possible for everyone—remember that even the greatest programmers know nothing about coding initially 😊

So, first of all, have faith in you and that is the Key. Having a good plan to learn something, to be successful, one should also be clear about their goals.
So let's understand why Automation is needed in the first place:

You might have observed that the most of the applications are Web-Based Applications, i.e the applications which can be accessed using browsers (Chrome, Firefox, Safari etc.). Applications now these are highly interactive and rapidly changing and getting developed at much pace as compared to earlier times. So some kind of mechanism was needed to test this fast-changing environment and displaying test results at the similar speed so that development process can be carried out.

So Automation was the way to handle such task, such as a repetitive test of a particular module, which could have been a cumbersome job for a manual tester. Imagine a time where you could be testing the same thing over and over again daily just to verify that it is working fine. How about automating such scenarios and execute it in just one click 😉

Yes, Automation will save hell lot of time, energy and mental stress of meeting the deadlines. One can simply schedule their test cases to execute them daily, multiple time in a day or on the need basis.
So how to make learning Selenium Addictive:

Clear Your Mind: First thing that you need to do is to clear your all the negative thoughts about Coding, Thoughts like :
             1. This coding language is very tough.
             2. I have not done any coding, I am just a manual tester
             3. I can't learn Java, there are so many things in JAVA

Thoughts above will first kill your confidence and then your faith in you. Do not let anyone put anything negative in your mind. You should be the one to decide what has to be done and how it should be done.


Pick The Language:  Selenium is nothing but simply calling action methods on the buttons, text fields, links, checkboxes etc. You do not need to be a master of a language to learn Selenium. Simple basic concepts will be good enough for anyone to work with Selenium. And when you will get the groove of it you will be easily able to understand in and out of the Selenium. 




Dirty Your Hands: If you are feeling hungry and then you just picked up a cooking book and start reading it. Will it help you to put down your hunger?. Simply reading article and topics of Selenium won't help you at all. You have to make your hands dirty with the code. Seeing the code and writing one down will make a huge difference in your learning process.

Take A Break: Rome was not built in a day similarly learning is not a one-day process, you have to improve gradually. Break your learning sessions and better you divide your topics according to the difficulty levels.



Learn Every Day: Increase your knowledge daily basis. Spend at least 30-60 mins daily on new topics or revision of the things already learned.