What I'm Thinking
Sometimes during testing or scraping a website, we are not interested in loading the images on the page. Disabling images helps up speed up the page load times and make execution faster.
Even if we are interested in knowing the location (source) of images, we can still disable loading of all the images in GUI. In Selenium each browser requires different techniques to do so. We will look at each one of them one by one
... Read More
Selenium change User-Agent of different browsers
28 May 2017
Server uses User-Agent string to differentiate between different browsers and devices. Each device + browser combination can have a different name to identify the Browser and its version. Thougth that may not be 100% true in all cases.
In this article we will see how to change the user-agent of different browser when automating them using Selenium
Changing User-Agent in Internet Explorer Unfortunately there is no good way to change the User-Agent of a IE browser.
... Read More
Debugging is an important aspect of any test environment. It helps developer troubleshoot their code on a deployed environment.
XDebug is one of the popular debuggers for PHP and many PHP IDEs have built-in support for XDebug.
Docker provides official images for php-fpm and nginx. php-fpm process all the PHP code and for client request handling we will use nginx.
In this article we will explore 2 approaches for using XDebug in a php-fpm + Nginx setup.
... Read More
Gitlab is an amazing Git hosting service. With it’s community edition, one can setup an in-house git server in no time.
Those who have been an earlier follower of Gitlab, may still be stuck with the version 6.X. Version 6.X was setup manually by creating DB in MySQL/Postgres, Nginx/Apache entries and few other setup steps.
As time moved on, Gitlab started providing packages and one could install or upgrade Gitlab using a package manager like yum, apt.
... Read More
When I started using docker, I used to deploy the source code of my application statically into docker images. This is a good and recommended approach for production.
But while building images for testing team, I realized the build process needs to repeat and is not a very optimal approach. If you just need to take in a new commit, a different branch or a latest master checkout, you need to rebuild the image.
... Read More
docker-compose is an amazing tool to create a full fledged environment using different docker containers. We have used the same in our case to deploy multiple environments for testing.
This article will share the best practices when it comes to using environments files inside docker-compose.yml
Approach #1 - Using env_file Let’s create a simple docker-compose.yml file which prints a environment variable and then sleeps for sometime
docker-compose.yml version: '2' services: demo: image: centos:7.
... Read More
Building Nginx from source with LuaJIT
30 April 2017
Nginx is a great webserver. But it has no scripting capabilities. To add scripting capabilities in Nginx, one needs to build it from source with the necessary add-ons.
In this article I will showcase how we can build Nginx with Lua inside Docker. There are two ways to do it
1. OpenResty OpenRestry® is a full-fledged web platform that integrates the standard Nginx core, LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules
... Read More
Detecting OS in shell script
27 April 2017
Each linux distribution uses different package manager. To be able to execute commands based on the type of OS in a shell script, we need a way to detect the OS first.
Using which command My first take on resolving this was to use the which command
#!/bin/bash if [[ `which yum` ]]; then IS_RHEL=1 elif [[ `which apt` ]]; then IS_UBUNTU=1 elif [[ `which apk` ]]; then IS_ALPINE=1 else IS_UNKNOWN=1 fi Now this works well on most OS, but the issue is that when you use the same on docker images.
... Read More
PHP Code Coverage for your web/selenium automation
31 March 2017
Approach 1 PHP code coverage data can be collected using the sebastianbergmann/php-code-coverage composer module. But this is easier when we are running PHP unit test.
When we test our application using a browser, either through manual testing or through automation like Selenium or QTP. Every request get’s generated by the Web Browser and is handled by a Web Server. This in many cases would be either Nginx or Apache.
... Read More
MySQL master slave using docker
30 March 2017
Docker makes it easy to run multiple independent mysql instances on the same machines for different projects. But some projects use a Master and slave setup of MySQL, where usually writes are directed to Master and the reads are directed to Slave.
I based my approach on tegansnyder/docker-mysql-master-slave. But what I didn’t like about the existing setup is that it assumed mysql client setup on the host. I wanted to do it using the mysql docker images itself.
... Read More