Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Tuesday 30 March 2021

Page Object Model - POM

Page Object Model is a pattern that we can apply it to develop efficient automation framework. With Page model, it is possible to minimize maintenance cost. Basically Page Object means that our every page is inherited from a base class which includes basic functionalities for every pages. If we have some new functionality that every pages have, we can simple add it to the base class.
Page Object Model is a design pattern that is used mostly in Web UI testing for enhancing maintenance of the test code and reducing duplication of it. Each page in the web application has to be separate class different than the others. These are the classes that contains Web Elements(Locators) of the web page, the classes include the methods which perform operations on those Web Elements and the classes are exist so that to execute corresponding page tests.

Why :

Selenium test projects generally are hard to be maintained. Also there is a significant amount of duplicated line of codes. Duplicated code cause unnecessary functionality and many crazy similar page object locators. Another reason is that changing the page locators frequently, if some locator will change, we might have to adjust the locator for the new implementation. This is a considerable waster of time for the QA team. We cannot see the exact advantage of POM if we have a small script to test the login behavior of the application. Scripts maintenance looks easy. However, as time goes further, the test suite will grow. As we add more and more lines to our code, things become tough. for example, IF we consumed out time to maintain our code at every change, how would we increase our test coverage.

Implementation -

In PyCharmIDE Create a directory and give a name whatever we want for the project on our local. Here is the very first window once we start to create a new project in PyCharm. First we need to specify both the location and the project name, then select project interpreter and click on Create button.

The next step is creating separate folders for the corresponding elements, for example Web Elements will be located under Locators folder, common actions will be in Base Class, Chrome, Firefox and Explorer driver will be in Drivers, Web Page methods will be located in Pages, Testcases will be in Tests folder. We can also create a TestSuite folders so that executing our tests as suite. 

Project folder structure.

we can create python files under folders that are related actions for our Application Under Test. For creating a python file, right click locators folder then click "New" and create a python file.


After completing the associated files, project structure will look like this.

Advantages
-
  1. If the UI design of the page changes, we dont have to update the test class implementation, rather it is enough to update the page object(locator)
  2. POM provides us creating a non-fragile test by means of reducing duplicated codes.
  3. POM makes our test code as clean as possible. Therefore, the test codes are easy to understand even if after a very long time later.
  4. POM design implementation separates the page objects and tests by achieving an abstraction.


Sunday 28 March 2021

PyTest

PyTest is an Open source Python testing framework that is primarily used for unit testing. This particular Python testing framework in 2020 is scalable as it is useful for writing simple automation tests as well as complex functional tests for applications and libraries. It is easy to get started with  PyTest. It is compatible with python 3.5+ and PyPy3.

Test suites written using PyTest are more compact as a lot of boiler-plate code is not required and there is no requirement to include tests into largest test classes. Unlike the default Python testing framework 2020. Which mandates tests to start with test or end with test, there is no fixed test case nomenclature in PyTest. This is because PyTest has built in features that supports auto discovery of test modules and functions.

There is no need to remember self.assert* names due to the introduction of the useful feature of assert rewriting that helps in providing detailed information on failing assert statements.

Prerequisites -

The best part about PyTest, Python testing framework, is that it involves a gentle learning curve. It is easy to get started with PyTest, especially if we have prior working knowledge about any existing Python testing frameworks. we will just need a Python IDE for development and Python Package Manager for installing PyTest.

Pros -

There are a number of advantages of the PyTest framework,, major one's are:

  1. It is compatible with other Python testing frameworks such as unittest(or PyUnit)
  2. PyTest can also be used for creating complex functional test cases.
  3. It requires less effort to port existing implementations using other Python testing frameworks to PyTest.
  4. PyTest can be used for projects that practice TDD(Test Drivern Development) as well as Open-source projects.
  5. PyTest is instrumental in creating effective test cases  and test suites as it supports. parameterization.Using parameterization, test cases can be executed with different input configurations thereby resulting in minimal code repetition.
  6. Testing using PyTest are easy to understand as there is very little boiler-plate code.
  7. It supports fixtures and calssess due to which common test objects are available through the lifecycle of a module/class/function/session.
  8. PyTest is extensible and the Python testing framework already has rich plugin architecture. There are currently 315+ external plugins with PyTest.
  9. It supprots Parallel test execution through the pytest xdist plugin
  10. Assets in PyTest provides detailed information about the failures scenarios.

