Dark Mode
Image
  • Thursday, 09 February 2023
DevOps-6: Software and Automation Testing Framework [Selenium]

DevOps-6: Software and Automation Testing Framework [Selenium]


DevOps-6: Software and Automation Testing Framework [Selenium] - Outline

6.1. Learning Objectives

Selenium provides a set of tools and libraries that enable and support web browser automation testing. TestNG or Jenkins to generate proper test report.

 

6.2. Overview of Automation Testing

What is automation testing?

Automation testing is an application software testing process using software tools to control the execution of tests. The actual test results are compared with the expected test results. Manual testing is a form of software testing in which test cases are run by a human rather than using an automated tool.

The automated software testing can be summed up a follow,

  • Accelerates the execution of tests
  • Helps to increase the test coverage.
  • Eliminates the need for human interference.

Why to we need automation tool?

Manually repeating these tests is costly and time consuming. Once created, automated tests can be run over and over again at no additional cost and they are much faster than manual tests. Automated software testing can reduce the time to run repetitive tests from days to hours.

The criteria for the test cases are as follows:

  • High risk and business critical
  • Repetitive execution
  • Monotonous or exhausting to perform manually
  • Laborious

It is also important to note that Automation is not appropriate to use in the test cases:

  • That are newly designed and have never been manually executed at least once.
  • Test cases requirements changes frequently>
  • That are executed in ad-hoc situations

 

6.3. Automation Testing Process and its Popular Tools

Automation testing process,

Automation Testing Process

  1. Scope of automation: The specific area of your application software that will be automated.

    Guidelines to assess scope:

    • Empirical features that are essential for application software
    • Larger Data involvement scenarios of the application software
    • Identical functionalities shared by the application software products
    • Technical feasibility of the application software.
  2. Test automation tool selection: The project’s specifications are evaluated using the scope of automation to select appropriate tools.

    Automation Testing Process
  3. Test planning, Design and Development:Cycle of test planning, design and development,

    • Selection of Automation tool as per requirements
    • Framework designs and their characteristics
    • Automation components that are in and out-of-scope
    • Preparation of an automation testbed
    • Schedules and timeline of scripting and execution
  4. Test Execution: The automation script requires input test data. Therefore, it generates extensive test reports after execution.

  5. Test Automation Management: A phase of automation testing that is used to see if the new features added to the software are working properly.

    Popular software and automation testing tools,

    • Ranorex Studio: It is a one-stop solution for automation functional user interface test, regression tests, data-driven tests and more.
    • Testim: It is the quickest way to create durable end-to-end tests, whether they’re codeless, programmed or both.
    • Lambdatest: It is popular tool for performing automated cross-browser testing.
    • Selenium: It is a software testing tool that’s use to perform regression testing.

 

6.4. Introduction to Selenium

Selenium is an umbrella project that includes a set of tools and libraries that enable and support web browser automation. Feature of Selenium,

  • It is an open-source and portable framework used to automate web application testing
  • Helps is crating robust, browser-based regression automation suites and perform test execution.
  • It is highly flexible when it comes to testing functional and regression test cases
  • Support cross browning, where the test cases run across various platform simultaneously

Selenium is compatible with:

Automation Testing Process Automation Testing Process Automation Testing Process Automation Testing Process

 

6.5. Selenium WebDriver Architecture

Selenium WebDriver is the most significate component of the Selenium Tool suit. Test script can be written in any of the supported programming language and run directly in most contemporary web browser using WebDriver.

Automation Testing Process

The architectural layout of Selenium WebDriver which is categorized into 4 main components,

Automation Testing Process

Selenium Language Bindings: It has language binding or selenium Client Libraries to support multiple language. For instance, when we want to access the browser driver in Java by using the java bindings.

JSON Wire Protocol: JSON is a web-based data exchange standard. This manages data structures, such as object and array. Writing and reading data from JSON is simple. It communicates between a server and a client.

Browser Driver: It uses distinctive drivers for every browser to establish a safe connection with the browser. It doesn’t compromise with the internal logic of the browser’s functionalities.

Real Browser: Compatible with the major browsers:

  • Internet Explorer
  • Mozilla Firefox
  • Google Chrome
  • Safari

 

6.6. Installation

Prerequisites:-

  • 64-bit Ubuntu OS
  • JDK 8(Java as Programming Language)

Selenium Installation:-

  • Download and set up selenium server
  • Download ChormeDriver
  • Integrate Selenium to Eclipse

Download and Set-up Selenium Server

The sub-steps involved in the downloading and setting up of the Selenium Server

  1. Locate Selenium using the command:
    $ locate selenium
    
  2. If locate is not found then command:
    $ sudo apt install mlocate
    
    Automation Testing Process
  3. Update the package:
    $ sudo apt-get update
    
  4. Install Selenium using the command:
    $ sudo pip install selenium
    
  5. Download Selenium Server (Grid) https://www.selenium.dev/downloads/
  6. Download Chrome Driver https://chromedriver.chromium.org/downloads
  7. Unzip chromedriver download file
  8. Open the Eclipse and create a new java project in it Automation Testing Process
  9. Configure the build path by right clicking on the created project Automation Testing Process
  10. Add external jar file by adding the Selenium jar file Automation Testing Process
  11. This finishes the integration of Selenium with Eclipse Automation Testing Process

 

6.7. Demo - Automate Search Run First Test Case Using Selenium

 

6.8. Overview of Selenium Test Framework (TestNG)

Selenium tests do not deliver test result in a consistent format, so TestNG is used to generate test results.

Automation Testing Process

jUnit, which employs annotations @, is the inspiration for TestNG. TestNG fixes Junit’s shortcoming and intends to make end-to-end testing simple.

Automation Testing Process

The invocation count keyword is used to perform the test case innumerable times without loops.

Cross-browser testing uses TestNG to run multiple test cases on browsers. The annotations in the testing are very lucid. For instance, @BeforeMethod, @AfterMethod, @BeforeTest and @AfterTest

TestNG provides the followings,

  • Provides a readable report due to lack of report generation in WebDriver
  • Makes test coding easier by utilizing TestNG
  • Automates uncaught exception without halting the test unexpectedly.

 

6.9. Selenium with Jenkins Integration

Jenkins is an open-source automation server and a popular Continuous integration orchestration tool. It has the following features,

  • Promotes continuous integration and delivery by automation
  • Provides numerous plugins for integration with multiple framework
  • Provides plugin that help run test suites, gather and display the result.

The benefits of using Jenkins for automation testing are:

  1. Runs Automated Test Suits:
    • Provides plugins for various test frameworks like Selenium, Cucumber, and Appium Robot framework
    • Integrated into Continuous integration pipelines to run automated test for every build
  2. Summarizes the Result:
    • Most plugins also summarize the test results are display them as HTML output.
  3. Provides Trend:
    • It keeps track of result and display them as a trend graph
    • his offers a better view of how the test have fared in the past.
  4. Display Test Failure Result:
    • Test result are tabulated, and the failures are logged with the test result.

 

 

Comment / Reply From