Monday, January 20, 2020

How to install Android Studio on Windows 10

To install Android Studio on Windows 10

1. Download Android Studio from  https://developer.android.com/studio
2. Install it on Windows (Default installation folder is  C:\Program Files\Android\Android Studio)
3. You can run Android Studio by executing the exe file (studio64.exe) [Absolute path: C:\Program Files\Android\Android Studio\bin\studio64.exe]

Sunday, January 12, 2020

How to install Java/JDK on Windows 10

To install Java on Windows 10:

1. Go to https://www.oracle.com/technetwork/java/javase/downloads/ and download Java SE Development Kit (in my case "jdk-13.0.1_windows-x64_bin.exe")
2. Simply install the exe

Configuration: It needs to set Path and Classpath
1. Go to System window (Control Panel -> System and Security -> System)
2. Click "Advanced system settings" to go to System Properties window
3. Click "Environment Variables"
4. In <System variables> set the followings as below (The value depends on your installation folder/path):
          JAVA_HOME = C:\Program Files\Java\jdk-13.0.1
          Path = C:\Program Files\Java\jdk-13.0.1\bin
          CLASSPATH = .;C:\Program Files\Java\jdk-13.0.1
5. Open command prompt -> Type the following command and press Enter
java -version

Wednesday, December 11, 2019

List of some API Testing Tools

Some API Testing Tools:

Free & Paid:

  • SOAPUI
  • Postman
  • Apigee
  • Ping API
  • HttpMaster: There are 2 editions -  Express edition is free & Professional edition is paid
  • SOAP Sonar: There are 2 editions - Free Edition & Enterprise Edition (paid)

Free/Open source:

  • Rest-assured
  • JMeter
  • Karate DSL
  • Airborne
  • Rest Console
  • Hippie-Swagger

Commercial:

  • SOAtest
  • Unified Functional Testing (UFT) [Formerly QTP]
  • Tricentis
  • Pyresttest
  • API Fortress
  • vREST
  • API Science
  • APImetrics

Tuesday, December 10, 2019

Mobile Test Automation Tools/Frameworks

Free / Open source tools:

Supported OS: Android, iOS
Supported Languages: Java, Python, Ruby, PHP, JavaScript

Calabash

Supported OS: Android, iOS
Supported Languages: C#, Ruby, JVM-based languages

Robotium

Supported OS: Android
Supported Languages: Java

TestProject
Supported OS: Android, iOS
Supported Languages: Java, C#

Monkey Talk

Supported OS: Android, iOS

Ui Automator

Supported OS: Android
Supported Languages: Java

Selendroid

Supported OS: Android
Supported Languages: Java, Python

iOS UI Automation

Supported OS: iOS
Supported Languages: JavaScript

Keep It Functional

Supported OS: iOS
Supported Languages: Objective-C and Swift languages

iOS Driver

Supported OS: iOS
Supported Languages: JavaScript

Commercial tools:

Test Complete
Supported OS: Android, iOS
Supported Languages: Python, VBScript, JScript, or JavaScript

Ranorex

Supported OS: Android, iOS
Supported Languages: C#, VB.NET

Wednesday, November 6, 2019

Test Automation for Windows Desktop Application using Winium with Java

Prerequisites to work with Winium:

1. Microsoft .NET Framework
2. Eclipse (as IDE)
3. Java/JDK
4. TestNG
5. Maven
6. Inspection Element tool (such as Inspect.exe)

Step 1: Creating a Maven project

Open Eclipse IDE and create a Maven project. Update the pom.xml with the necessary dependencies. Dependencies to include – Winium WebDriver, Winium Elements Desktop, Selenium Java, TestNG.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>WiniumWithJava</groupId>
  <artifactId>WiniumWithJava</artifactId>
  <version>0.0.1-SNAPSHOT</version>

  <dependencies>
  <!-- https://mvnrepository.com/artifact/com.github.2gis.winium/winium-webdriver -->