Is PyTest The best Python Testing Framework...?

We can choose PyTest over the default selenium Python framework i.e.unitest in case we are developing complex functional tests. Fixtures, Classes as well as Parameterization can be extremely handy for automation test development.

Friday 26 March 2021

New Features in UFT One 15.0.2

This version provides enhancements for faster and smarter testing, thereby helping testers reduce test creation and execution time, boost test coverage, increase the resiliency of testing assets, and cut down on test maintenance efforts.

1. AI-based testing enhancements-

UFT One's newly introduce AI-based testing continues to revolutionize and intelligently-power the way humans test. The latest enahancements within UFT One 15.0.2 offer the ability to-

  • Record AI test steps
  • Learn AI objects on application mockups and prepare  AI-based tests before application is developed
  • Run existing tests with the "AI Transformation Assistant" enabled to get suggestions for changing technology-based test steps to AI-based test steps
  • Automatically scroll to find objects
  • Create checkpoints to specify the test conditions application must meet
  • Provide an image file as a class description to support a control that UFT One AI does not recognize
  • Install UFT One’s AI features directly through the Installation Wizard
  • Save your feedback locally and send it to Micro Focus later if an internet connection isn’t available
  • Perform operations on “AIText” objects and on additional control types

These AI-based testing enhancements enable teams using UFT One to accelerate the creation of automation assets and reduce the maintenance effort required to match the pace of application changes.

2. New Spy

UFT One's new spy, known as the Object Identification Center (OIC), is visually -intuitive tool for designing tests with greater flexibility and ultramodern functionality. It supports the same feature functionality that original Object Spy does, but introduce a number of new capabilities that allow we to.

  1. Spy on multiple objects.
  2. Add multiple objects to our test or to object repositories.
  3. Modify the test object's description properties to customize the object's identification.
  4. Add objects to external object repositories that are not associated to the current test.

while the OIC is available as a technical preview in this version, it is now the default spying tool. we can still use the original Object Spy tool if you prefer.

3. Performance Acceleration

Performance speeds have been improved to accelerate test process and reduce test times. This includes.

Web : Accelerated web - based testing on chrome, chromium Edge and Firefox.

Insight Recording : Higher-degree of accuracy, speed and ease of use for object identification.

Standard Windows : Improved speeds for testing standard windows-based objects.

Business Process Testing(BPT) - Dramatically reduce test execution times when compared to previous BPT versions.

4. Parallel execution for API Testing -

Fire your API tests on all cylinders by running multiple tests simultaneously.

In UFT One 15.0.2 we can now use the ParallelRunner CLI tool to run up to four API tests in parallel.

5. Mobile Testing Enhancements -

In combination with the UFT Mobile 3.5 release, UFT One 15.0.2 introduces enhancements designed to streaming processes and increase testing efficiencies for mobile testing.

6. Technology Improvements-

UFT One 15.0.2 improves its testability and ease-of-use with a number of new enhancements for targeted areas, including the following technologies.

Core Technologies-
SAP Technologies-
  • New objects for testing web-based SAP applications in a chrome browser.
  • Full support for testing SAPUI5 test objects using Chromium-based Edge.
Web/Browser based technologies-

7. Text-based test objects

Text based test objects are now fully supported in this version, providing the ability to.

  1. Add Test-based test objects to our object repository.
  2. Record steps on Text-based test objects
  3. Create "text and text area checkpoints" and "Output values" on Text-based test objects.
  4. Uniquely describe Text-based test objects using ordinal identifiers such as location, index and VRI.
  5. Use common methods such as "Highlight", "GetTOProperty" and "GetROProperty"

8. Modern look and feel 

UFT One 15.0.2 adds more to its fresh new look, including cosemetic  and aesthetic UI-based updates that emphasize UFT One's ease-of-use.

The default theme has undergone a number of UI design updates, including a new splash screen, Add-in manager, Keyword View and Object Repository.

For UFT One's Dark Theme enhancements were made to the:

  1. Add-in manager.
  2. Start page
  3. Keyword View
  4. Object Repository editors
  5. Run results HTML report.

9. Continuous Testing updates.

UFT One 15.0.2 improves its long standing support for continuous testing with new capability for CI/CD and version control.

CI/CD plugin enhancements

