Make your manual testing faster with Vysor

Testing Android devices can be frustrating. Entering long texts, taking screenshots and screen recordings, transferring files from the Android device to PC, losing time just with putting down – picking up the deviceScreen capture from Vysor. All these things can be forgotten if You could use the Android device on your PC.
 
There are many apps available for screen mirroring and Vysor is one of them. Vysor is a Chrome extension developed by ClockworkMod. Because it’s a Chrome extension it is compatible with almost all operating system and devices. Vysor works using ADB (Android Debug Bridge). The Chrome app automatically detects any ADB-enabled device connected to the computer. With a few simple steps the phone or tablet screen will be available on the PC with full control over it. It has a free and a paid version. Free version, with screen mirroring and screenshotting, is probably enough for most of the users. If you want some more functionalities like higher quality mirroring, fullscreen mode, sharing, drag and drop option, paid version is for you.

 

How to set up Vysor?

Cucumber in Web testing (part 4 of 8)

4. TestRunner and Test steps

To run features we need a Java class to start the test run. Here is a simple example:

package cucumberTest;

import org.junit.runner.RunWith;

import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;

@RunWith(Cucumber.class)
@CucumberOptions(
features = "Feature",
dryRun = true
)

public class TestRunner {

}

The TestRunner class needs to be annotated with @RunWith(Cucumber.class) and a body of it can be totally empty. By annotating the class with @CucumberOptions we can specify extra options to our test run. In this case, we used the annotation to specify the location of the feature file and to set the test run to ‘dry’. Running the test in ‘dry’ mode means that cucumber will not execute the test steps, rather it will just check for test steps implementations. For the previously given feature, we got this output on the console.

How to check presence of an element when it disappears in less than 500ms

It can happen that the element you want to check only appears for a fraction of a second. This can produce false failures when the element appears in between the standard 500ms when WebDriver checks the wait condition. What you can do is to set up a FluentWait object with a specific polling time. It works almost the same as other kinds of wait functions in WebDriver.

The code is the following:



	Wait<WebDriver> wait = new FluentWait<WebDriver>(driver)
				.withTimeout(20, java.util.concurrent.TimeUnit.SECONDS)
				.pollingEvery(200, java.util.concurrent.TimeUnit.MILLISECONDS)
				.ignoring(NoSuchElementException.class);
		
		Function<WebDriver, WebElement> function = new Function<WebDriver, WebElement>() {
			
			@Override
			public WebElement apply(WebDriver driver) {
				return driver.findElement(exportSnackbarCss);
			}		
		};
		
		wait.until(function);

Cucumber in Web testing (part 3 of 8)

3. Cucumber features

“Feature” in cucumber is supposed to describe a single feature which is analog with “test group”/”test class” in standard Java world. A feature includes one or more scenarios. A scenario can be represented as a “test case” or a ”test method“ in standard Java world. The code of a cucumber feature need to be placed in a file with “.feature” extension and must be located in a separated folder on the project root.
Creating a new feature file with the previously installed eclipse extension will include a small legend and a simple template for the feature file.

Most important Gherkin keywords are:

Cucumber in Web testing (part 2 of 8)

2. How to install cucumber in Eclipse

To start using cucumber in eclipse we need to install few things:

  1. First of all eclipse and Java Development Kit (JDK) need to be installed on the computer.
  2. Ones eclipse finished with the installation we are able to install “Cucumber Eclipse Plugin” with eclipse built-in plugin installation tool. Step by step instructions can be found here.
  3. Download cucumber libraries. Multiple solution can be found here. We recommend to use Maven to download and manage all dependencies.

Our pom.xml contains the following dependencies:

Cucumber in Web testing (part 1 of 8)

1. What is cucumber

Cucumber is a testing framework which supports behavior-driven development (BDD). BDD is principally an idea about how software development should be managed by both business interests and technical insight. Implementation of BDD starts with describing the test cases with English like sentences following up with the test case implementation. With this we will have implemented test cases plus detailed test documentation also, which can be really handy at enormous number of test cases.

Cucumber testing framework uses Gherkin DSL to define test cases. The language itself is designed to be non-technical and human readable which enables the whole development team to have insight into the test cases including business analysts and managers also.

What is the best site or where to find quality material for learning?

New Year. New Resolution(s). If you haven’t started yet to work on new skills, it is the right period to do it. (it is never late anyway, but sooner is better)
Some holidays are over, some will just arrive. You have already started thinking about “upgrade” yourself to a “bigger”, smarter, more valuable you. Good thinking.

But, the most important question is where to start?

Browsing through the internet you can find a dozen of quality materials. But how can I know where could I learn the most and spend much less time with it?
The question will never have an exact answer because it always depends only on you. You can find quality materials, with the best ratings (actually, those are definitely worth to try), but it will not guarantee that it will fit for you.

So, where to find it?

If you already found earlier some lecturers, presenters, teachers who had shown nice approach to you, by explaining and presenting the materials, follow them. Search for their further work. That will surely spare you from some headache and from spending too much time for searching. Also, if there is one, there will be more. Investigate, listen and watch other ones.
What If I don’t want to spend too much money or I don’t want to spend money at all to those materials?
There are always individuals, who will catch your attention, and just from fun started to share their materials to help anyone who has the will to learn more. You have then three solutions.

Lambda expressions in java 8

One of the key elements of the functional programing is that we can treat functions as objects. In a typical functional language we can have a variable with type of function. The benefits are that we can use functions as:

  • • parameter
  • • return type
  • • variable

The type Function in Java is interface with one abstract method. If we want to be sure that an interface can be used as a function type we can add annotation @FunctionalInterface before the header of the interface. It will throw compilation error if the interface contains more then one abstract method.

If a method has a parameter with function type we can use lambda expression instead of creating an anonymous class. Lambda expression represents an anonymous class in a shorter and readable way. Lambda expression consists from parameter definition, small right arrow “->”, and the body of the method.

Benefits of using default methods in interfaces (JDK8) in web testing with selenium

Programming language Java doesn’t allow multiple inheritances. Java uses interfaces to simulate multiple inheritances without importing its disadvantages. The cost of this is that method implementation was not possible in interfaces until JDK 8.

JDK 8 contains a new feature which allows us to create default implementation for interface methods. Simply just add keyword “default” before the method definition and add implementation body for it. With this, the method will have a default implementation and we don’t need to override them anymore. Basically, we went a step toward multiple inheritances.

As always, there are few disadvantages which came with this feature. We will get a compile error if we have multiple default implementation for the same method. It can be fixed by overriding the method with a new implementation or explicitly call the chosen default method.

Secure use of sendKeys() on pages created with Angular

We recently faced with an Selenium’s sendKeys() method issue which is related to the page which was made in Angular 1.5.8 (Most likely the same issue can be discovered in different versions). In most of the cases, the input field filled by sendKeys() method will contain just part of the desired text. Most often you will find just the first half of you desired text written into the input field. From our experience this bug appears only in the following circumstances:

  1. Page must be made with Angular
  2. The input field must be tagged with angular attributes, like ngModel, ngControl, etc.