Skip to main content

Posts

Showing posts from April, 2019

Mobile Test Automation using Appium and Android studio

In this article we will discuss about how to automate Mobile application using Appium Server and Android Studio. Appium supports both iOS and Android. Appium is HTTP server. It receives the commands from client, executes the command on Mobile device and send a HTTP response representing the result of the command execution. I am going to use Android studio to create a virtual emulator. And Selenium WebDriver will be used to write the Client. I would prefer to use the virtual emulator instead of using real device. In actual devices you may find difficulties to connect/detect it. Pre-requisites .apk file is required to install in Mobile device (Virtual emulator). Android Studio, Appium desktop server and intelliJ IDEA have to be installed. Virtual emulator This post guides you to create the Virtual emulator using Android Studio. Once you launch the emulator now It's time to install the mobile application which is going to be automated. Drag and drop the apk file ...

Data Driven Protractor Testing

In this article I would like to share knowledge regarding Data driven testing. When using a Data driven automation test framework, we do not need to hard code the test data. Instead it enables to access the test data from a separate data file and use them in the automated test cases. First, let's take a look at a simple Protractor script without Data Driven framework describe('Angular home page', function () {       it('should add the String in todo list ', function () {          browser.get('https://angularjs.org/');          element.all(by.css("[placeholder='add new todo here']")).sendKeys("Add POM");          element(by.css('input.btn-primary')).click();          var getText = element.all(by.css('label.checkbox'));          getText.get(2).getText().then(function (results) {          expect(results).toEqua...

Protractor Page Object Model

Hi All, I would like to share my learning regarding Protractor Page Object Model (POM). Protractor is an end to end test framework used to automate Angular web applications. In POM, for each web page there should be corresponding page class. Carrying out the task of "Finding the web elements and methods" will be done from the page class. This of course improves the maintainability and reusability of the code. Here I will show a simple example without Page Object Model which I have written in Javascript using Protractor framework. describe ( ' Angular home page ' , function ( ) { it ( ' should add the String in todo list ' , function ( ) { browser . get ( ' https://angularjs.org/ ' ) ; element . all ( by . css ( " [placeholder='add new todo here'] " ) ) . sendKeys ( " Add POM " ) ; element ( by . css ( ' input.btn-primary ' ) ) . click ( ) ; var getText = eleme...

GitLab and Jenkins configuration through SSH

In my previous post I have mentioned how to integrate GitLab with Jenkins using username and password. Now we will learn how to configure Jenkins and GitLab using SSH connection. Login as Jenkins user sudo su - jenkins Run the following command to generate SSH key,  ssh - keygen Now it will create  a directory named .ssh if it doesn't exist, Press enter and re-enter when you are prompted to enter passphrase. thuvvareka : ~ jenkins$ ssh - keygen Generating public / private rsa key pair . Enter file in which to save the key ( / Users / Shared / Jenkins / . ssh / id_rsa ) : Created directory ' /Users/Shared/Jenkins/.ssh ' . Enter passphrase ( empty for no passphrase ) : Enter same passphrase again : Your identification has been saved in / Users / Shared / Jenkins / . ssh / id_rsa . Your public key has been saved in / Users / Shared / Jenkins / . ssh / id_rsa . pub . The key fingerprint is : SHA256 : O9APiAETUYC87e9T6k18SPFQxEN4R2gJbKG6JLOID64 jenkins@thu...

Standalone Selenium server

Instead of starting the Webdriver manually, You can configure the selenium stand alone server in Protractor configuration file Selenium Standalone server can be downloaded from this site. exports . config = { seleniumServerJar : ' ./seleniumJar/selenium-server-standalone-3.141.5.jar ' , So it will automatically start the selenium server once you start running the test suite.

Protractor jasmine2 html reporter with Jenkins

I guess you all have enough knowledge on Jenkins setup. If not you can refer to my article on setting up Jenkins from here . Now you may wonder how to get a report of test results after executing your automated test suite via Jenkins. We will learn how to generate test results in html file in Jenkins. For that we are going to use protractor-jasmine2-html-reporter Framework has to be jasmine2 framework : ' jasmine2 ' Login as Jenkins user  thuvvareka : thuvvareka$ sudo su - jenkins Password: thuvvareka : ~ jenkins$ Now you have logged in as  jenkins user, Run the following command to install  protractor-jasmine2-html-reporter npm install protractor - jasmine2 - html - reporter -- save - dev Configure protractor-jasmine2-html-reporter in your protractor configuration file exports . config = { onPrepare : function ( ) { var Jasmine2HtmlReporter = require ( ' protractor-jasmine2-html-reporter ' ) ; protractor . basePath =...

Protractor with Gitlab and Jenkins

Hi everyone.. welcome to the first article in my new series of articles on Automation Testing. For a change, let's start from the End. Let's assume you have written your automation code in protractor and your project is ready to be pushed in to the repository. So let's start with a brief introduction on how to push our automation code to a Git repository. In this lesson I will be using GitLab repository. First things first.. You can't just push the code to a repository. Yeah.... you have to install Gitlab and make sure you have configured it properly. Try following command to make sure Git have been installed in your machine. git --version Hope Git have been installed in your machine, Let's start with GitLab configuration. Sign up with GitLab account Go to GitLab account and get register with your email account To identify you as the author configure your Git username and email address in your machine git config -- global user.name git config -- g...