UFT One 15.0.2 provides the following updates when working with CI/CD servers.

  • Jenkins: We can now define ALM credentials globally in our Jenkins server instead of defining them separately in each job. In addition, the Jenkins plugin options for rerunning failed tests have been redesigned for clarity.
  • Azure DevOps: When running UFT One tests on an Azure DevOps Server, we can now view the test run results in detail within the Azure DevOps Server UI.
  • Bamboo: We can now pass input parameters to UFT One tests when you run them from a Bamboo server.

Version control support

UFT One 15.0.2 provides the following enhancements when using version control.

  • Object Repositories: Merge and resolve object repository conflicts using the Asset Comparison Tool.
  • Function Libraries: Function libraries saved as .qfl or .txt files are now saved in UTF-8 encoding, enabling we to compare, merge, and manage them in Git.

10. Support Matrix-

UFT One is hailed by industry analysts for its support of diverse technology stacks. As expected, this release includes 30+ newly supported technologies and versions.

Core technologies

  • Attachmate Extra! 9.5
  • Delphi 10.4 Sydney
  • DevExpress 20.1
  • IBM i Access Client
  • Java 14
  • Java 15.0.1
  • Microsoft Dynamics 365
  • OpenJDK 11
  • OpenJDK 14

SAP technologies

  • SAP Fiori 1.78
  • SAP GUI 760 Patch 7
  • SAP NWBC Client 7.0 Patches 12 and 13
  • SAP Web Dynpro ASAP (WDA) 7.54
  • SAP S/4HANA 1909
  • SAP S4CRM 204

Web/Browser technologies

  • Dojo 1.16
  • Chrome 83-86
  • Chromium Edge 84-86
  • Firefox 76
  • Firefox 78
  • Firefox ESR 78-82
  • Safari 14


Thursday 25 March 2021

Git

Git is a version control system for tracking changes in computer files and coordinating work on those, files among multiple people.
It is primarily used for source code management in software development, but it can be used to keep track of changes in any set of files.
As a distributed revision control system it is aimed at speed, data integrity and support for distributed non-linear workflows.
The most widely used modern version control system in the world today is Git.

Git is a mature, actively maintained open source project originally developed in 2005 by Linus Torvald.
Git is an example of a Distributed Version Control System, In Git, every developer's working copy of the code is also a repository that can contain the full history of all changes.

Advantages -
  1. Ease to use.
  2. Data redundancy and replication.
  3. High availability.
  4. Superior disk utilization and network performance.
  5. Only one .git directory per repository.
  6. Collaboration friendly.
  7. Any kind of projects from large to small scale can use GIT.
Repository -

The purpose of Git is to manage a project or set of files, as they change over time. Git stores this information in a data structure called a repository. A git repository contains,
A set of commit objects.
A set of references to commit objects called heads.
The Git repository is stored in the same directory as the project itself in a subdirectory called .git.

Note - difference from central repository systems like CVS or Subversion:

There is only one .git directory, in the root directory of the project. The repository is stored in files alongside the project. There is no central server repository.

Difference between GIT and SVN -

Git is less preferred for handling extremely large files or frequently changing binary files while SVN can handle multiple projects stored in the same repository.

Git does not support 'commits' across multiple branches or tags. Subversion allows the creation of folders at any location in the repository layout.

Git are unchangeable, while Subversion allows committers to treat a tag as a branch and to create multiple revisions under a tag root.

Staging Area -

Staging is a step before the commit process in git. That is, a commit in git is performed in two steps.

-Staging and
-Actual commit
As long as a change set is in the staging area, git allows we to edit it as we like.


























Conditional Statements in Python

Conditional statements

In python, decision making is performed by the following statements.

If-statement - The if statement is used to test a specific condition. If the condition is true, a block of code(If-block) will be executed.

IF-else Statement - The if-else statement is similar to if statement except the fact that, if also provides the block of the code for the false case of the condition to be checked. If the condition provided in the if statement is false, then the else statement will be executed.

Nested if statement - Nested if statements enable us to use if ? else statement inside an outer if statement. 

If Statement 

The if statement is used to test a particular condition and if the condition is true, it executes a block of code known as If-block. The condition of if statement can be any valid logical expression which can be either evaluated to true of false.

Syntax

If expression:
   statement

Example 1:

num=int(input("enter the number"))
if num%2==0
   print("Number is even")

Output:

enter the number 10
Number is even

Example 2:

a= int(input("Enter a value"))
b= int(input("Enter b value"))
c= int(input("Enter c value"))

