In HeidiSQL MySQL client you can save queries that you use often. All you need to use a query again and again is save it as a snippet.
Category: Development
Verbose TestNG report with Maven Surefire
Using TestNG console output can be very inconvenient if you have lots of test cases. The better solution is to create an HTML report containing detailed information about testing progress. You can use the Maven Surefire plugin for this. Surefire report is a part of the project maven website, so at first we need to find out what is it. Continue reading “Verbose TestNG report with Maven Surefire”
Dealing with forms in Selenium Webdriver
Dealing with forms
As you know from this post using a separate class for each web page element is a good practice. Working with forms I recommend you to follow this practice too. Let’s take a look how can you interact with web forms with Selenium Webdriver.
Creating a simple webpage test with Selenium Webdriver
In the previous post I have written about how to get started writing tests in Java with Selenium Webdriver. In this post I’ll guide you how to write a simple test using the project structure created in the previous post. As an example, I’ll use this website (fullstackvlad.com).
Step 1. Clearly define what you want to check on the webpage
A correct question is a half of the answer. To write an accurate test you should first define a criteria of correct work (it’s also a great way to know your system better!). In this example, I’m going to check if fullstackvlad.com main webpage contains the search input (marked by the red rectangle in the picture below).
Continue reading “Creating a simple webpage test with Selenium Webdriver”
Selenium + Java: How to start
Why Selenium Webdriver + Java is a great combination for web service integration testing?
Note: This note is about using Selenium Webdriver with Java. You can also read about using Selenium with Nightwatch JS in this post.
Selenium Webdriver is an amazing tool allowing you to interact with browsers installed in your system. It allows you to create test scenarios like “open this page – check element is visible – click on this button – check something happened”. This testing approach is called behavior-driven development (BDD). In other words – you make a program which will do the same work you do while performing tests during the development process.
Selenium itself is a tool to control a browser. To write testing scenarios you should use a programming language like JS or Java. Full list of supported languages can be found on this page.
Why Java? Java is a very popular programming language having a great library of modules which allow you to interact with databases, SSH servers, etc. Due to this you will create extremely powerful testing scenarios.
Patching with Git
About patching
Generally a patch – is a file containing source code differences. In a patch you can specify which line in which file should be added, updated or deleted. The structure of such file is standardized – that means if you create a patch file in Windows you can easily implement it on Linux.
Let’s imagine you have a project you work on. You have a production server and a development workstation. Before starting your work you copied the production source code to the workstation and initiated a Git repo there. After you finish updating you need to apply updates on the production server.
How can you do that? The easiest way is to create a patch.
Power of Composer packages
About Composer Packages
Composer packages makes maintaining your code easier. For example, you have a small library which is used in a few projects at the same time. You want to add a new feature or fix a bug.
You can go through all projects which are using the library and update them. But what if new update needs to add new dependencies? You should add them manually too. It will take too much time and chance to break something is very high.
Another way is to package the library in a Composer package and make it accessible somewhere across the Internet (you actually don’t need make it public). In this case you update the code, add required dependencies in config and release a new version. After that, you just go through projects and run a single command in their root directory:
composer update
This is much easier than the previous scenario.
Composer Basics
About Composer
Composer is a tool to manage dependencies in your project. With it you can search, install and remove external packages in your code just in few commands. It tracks information about updates and dependencies using centralized repositories (the largest is packagist.org).
PSR PHP naming standard
About PSR
PHP developers created many professional tools to make coding easier. One of them is PSR standard. This standard contains recommendations how to organize classes, interfaces and traits naming in your code.
PHP closures
About PHP closures
Generally PHP closures are constructions of an anonymous function (a function without a name) stored in variable. For example:
$records=someFunctionToGetAllRecords(); $getRecord = function($recNum)use($records){ return $records[$recNum]; } var_dump($getRecord(10)) //Will return a specified record from records array