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.

Stop PowerShell beep in Windows 10

The beep in PowerShell is pretty annoying. It can be turned off with a simple set of commands.

Steps:

  • Open PowerShell with Admin permissions
  • Enter the following into the console and press enter:
    Get-Service Beep | Stop-Service -PassThru | Set-Service -StartupType Disabled

Read out browser console logs in java with selenium 2.53.1

Sometimes the usual test log and screenshot is not enough to find the reason of the failed test case. Especially when the test case occasionally fails in special circumstances and it is really hard to reproduce. For this reason, we need to collect for each fail as much information as possible. One possible source of information is the console output of the browser.

Behat Mink default commands in Gherkin

The Gherkin language provide us with lot of ambiguous commands that help us write steps faster and code less.
Beside the default steps you can always add your own steps and write background code for additional re-usability and handling. More about this on later blog following the Behat BDD development.

To list out the default commands use command “bin/behat -dl” and you should get result like:

Behat test examples – BDD and PHP

Continuing on my previous post about setting up a Behat test environment on Windows 10 now we will create some tests to see how the setup is working. These are some basic tests, as we are learning together.For running test we need to create a “behat.yml” file which Behat use as configuration file by default. more about it on this link: http://docs.behat.org/en/v3.0/user_guide/configuration.html#behat-yml

You can also find some example files on the web.
My experimenting config file contains values sufficient for some first basic tests:

default:
  extensions:
    Behat\MinkExtension:
      base_url: 'http://wedoqa.com/'
      browser_name: chrome
      goutte: ~
      selenium2: ~
paths:
    features: features
    bootstrap: %behat.paths.features%/Context

This configuration will:
– use http://wedoqa.com/ as base page to load on start,
– run tests in chrome (if browser is required),
– use goutte and selenium2 basic configurations,
– setup paths for Features and FratureContext.

Third-party program doesn’t allow hibernate session to close

We had an issue with hibernate connections failed to close. We used separated connections for each Dao and all of them stayed open even we called session.close() in after method for each used Dao and checked that they were really executed. The connections have died 2h after the test run, for each test we left open 5-10 connection and because the connection limit to the DB was really small (100 connection) we were unable to run tests as often as we wished.
Useful information about connection kill can be found here.

How to install Behat on Windows 10

If you have decided to test with Behat and work on Windows OS, you will require some workaround as the official documentation is providing instructions for Unix/Mac installation only.

Maybe these instructions will be helpful to you.

INSTALL PHP WITH XAMPP

(or WAMP respectively – here i will use XAMP)

  1. Download the XAMPP from the official site ttps://www.apachefriends.org/download.html
  2. Choose version – for this purpose, I have chosen version 5.6.23 / PHP 5.6.23
  3. Install XAMPP
    * Select all defaults, the default install path “C:\xampp”, you can choose differently but here I leave that as is.
  4. Setup the PHP by your requirements i will leave that up to you.

INSTALL COMPOSER

Quick intro: Composer is a dependency manager for PHP inspired by the Node.js for Javascript. For more to read about you have documentation on the official site Get Composer Link. If you have time I highly recommend to you dear reader to look into its documentation for more information.

Link for the Windows installer of composer is https://getcomposer.org/Composer-Setup.exe.
The installer will assum that you PHP is located in “C:\xampp\php” automatically. If you have changed that path, adjust it during the Composer installation as well.