if a>b and a>c:
   print(" a is largest");
if b>a and b>c:
   print(" b is largest");
if c>a and c>b:
   print("c is largest");

Output:

Enter a value 1000
Enter b value 2000
Enter c value 3000
c is largest

If-Else Statement :

The If -else statement provides an else block combined with the if statement which is executed in the false case of the condition. If the condition is true, then the if-block is executed, otherwise, the else-block is executed.

Syntax -

If condition:
   #block of statements
else
   #another block of statements(else-block)

Example - Program to check whether a person is eligible to vote or not.

age=int(input("Enter your age"))

if age>=18:

   print("you are eligible to vote")

else

   print("sorry you have to wait")

Output :

Enter your age 20
you are eligible to vote

Example : Program to check whether a number is even or not.

num= int(input("enter the number"))
if num%2==0
   print("Number is even..")
else
   print("Number is odd..")

Output -

enter the number 20
Number is even

elif Statement :

The elif statement enables us to check multiple conditions and execute the specific block of statements depending upon the true condition among them. We can have any number of elif statements in out program depending upon our need. However, using elif is optional.

The elif statement works like an if-else-if ladder statement in C. It must be succeeded by an if statement.

Syntax :

If expression 1:
   #block of statements
elif expression 2:
   #block of statements
elif expression 3:
   #block of statements
else:
   #block of statements

Example 1:

number = int(input("Enter the number"))
if number == 10:
   print("number is equals to 10")
elif number == 50
   print("number is equal to 50")
elif number == 100
   print("number is equal to 100")
else
   print("number is not equal to 10, 50 or 100")

Output:

Enter the number 20
number is not equal to 10, 50 or 100

Example 2:

marks = int(input("Enter the marks"))
if marks > 85 and marks <= 100:
   print("scored grade A")
elif marks > 60 and marks <= 85:
   print("Score grade B+")
elif marks > 40 and marks <= 60: 
   print("Scored grade B")
elif marks >30 and marks <=40:
   print("scored grade C")
else:
  print("fail")

Wednesday 24 March 2021

What is Regular Expression -

It is a way of representing data using symbols. They are often used within matching, searching or replacing algoeithms. Regular expressions enables us to perform the following tasks.
  1. Pattern matching and replaces.
  2. Searching and replace.
  3. Replace
  4. Identifying required number or string.
Text strings get assigned to pattern property of a RegEx object.

Regular Expressions in UFT-

Regular expressions can be used in UFT for identifying objects and text strings with varying values.

Where we use regular expression
  1. Defining the property values of  an object in Descriptive Programming for handling dynamic objects.
  2. For Parameterizing a step.
  3. Creating Checkpoints with varying values.
Using Regular Expressions in UFT-

We can define a regular expression for a constant value, a data table parameter value, and Environment parameter value or a property value in Descriptive programming.

We can define a regular expression in standard checkpoint to verify the property values of an object, we can set the expected value of an object's property as a regular expression so that an object with a varying value can be verified.

We can define the text string as a regular expression, when creating a text checkpoint to check that a varying text string is displayed on our application, for example XML Checkpoint we can set attribute or element values as regular expressions.

RegExp Object

VB Script is providing RegExp object for defining Regular expressions, it provides simple support for defining regular expressions. RegExp comes with predefined properties and methods.

Properties
  1. Global Property
  2. IgnoreCase Property
  3. Pattern Property
Methods :
  1. Execute() method
  2. Replace() Method
  3. Test() Method
Global Property -
Global property  accept two values


























Tuesday 23 March 2021

Working With Files

There are two major Categories of file manipulation- 

1. Creating, Adding, Removing and Reading files

2. Moving, Copying and Deleting Files.

Creating Files

There are three ways to create an empty text file, sometime referred to as a "text Stream"

The first way is to use the CreateTextFile method.

Dim fso, f1
Set fso=CreateObject("Scripting.FileSystemObject")
Set f1=fso.CreateTextFile("C:\testfile.txt",true)

The second way to create a text file is to use the OpenTextFile method of the FileSystemObject object with the ForWriting flag set.

Dim fso,  ts
Const ForWriting=2
Set fso=CreateObject("Scripting.FileSystemObject")
Set ts=fso.OpenTextFile("C:\test.txt",ForWriting, True)

A third way to create a text file is to use the OpenAsTextStream method with the ForWriting flag set.