<dependency>
    <groupId>com.github.2gis.winium</groupId>
    <artifactId>winium-webdriver</artifactId>
    <version>0.1.0-1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.github.2gis.winium/winium-elements-desktop -->
<dependency>
    <groupId>com.github.2gis.winium</groupId>
    <artifactId>winium-elements-desktop</artifactId>
    <version>0.1.0-1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
    <groupId>org.seleniumhq.selenium</groupId>
    <artifactId>selenium-java</artifactId>
    <version>3.141.59</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.0.0</version>
    <scope>test</scope>
</dependency>
  </dependencies>
</project>

Step 2: Downloading Winium.Desktop.Driver.exe

Download the latest Winium.Desktop.Driver.zip from below link -> extract and keep in any location.
https://github.com/2gis/Winium.Desktop/releases

Step 3: Writing Winium Java code

import java.io.File;
import java.io.IOException;
import org.openqa.selenium.By;
import org.openqa.selenium.winium.DesktopOptions;
import org.openqa.selenium.winium.WiniumDriver;
import org.openqa.selenium.winium.WiniumDriverService;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

public class NotepadExample{
    WiniumDriver driver;
    DesktopOptions option;
    WiniumDriverService service;

@BeforeClass(alwaysRun = true)
public void setUp() throws Exception {
option = new DesktopOptions();
option.setApplicationPath("C:\\Windows\\System32\\notepad.exe");
File driverPath = new File("E:\\QA_720\\Winium\\Winium.Desktop.Driver\\Winium.Desktop.Driver.exe");
service = new WiniumDriverService.Builder().usingDriverExecutable(driverPath).usingPort(9999).withVerbose(true).withSilent(false).buildDesktopService();
try{
service.start();
}catch(IOException ioe){
System.out.println("Exception while starting WINIUM service");
ioe.printStackTrace();
}
driver = new WiniumDriver(service, option);
}
@AfterClass(alwaysRun = true)
public void tearDown() throws Exception {
service.stop();
}

@Test
public void testNotepad() throws Exception{
Thread.sleep(1000);
driver.findElement(By.name("Text Editor")).sendKeys("This is sample Winium test");
driver.findElement(By.id("Close")).click();
driver.findElement(By.name("Don't Save")).click();
}
}

Step 4: Running the test using TestNG

In Eclipse project, right click on the class "NotepadExample.java" -> Mouse over Run As -> Click TestNG Test

Enjoy test execution of Notepad. The following steps would do by running this:
1. Open Notepad
2. Writing some text on Notepad
3. Close the Notepad without saving it

Wednesday, November 22, 2017

How to set up Selenium WebDriver .NET C# project with NUnit in Visual Studio

Prerequisite:

➽ Windows as OS
➽ Visual Studio is installed

Step 1: Creating Solution and Project in VS

1. Open Visual Studio
2. Click File -> Mouse over New -> Click Project...
3. Select Templates -> Visual C# -> Test at the left side
4. Enter a Solution and Project Name -> Click OK


Step 2: Adding/Installing Selenium WebDriver package to the project

Installing Selenium.WebDriver and Selenium.Support
1. Right click on the Project -> Click "Manage NuGet Packages..."
2. In the middle panel: Click Browse -> Do search by Selenium
3. Click "Selenium.WebDriver" -> Click Install button -> Follow the installation instruction
4. After successful installation - click "Selenium.Support" -> Click Install button -> Follow the installation instruction

Step 3: Adding/Installing NUnit package to the project

Installing NUnit and NUnit3TestAdapter
1. Search by NUnit
2. Click NUnit from the list after search -> Click Install button -> Follow the installation instruction
3. After successful installation of NUnit - click NUnit3TestAdapter -> Click Install button -> Follow the installation instruction

Step 4: Creating a Test

1. In Solution Explorer at the right side - Double click on UnitTest1.cs -> Code snippet will display in the middle panel
2. Rename UnitTest1.cs as MyFirstSeleniumTest.cs at the right panel
3. Replace the existing code by your own.

using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using OpenQA.Selenium;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.Support.UI;