Dim fso, f1, ts
Const ForWriting=2
Set fso=CreateObject("Scripting.fileSystemObject")
fso.CreateTextFile("C:\test1.txt")
Set f1=fso.GetFile("C:\test1.txt")
Set ts=f1.OpenAsTextStream(ForWriting, True)

Adding Data to the File-

Once the text file is created, add data to the file using the following three steps-

  1. Open the text file.
  2. Write the data.
  3. Close the file.

To Open an existing file, use either the OpenTextFile method of the FileSystemObject object or the OpenAsTextStream method of the File object.

To write data to the open text file, we can use the Write, WriteLine or WriteBlankLines methods of the TextStream object, according to the tasks.

Method                               Task

Write - Write data to an Open text file without a trailing newline character.

WriteLine - Write data to an open text file with a trailing newline character.

WriteBlankLine- Write one or more blank lines to an open text file.

Note

The newline character contains a character or characters (depending on the operating system) to advance the cursor to the beginning of the next line(carriage return/linefeed).Be aware that the end of some strings may already have such nonprinting characters.

Example - write a script to open a file, use all three write methods to add data to the file and then close the file.

Sub CreateFile()
    Dim fso, tf
    Set fso=CreateObject("Scripting.FileSystemObject")
    Set tf=fso.CreateTextFile("C:\testfile.txt",true)
    'writing a line with a newline character
    tf.WriteLine("Testing 1, 2, 3.")
    'Write three newline characters to the file
    tf.WriteBlankLines(3)
    'Write a line
    tf.Write("This is a test")
    tf.Close
End Sub

Reading Files -

To read data from a text file, use the Read, ReadLine and ReadAll method of the TextStream object. The following are describes which method to use for various tasks.

Read - Read a specified number of characters from a file.

ReadLine - Read and entire line (up to, but not including the newline character).

ReadAll - Read the entire contents of a text file

If we use the Read or ReadLine method and want to skip to a particular portion of data, use the Skip or SkipLine method. The resulting text of the read methods is stored in a string which can be displayed in a control, parsed by string functions (such as Left, Right and Mid) concatenated and so forth.

Example- Write a script to open file, write to it and then read from it.

Sub ReadFiles
    Dim fso, f1, ts, s
    Const ForReading = 1
    Set fso=CreateObject("Scripting.FileSystemObject")
    Set f1= fso.CreateTextFile("C:\testfile.txt", True)
    'Write a line
    Response.Write "Writing file"
    f1.WriteLine "Hello World"
    f1.WriteBlankLines(1)
    f1.Close
    'Read the contents of the file
    Response.Write "Reading file" 
    Set ts=fso.OpenTextFile("c:\testfile.txt", ForReading)
    s=ts.ReadLine
    Response.Write "File contents = "&s&"'"
    ts.close
End Sub

Moving, Copying and Deleting Files-

The FSO Object model has two methods each for moving, copying and deleting files.

File.Move or FileSystemObject.MoveFile - Move a file

File.Copy or FileSystemObject.CopyFile - Copy a file

File.Delete or FileSystemObject.DeleteFile - Delete a file

Example -  Create a text file in the root directory of drive C, writes some information to it, moves it to a directory called \tmp, makes a copy of it in a directory called \temp, then deletes the copies from both directories.

Note- before that create directories named \tmp and \temp in the root directory of drive C.

Sub ManipFiles

    Dim fso, f1, f2, s
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f1=fso.CreateTextFile("C:\testfile.txt", true)
    Response.Write "Writing file"
    'Write a line
    f1.Write("This is a test")
    'Close the file to writing
    f1.close
    Response.Write "Moving file to C:\tmp"
    'Get a handle to the file in root of c:\
    Set f2=fso.GetFile("c:\testfile.txt")
    'Move the file to \tmp directory
    f2.Move ("C:\tmp\testfile.txt")
    Response.Write "Copying file to c:\temp"
    'Copy the file to \tmp
    f2.Copy ("C:\tmp\testfile.txt")
    Response.Write "Deleting files"
    'Get handles to files current location
    set f2=fso.GetFile("C:\tmp\testfile.txt")
    Set f3=fso.GetFile("C:\tmp\testfile.txt")
    'Delete the files
    f2.Delete
    f3.Delete
    Response.Write "All Done"
End Sub

Saturday 13 March 2021

Jira

Jira -

Jira is an issue tracking product or a software tool developed by Atlassian, commonly used for bug tracking, Project management and issue tracking tool, it is entirely based on these three aspects. It is widely used in software development and software testing.

The name "Jira" comes from the Japanese word "Gojira" which means Godzilla

Jira is based on Agile Methodology and the current version of jira is 6.

Workflow -

Jira workflow is a set of activities performed to track and transition of an issue during the Lifecyle of an issue where transition represents the link between the two statuses when an issue moves from one status to another status and status determines the impact of the work on an issue filed by the tester.

The following are the phases that occur in a workflow-

  1. TODO
  2. In Progress
  3. Done

The Jira workflow is known as defect lifecycle or bug lifecycle. The bug Lifecyle consists of the following phases.

Open Issue- When the issue is created by the tester, then the issue is assigned to the software developer and they start working on it.

In Progress - This is the phase where the software development start working on the issue,

Resolved issue - When the issue is resolved by the software developer and waiting for the verification by the software tester. If the verification is successful, then the issue is closed, otherwise the issue gets reopened.

Reopened Issue - If the verification is  unsuccessful, then the issue is reopened and assigned to the software developer.

Close Issue -  If the verification of the fixed bug is successful,, then the issue is closed by the tester.

Project_Management_Tools

  1. HP-ALM
  2. JIRA
  3. qTest


Friday 12 March 2021

Jenkins

Jenkins

Jenkins is an open source tool with plugin built for continuous integration purpose. The principle functionality of  Jenkins is to keep a track of version control system and to initiate and monitor a build system if changes occur. It monitors the whole process and provides reports and notification to alert.

Continuous Integration -

In software development, multiple developers or teams work on different segments of same web application so we have to perform integration test by integrating all modules. In order to do that an automated process for each piece of code is performed on daily bases so that all our codes get tested. This process is known as continuous integration.

Difference between Maven, Jenkins and Ant -

Maven and Ant are Build Technologies whereas Jenkins is a continuous integration tool.

Features -

  1. Free and Open source
  2. Excellent community and documentation
  3. Exhaustive set of plugins and Integration
  4. Easy to set up, install and use on any platform because it is based on Java
  5. Supports distributed builds due to master slave architecture, thus reducing the load on the CI Server.

How did Jenkins come into existence -

Originally called Hudson, Jenkins came into existence when Oracle took over the ownership to continue development of the product, by renaming it as Jenkins.

Relation Between Hudson and Jenkins -

Hudson was the earlier name and version of current Jenkins. After some issue, the project name was changed from Hudson to Jenkins.

Requirement for Using Jenkins -

For Using Jenkins, we have to need a source code repository which is accessible. For example, a Git repository and q working build script. e.g.. a Maven script, Checked into the repository.

How is continuous integration achieved using Jenkins -

  1. All the developers commit their source code changes to the shred Git repository. 
  2. Jenkins server checks the shared Git repository at specified intervals and detected changes are then taken into the build.
  3. The build results and test results are shared to the developers.
  4. The built application is displayed on a test server like selenium and automated tests are ran.
  5. The clean and tested builds is deployed to the production server.

What is DevOps and in which stage does Jenkins fit in -

DevOps is a software development practice which blends software development(Dev) with IT Operation(Ops) making the whole development lifecycle simpler and shorter by constantly delivering builds, fixes, Updates and features. Jenkins play's a great role because it helps in the integration by automating the build, test and deployment process.

Can we start Jenkins using Command line -

Using jenkins.exe start

Groovy -

Groovy from Apache is a language for java platform. It is the native scripting language for Jenkins. Groovy based plugins enhance Jenkins with great interfaces and builds reports that are dynamic and consistent.

SCM

The SCM or Source Code Management tools Jenkins supports are SVN, Clearcase, CVS, Git, AccuRev, Perforce, RTC, Mercurial.

Job -

A job or build job is a task or step in the entire build process. It could be compiling the source code, running unit tests, deploying the application to the web server and so on.










Data Types

Python Data Types :

Python is a dynamically typed language, we do not need to define the type of the variable while declaring it. The interpreter implicitly binds the value with its type.

Python enables us to check the to check the type of the variable used in the program. Python provides us the type() function, which returns the type of the variable passed.

Examples :

a=20

b="Hai Python"

c=12.9

print(type(a))       O/p- int

print(type(b))       O/p- str

print(type(c))       O/p- float

Standard Data types :