namespace MyFirstSeleniumTest
{
    [TestFixture]
    public class MyFirstSeleniumTest
    {
        private IWebDriver driver;
        private StringBuilder verificationErrors;
        private string baseURL;
        private bool acceptNextAlert = true;

        [SetUp]
        public void SetupTest()
        {
            driver = new FirefoxDriver();
            baseURL = "https://link.testproject.io/bsg";
            verificationErrors = new StringBuilder();
        }

        [TearDown]
        public void TeardownTest()
        {
            try
            {
                driver.Quit();
            }
            catch (Exception)
            {
                // Ignore errors if unable to close the browser
            }
            Assert.AreEqual("", verificationErrors.ToString());
        }

        [Test]
        public void TheUntitledTest()
        {
            driver.Navigate().GoToUrl(baseURL);
            driver.FindElement(By.LinkText("Free Sign Up")).Click();
            driver.FindElement(By.Id("first-name")).Click();
            driver.FindElement(By.Id("first-name")).Clear();
            driver.FindElement(By.Id("first-name")).SendKeys("Ripon Al Wasim");
            driver.FindElement(By.Id("email")).Clear();
            driver.FindElement(By.Id("email")).SendKeys("riponalwasim@gmail.com");
        }
        private bool IsElementPresent(By by)
        {
            try
            {
                driver.FindElement(by);
                return true;
            }
            catch (NoSuchElementException)
            {
                return false;
            }
        }

        private bool IsAlertPresent()
        {
            try
            {
                driver.SwitchTo().Alert();
                return true;
            }
            catch (NoAlertPresentException)
            {
                return false;
            }
        }

        private string CloseAlertAndGetItsText()
        {
            try
            {
                IAlert alert = driver.SwitchTo().Alert();
                string alertText = alert.Text;
                if (acceptNextAlert)
                {
                    alert.Accept();
                }
                else
                {
                    alert.Dismiss();
                }
                return alertText;
            }
            finally
            {
                acceptNextAlert = true;
            }
        }
    }
}

Step 5: Running the Test

1. Right click anywhere at the code editor
2. Click Run Tests from the pop up

Friday, November 17, 2017

How to set up Selenium WebDriver Java project in Eclipse

To set up Selenium WebDriver Java project in Eclipse

Prerequisite:

➽ Eclipse is installed
➽ JDK is installed

Step 1: Creating Java Project in Eclipse

1. Open Eclipse
2. Click File -> Mouse over New -> Click Java Project
3. Enter a Project Name -> Click Next and then Finish

Step 2: Installing/Configuring Selenium WebDriver

1. Download Selenium WD Java client from http://www.seleniumhq.org/download/ at "Selenium Client & WebDriver Language Bindings" section (In my case it is selenium-java-3.7.1.zip)
2. Extract the Zip file in a folder/location of your choice
3. In Eclipse: Right click on Java Project you have created in Step 1 and click Properties
4. In Project Properties window: Click "Java Build Path" at the left -> Click Libraries tab -> Click "Add External JARs..." button at the right side
5. Select client-combined-3.7.1.jar and client-combined-3.7.1-sources.jar from the folder "selenium-java-3.7.1" -> Click Open button
6. Again click "Add External JARs..." button at the right side -> Select all the JARs from /selenium-java-3.7.1/libs folder and click Open button
7. Finally click OK

Step 3: Creating our first Test Script/Class

1. To create a package: Right click src -> Mouse over New -> Click Package. Enter a package Name and click Finish
2. To create a class: Right click on package name -> Mouse over New -> Click Class. Enter a Class Name and click Finish button

Step 4: Modifying the previous code to WD java

1. Modify the previous code to Selenium WD Java code to perform the following steps:
    1.1 Initialize FirefoxDriver
    1.2 Visit Google - https://www.google.com/ in Firefox
    1.3 Clear the Google search text field
    1.4 Enter search keyword in text field
    1.5 Press Enter key to view the search result
Step 5: Run the test

1. Right click on Java Class (GoogleSearch.java) at the left
2. Mouse over Run As -> Click Java Application