A variable can hold different types of values. like a person's name must be stored as a string whereas its id must be stored as an integer.

Python provides various standard data types that define the storage method on each of them. following are data types defined in python.

  1. Numbers
  2. Sequence Type
  3. Boolean
  4. Set
  5. Dictionary

Numbers :

Numbers stores numeric values. The integer, Float and complex values belongs to Python numbers data-type. Python provides the type() function to know the data type of the variables. 

isInstance() - it is used to check an object belongs to a particular class.

Python creates number objects when a number is assigned to a variable.

Example:

a=10
print("the type of a",type(a))

b=15.98
print("The type of b",type(b))

c=2+4j
print("The type of c",type(c))
print("c is a complex number", isinstance(2+4j,complex))

Output-

The type of a int

The type of b float

The type of c complex

c is complex number: True

Python supports three types of numeric data.

Int - Integer value can be any length such as integers 1,2,23,59...-150 etc. Python has no restriction on the length of an integer. Its value belongs to int.

Float - Float is used to store floating point numbers like 1.5, 9.9, 43.4 etc. It is accurate up to 15 decimal points.

Complex - A complex number contains an ordered pair i.e x+iy where x and y denote the real and imaginary parts, respectively. The complex numbers like 3.13j, 4.0+3.4j etc. 

Sequence Type :

String - The string can be defined as the sequence of characters represented in the quotation marks. In Python, we can use single, double and triple quotes to define a string.

String handling in python is straightforward task since Python provides built-in functions and operators to perform operations in the string.

+ - The + operator is used to concatenated two strings as the operation "Hi"+"Python" it returns Hi Python.

* - The operator * is known as a repetition operator as the operation "Python"*2 it returns ' Python Python'.

Example :

str = "String using double quotes"
print(str)
        
M=""' A multiline
     String'""
print(s)

Output

String using double quotes
A multiple
String


















































Sunday 7 March 2021

Selenium

Automation Testing :

Automation testing enables the use of specialized tools to automate the execution of manually designed that cases without any human intervention. Automation testing tools can access the test data, controls the execution of tests and compares the actual result against the expected result. consequently, generating detailed test reports of the system under test.

Automation testing used automation tools to write and execute test cases, no manual involvement is necessary for executing an automated test suite. Testers prefer automation tools to write test scripts and test cases and then group into test suites.

Selenium -

Selenium is a suite of various tools that are used explicitly for automated web testing purposes. Its compositions have Selenium IDE, WebDriver, RC and Grid.

Components

Selenium is an automation testing tool, it is a package of several tools and it is a testing suite. Selenium suite has the following components.

Selenium IDE - Distributed as a Firefox plugin, Selenium IDE serves as a record and playback tool.

Selenium Grid - Allows distributing test execution across multiple platforms and environment's concurrently.

Selenium RC - A server that allows users to create test scripts in a desirable programming language. Selenium RC also permits executing test scripts across a diverse range of web browsers.

Selenium WebDriver - Communicated directly with the web browser in addition to using its native partibility to automate.

Difference in Selenium 2.0 and Selenium 3.0 from Selenium

Selenium 2.0 has consolidated selenium RC and WebDriver to make a single tool, while Selenium 3.0 is the latest version which has Beta 1 and Beta 2 updates.

WebDriver API's :

The list  of WebDriver API's which are used to automate browser includes :

  1. AndroidDriver
  2. ChromeDriver
  3. EventFiringWebDriver
  4. FireFoxDriver
  5. HtmlUnitDriver
  6. InternetExplorerDriver
  7. IPhoneDriver
  8. IPhoneSimulatorDriver
  9. RemoteWebDriver
Types Of Locators
A locator is a kind of address that offers a unique way of identifying a web element on the
webpage. Selenium has a range of locators to identify different elements of a webpage, namely :

  • ClassName
  • CSS Selector
  • DOM
  • ID
  • LinkText
  • Name
  • PartialLinkText
  • TagName
  • Xpath

XPath - XPath is a type of locator in selenium that is used to locate a web element based on its XML Path. XML denotes Extensible Markup Language, which is used for storing, Organizing and transporting arbitrary data. Much like HTML tags, XML stores data in a key value pair. Since HTML and XML both are markup languages, XPath can be used for locating HTML elements on a webpage. The underlying principle of XPath is traversing between several elements across the entire webpage and allowing them to find an element with the reference of some other element.

Single Slash - /  - The Single slash is used to create XPath with the absolute path. In absolute path, the created XPath will start selection from the document node or the start node.

Double Slash - // - The Double slash is used for creating XPath with the relative Path. In the relative path, the created XPath can start selection from anywhere within the entire web document.

Types of Waits :

Implicit Wait - Used for providing a default waiting time between each successive test step or command across the entire test script. Hence, the next test step or command will only execute when the set default waiting time, say 30 seconds, have passed since the execution completion of the previous test step or command. Can be applied to a particular instance or several instances.

Explicit Wait - Used for halting the execution until the occurrence of a particular condition or till the elapsing of the maximum time applied for a particular instance only.

Object Repository in Selenium

The term Object Repository refers to the collection of web elements that belong to AUT (Application Under Test) and their locator values. A corresponding locator value can be populated from the Object Repository whenever an element is required within the script..

Instead of hardcoding locators within the scripts, they are stored in a centralized location using Object Repository. Typically, the objects are stored in an excel sheet in selenium with acts as the Object.

Launching the Web Browsers  Using WebDriver

The syntax used for launching Google Chrome, Mozilla Firefox and Internet Explorer using WebDriver is respectively.

WebDriver driver=new FirefoxDriver();
WebDriver driver=new ChromeDriver();
WebDriver driver=new InternetExplorerDriver();

Finding An Elements on Web Browser

The WebDriver components of the selenium suite facilitates checking the visibility of web elements, which can be buttons, checkbox's, drop boxes, labels, radio buttons, etc... WebDriver allows doing so with the following three methods.

isDisplayed()
boolean buttonPresence = driver.FindElement(By.id("id")).isDisplayed();

isEnabled()
boolean searchIconEnabled = driver.findElement(By.id("id")).isEnabled();

isSelected()
boolean buttonSelected = driver.findElement(By.id("id")).isSelected();

Getting Text of web element :

In order to retrieve the inner text of a specified web element, selenium offers the get command. It returns a string value and doesn't require any parameters. Get command is one of the most widely used commands for verifying errors, messages etc.. 

Syntax :

String Text = driver.findElement(By.id("text")).getText();

Clicking An Hyperlink Using its Text :

The following command finds a specified element using the  linkText()  method and then clicks on that element to redirect the user to the corresponding webpage :

driver.findElement(By.linkText("Google")).click();

Another command that can be used for the same purpose is :

driver.findElement(By.partialLinkText("Goo")).click();

Difference between driver.close() and driver.quit() commands :

The close() method closes the currently accessed window by the WebDriver. Neither does the command requires any parameter nor does it returns any value.

The quit() method is used for closing down all the windows opened by the program. The quit() method doesn't require any parameter not does have any return value type.

Handling Web - based Pop-Ups

WebDriver allows handling web based popups via the Alert interface. The general syntax.

Alert alert = driver.switchTo().alert();
alert.accept();

Following are 4 methods are available for handling the web based popups namely :

String getText() - Returns text displayed on the alert box.
void accept() - Clicks on the "OK" button as soon as the pop up appears.
void dismiss() - Clicks on the 'Cancel' button as soon as the pop up appears.
void sendkeys(String stringToSend) - Inputs a specified string pattern in the alert box.

Navigation Commands -

Selenium supports a total of 4 navigation commands, listed as follows.

navigate().back() - Takes the user back to the previous webpages as per the web browser history.
Requires no parameters.

navigate().forward() - Navigates the user to the next webpage in the web browser history.
Requires no parameters.

navigate().refresh() - Reload all the web elements by refreshing the current webpage.
Requires no parameters.

navigate().to() - Lets the user launch a new web browser window and navigate to the specified URL given as a parameter.

Assertion

The role of Assertion in Selenium is to act as a verification point. It helps in verifying the state of the application that conforms to expectations.

There are three types of Assertion in Selenium which include the followings :
  1. Assert
  2. Verify
  3. WaitFor
Assert - Assert commands helps in checking if the element is on the page or not. The test will fail in case of missing the required element and will get terminated.

Verify - Verify commands helps in checking the element is on the page or not but will not terminate but will continue ahead on executing all the commands.

Exceptions

There are  different exceptions in Selenium WebDriver which includes.
  1. TimeoutException
  2. WebDriverException
  3. NoAlertPresentException 
  4. NoSuchElementException
  5. NoSuchWindowException