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, 29 October 2019

Regular Expressions in UFT

Regular expressions are the combination of wild cards and characters which is used to perform pattern matching.

It is string that provides a complex search phrase(is an expression consisting of one or more words.)

Uses of Regular expression is Scripting.

1. Test for a pattern withing a string - To check for existing of substring is a string. For example we can test an input string to see if a telephone number pattern or a credit card number pattern occurs withing the string, it is called data validation.

2. Replace Text - To find and replace a string with another string. We can use a regular expression to identify specific text in a document and either remove it completely or replace it with other text.

3. Extract a substring from a string based upon a pattern match- To get a string based on pattern match. we want all the words starting with "A" from a document. In this case we will use regular expression which will create pattern match and will return all words starting with "A".

Note - Regular Expression can be used to find the text strinng valus and objects with varying values. Regular Expression will be helpful when the expected value of any object or string is regularly changing.

In Vb-script we have "RegExp" class which has the following properties and methods.

Properties -

1. Global - It is used to specify pattern matching on given text until end of text.
2. Ignore Case  - It is used to specify case sensitiveness.
3. Pattern - It is used to store expected expression for matching.

Methods

1. Execute - It is used to apply given pattern on givin text and find matched values in text.

2. Replace - It is used to replace matched text with other text. 

3. Test - It is used to apply given pattern on given text for matching. If pattern was matched with text, then this method returns true. 


Properties Syntax:-

Pattern:  It is used to store expected expression for matching.

Syntax:-

set r=new regexp
r.pattern="\w"


Global: It is used to specify pattern matching on given text until end of text.

Syntax:-

set r=new regexp
r.pattern="\d"
r.global=true\false

IgnoreCase: It is used to specify case sensitiveness.

Syntax:-

Set r=new regexp
r.pattern="[A-Z][a-z]"
r.global=true
r.ignorecase=true

Methods Examples:-

Execute():-It is used to apply given pattern on given text and find matched values in text.

Example:-

Set rg=NewRegExp
rg.Pattern="[0-5]+"
rg.Global=True
String1="mno343de5rfdsdfsd105dsfjdk"
Set x=rg.Execute(string1)
ForEach y In x
    MsgBox y.value
Next


Output-
343
5
105

Test:- It is used to apply given pattern on given text for matching, if pattern was matched with text, then this method returns true.

Syntax:-

Set r=NewRegExp
r.Pattern="[0-6]+"
r.Global=True
x="34218943124981"
If r.Test(x) Then
   MsgBox "Data is matched"
   Else
   MsgBox "Mismatch in data"
EndIf

OutPut-


Data is matched
   WildCards-

Dot matches with any single characters. 

Example-  A.B  -- A2B,  APB,  A   B, A&B,   A. B.

{n}-  It matches with, n occurrences of previous characters.

Examples-  

Yaho{2}-----         Yahoo
Go{3}gle----         Google
(Zup){3}------       Zup Zup Zup 

{n,m}- It matches with minimum 'n' occurrences  and maximum 'm' occurrences of previous characters. 

Examples-

Yaho{0,2} -----      Yah
                             Yaho
                             Yahoo

(Ding){1,3}----      Ding
                             Ding Ding    
                             Ding Ding Ding

? -  It matches with Zero(0) or 1 concurrences of previous character.

Examples-  

Dinga{0,1}----      Ding
                            Dinga

- It matches with one or more occurences of previous character which is same as {1,  infinite}

Examples- 

Yaho{1,  }--          Yaho
                            Yahooo
                            Yahooooooooooooooooooo...................................

Yaho+ ---              Yaho
                            Yahooo
                            Yahoooooooooooooo...........................................

 - It matches with zero of more occurence of previous character, which is same as {0,  infinite}. 

Examples

Yaho* ----             Yah
                            Yaho
                            Yahooooooooooooooooooo...........................................

X|Y - It matches with either X(Complete Left Side) or Y(Complete Right Side).

Examples--

F|Wood --              F
                            Woood

(F|W)ood-----        Food
                            Wood

(R|C|B)at ----------Rat
                            Cat
                            Bat

[ABC]  -  It matches with any one of the character.

Examples--

[RCB]at  -----        Rat
                            Cat
                            Bat

Emp[A&B] ---        Emp A
                            Emp &
                            Emp B

[A- Z] - It matches with any one of the letter in the range. 

Examples

Emp [D - H ]  ----- Emp D
                            Emp E
                            Emp F
[0 - 9] - It matches with any one of the digit in the range . 

Examples

Emp[2 - 5] -          Emp 2
                            Emp 3
                            Emp 4
                            Emp5

Count the no of occurrences of a characters in a given string

Dim Str, ChkDup,Cnt,d
Set d = CreateObject("Scripting.Dictionary")
Str = "Community"
For i = 1 to Len(Str)
temp = 0
'Check if the key already exists
If d.Exists(mid(Str,i,1)) Then
    temp = d.Item(mid(Str,i,1)) 'Assign item to temp
    temp = CInt(temp) + 1 'Since temp is string convert to integer
    d.Item(mid(Str,i,1)) = temp 'Update the key
else
    d.Add mid(Str,i,1), 1 'if key doesn't exist, add it
End If
Next
sCharacters = d.Keys ' Get the keys.
iOccurrence = d.Items ' Get the items.
For x = 0 To d.Count-1 ' Iterate the array.
Print sCharacters(x) & " :" & iOccurrence(x)
Next


OutPut:-
C :1
o :1
m :2
u :1
n :1
i :1
t :1
y :1

Count the no of occurrences of string in a given String..?

inputstring = "This String has multiple statements and each statement has multiple occurrences"
Set o1 = new RegExp
o1.pattern = "statement"
o1.ignorecase = true
o1.global = true
Set r1 = o1.execute(inputstring)
msgbox r1.count


Out put:-
2

Monday, 28 October 2019

Text Files in UFT

FSO stands for File System Object. This is used to support text file creation and manipulation through the TextStream object and is contained in the Scripting type library (Scrrun.dll).The FSO Object Model has a rich set of properties, methods and events to process folders and files.

Create a File :

First we want create a FSO object using CreateObject and then create a text file using CreateTextFile.



Dim fso, file, file_location
file_location = “C:file_location”
Set fso = CreateObject(“Scripting.FileSystemObject”)

'True–> file is to be overwritten if it already exists else false
Set file = fso.CreateTextFile(file_location, True)  

Open a file

Set file= fso.OpenTextFile(“C:file_location”, ForWriting, True)

2nd argument can be ForReading, ForWriting, ForAppending
3rd argument is “True” if new file has to be created if the specified file doesn’t exist else false, blank signify false.

Read content from a file :

Using  ReadLine() method, we can read the content of the file.


Example:

Set file= fso.OpenTextFile(“C:file_location”, ForReading, True


'2nd argument should always be “ForReading” in order to read contents from a file
Do while file.AtEndofStream <> True
     data = file.ReadLine()
      msgbox data
Loop


Find the given string  “UFT”  in  line from the text file.

Option explicit
Dim fso,fo,l
Set fso=createobject("scripting.filesystemobject")
Set fo=fso.opentextfile("D:/Sample.txt",1,false)
While fo.atendofstream <> true
        l=fo.readline
        if instr(l,"UFT"then
           print(l)
        end if
wend
fo.close
set fo=nothing
set fso=nothing

Readline ( )-  We can use this method to read current line from file and move control to next line.

Syntax:-  fo.readline( )

Readall( ):- We can use this method to read all lines in the file at a time.

Syntax:-  fo.readall( )

Read( ):-  We can use this method to read specify no:of characters from current line.

Ex:- My name is khan


x=read(4)

Print(x)

o/p: My n


To display the “hi” string lines from the Given test file. ... ?

Option explicit
Dim fso,fo,l
Set fso=createobject("scripting.filesystemobject")

Set fo=fso.opentextfile("D:/Sample.txt",1,false)
While fo.atendofstream <> true
        l=fo.readline
        if instr(l,"hi"then
           print(l)
        end if
wend

fo.close
set fo=nothing
set fso=nothing


OutPut:-
hi how are you.
hey man hi
hey raju hi

To display existing lines in specified text file....?

Option explicit
Dim fso,fo,l
Set fso=createobject("scripting.filesystemobject")
Set fo=fso.opentextfile("D:/Sample.txt")
While fo.atendofstream<>true

       l=fo.readline
          print(l)
 wend
fo.close

set fo=nothing
set fso=nothing


Output:
Hi How are you.
What you doing.
Where are you.

Find the no:of lines in given text file....?

Option explicit
Dim fso,fo,l
Set fso=createobject("scripting.filesystemobject")
Set fo=fso.opentextfile("D:/Sample.txt",1,false)
l=0
While fo.atendofstream<>true
           fo.readline
           l=l+1
wend
Print("no:of lines in the file"&l)
fo.close
set fo=nothing
set fso=nothing


Output:
no:of lines in the file 3

Copy one file text into another file.....?


Option explicit
Dim fso,fo,l,fo1,fo2
Set fso=createobject("scripting.filesystemobject")
Set fo1=fso.opentextfile("D:\Sample.txt",1,false)
Set fo2=fso.opentextfile("D:\Sample1.txt",2,true)

While fo1.atendofstream<>true
      l=fo1.readline
      fo2.writeline(l)
wend
fo1.close

fo2.close
set fo1=nothing
set fo2=nothing
set fso=nothing


Copy numbers in file1 into file2....?

Option explicit
Dim fso,fo,l,fo1,fo2,nums,r,num
Set fso=createobject("scripting.filesystemobject")
Set fo1=fso.opentextfile("D:\Sample.txt",1,false)
Set fo2=fso.opentextfile("D:\Sample1.txt",2,true)

While fo1.atendofstream<>true
      l=fo1.readline
      set r=new regexp
      r.pattern="[0-9]+"
      r.global=true
      set nums=r.execute(l)
      for each num in nums
          fo2.writeline(num.value)
      next
      set nums=nothing
      set r=nothing
wend

fo1.close
fo2.close
set fo1=nothing
set fo2=nothing
set fso=nothing


Copy alphanumeric only from file1 to file2.....?

Option explicit
Dim fso,fo,l,fo1,fo2,nums,r,num
Set fso=createobject("scripting.filesystemobject")
Set fo1=fso.opentextfile("D:\Sample.txt",1,false)
Set fo2=fso.opentextfile("D:\Sample1.txt",2,true)

While fo1.atendofstream<>true
      l=fo1.readline
      set r=new regexp
      r.pattern="[0-9]+[a-z]"
      r.global=true
      set nums=r.execute(l)
      for each num in nums
          fo2.writeline(num.value)
      next
      set nums=nothing
      set r=nothing
wend

fo1.close
fo2.close
set fo1=nothing


set fo2=nothing
set fso=nothing


Copy dates in file1 into file2. Here date is “mm/dd/yy” ...?

Option explicit
Dim fso,fo,l,fo1,fo2,nums,r,num
Set fso=createobject("scripting.filesystemobject")
Set fo1=fso.opentextfile("D:\Sample.txt",1,false)
Set fo2=fso.opentextfile("D:\Sample1.txt",2,true)

While fo1.atendofstream<>true
      l=fo1.readline
      set r=new regexp
      r.pattern="(([0][0-9])|([1][0-2]))[/](([0][0-9])|([1][0-9])|([2][0-9])|([3][0-1]))[/][0-9]{2}"
      r.global=true
      set nums=r.execute(l)
      for each num in nums
          fo2.writeline(num.value)
      next
      set nums=nothing
      set r=nothing
wend

fo1.close
fo2.close
set fo1=nothing
set fo2=nothing
set fso=nothing



Monday, 16 September 2019

Script for to Print Even numbers 

For i=1 To 20
    If i mod 2=0 Then
       MsgBox i
    End if
Next

OutPut - 2,4,6,8,10,12,14,16,18,20
    

or

For i=20 To 1 Step-1
    If i mod 2=0 Then
       a=a&" "&i&vbCrLf
    End if
Next
MsgBox a



Print odd numbers

For i=1 To 20
    If i mod 2<>0 Then
       Print i
    End if
Next


Out Put- 1,3,5,7,9,11,13,15,17,19

Read the Array values at once

Dim myarray(3)

myarray(0)="Raja"
myarray(1)="Ravi"
myarray(2)="Sunil"
myarray(3)="Mahe"

MsgBox myarray(0)

For i=0 To UBound(myarray)
    MsgBox myarray(i)
    a=a&myarray(i)&vbcrlf
Next

MsgBox a


Output- 
Raja
Ravi
Sunil
Mahe

Tuesday, 20 August 2019

Agile Methodology

Agile is an iterative approach to project management and software development that helps teams deliver value to their customers faster and with fewer headaches. Instead of betting everything on a "big bang" launch, an agile team delivers work in small, but consumable, increments. Requirements, plans, and results are evaluated continuously so teams have a natural mechanism for responding to change quickly.

An agile framework is an umbrella term for several iterative and incremental software development approaches such as Scrum and kanban etc..

Agile methodology type has its own unique qualities, they all incorporate elements of iterative development and continuous feedback when creating an application. Any agile development project involves continuous planning, continuous testing, continuous integration, and other forms of continuous development of both the project and the application resulting from the agile framework

Scrum

Scrum typically involves daily standups and sprints with sprint planning, sprint reviews, and retrospectives. There are daily scrums and two- to four-week sprints (putting code into production) with the goal to create a shippable product after every sprint. Daily stand-up meetings allow team members to share progress.

Scrum teams are usually comprised of a scrum master, a product owner, and the development team. All must operate in synchronicity to produce high-quality software products in a fast, efficient, cost-effective way that pleases the customer.

Agile Testing

Agile Testing is a practice that a QA follows in a dynamic environment where testing requirements keep changing according to the customer needs. It is done parallel to the development activity where the testing team receives frequent small codes from the development team for testing.

When do we use Agile Scrum Methodology

1. When the client is not so clear on requirements.
2. When the client expects quick releases.
3. When the client doesn’t give all the requirements at a time.

Sprint

In Scrum, the project is divided into Sprints. Each Sprint has a specified timeline (2 weeks to 1 month). This timeline will be agreed by a Scrum Team during the Sprint Planning Meeting. Here, User Stories are split into different modules. The end result of every Sprint should be a potentially shippable product.

Burn-Up and Burn-Down charts

Burn Down Charts provide proof that the project is on track or not. Both the burn-up and burn-down charts are graphs used to track the progress of a project.

Burn-up charts represent how much work has been completed in a project whereas Burn-down chart represents the remaining work left in a project.

Types of Burn-Down charts

There are four popularly used burn down charts in Agile.

1. Product burndown chart
2. Sprint burndown chart
3. Release burndown chart
4. Defect burndown chart

Product Burndown Chart- A graph which shows how many Product Backlog Items (User Stories) implemented/not implemented.

Sprint Burndown ChartA graph which shows how many Sprints implemented/not implemented by the Scrum Team.

Release Burndown ChartA graph which shows List of releases still pending, which Scrum Team have planned.

Defect Burndown ChartA graph which shows how many defects identified and fixed.

Roles in Scrum

There are mainly three roles that a Scrum team have:

Product Owner -  Product Owner usually represents the Client and acts as a point of contact from the Client side. The one who prioritizes the list of Product Backlogs which Scrum Team should finish and release.

Scrum Master - Scrum Master acts as a facilitator to the Scrum Development Team. Clarifies the queries and organizes the team from distractions and teach the team how to use scrum and also concentrates on Return on Investment (ROI). Responsible for managing the sprint.

Scrum Development Team  Developer’s, QA’s. Who develops the product. Scrum development team decides the effort estimation to complete a Product Backlog Item.

Scrum Team - A cross-functional, self-organizing group of dedicated people (Group of Product Owner, Business Analyst, Developer’s and QA’s). Recommended size of a scrum team is 7 plus or minus 2 (i.e, between 5 to 9 members in a team).

Product backlog & Sprint Backlog

Product backlog is maintained by the project owner which contains every feature and requirement of the product.

Sprint backlog can be treated as subset of product backlog which contains features and requirements related to that particular sprint only.

Velocity in Agile

Velocity is a metric that is calculated by addition of all efforts estimates associated with user stories completed in a iteration. It predicts how much work Agile can complete in a sprint and how much time will require to complete a project.

Re-factoring

Modification of the code without changing its functionality to improve the performance is called re-factoring.

Epic, User stories & Tasks

User Stories:User Stories defines the actual business requirement. Generally created by Business owner.

Task: To accomplish the business requirements development team create tasks.

Epic: A group of related user stories is called an Epic.

Task board in Agile

Task board is dash board which shows progress of the project. It contains:

1. User Story: which has the actual business requirement.
2. To Do: Tasks that can be worked on.
3. In Progress: Tasks in progress.
4. To Verify: Tasks pending for verification or testing
5. Done: Completed tasks.

Daily Stand-up Meeting

Daily Stand-up Meeting is a daily routine meeting. It brings everyone up to date on the information and helps the team to stay organized. Each team member reports to the peers the following:

  1. What did you complete yesterday?
  2. Any impediments in your way?
  3. What do you commit to today?
  4. When do you think you will be done with that?
In general, it’s not a recorded meeting. Reporting will be between peers not to Scrum Master or Product Owner. It is normally timeboxed to a maximum of 15 minutes.


Thursday, 25 July 2019

Introduction


What: -

Python is a high-level object-oriented scripting language. It is designed in a user-friendly manner. Python uses simple English keywords, which is easy to interpret. It has less syntax complications than any other programming languages.


Why:--


Few points that favor Python over Java to use with Selenium.


1. Java programs tend to run slower compared to Python programs.

2. Java uses traditional braces to start and ends blocks, while Python uses      
    indentation.
3. Java employs static typing, while Python is dynamically typed.
4. Python is simpler and more compact compared to Java.

History:-- 

Python is an interpretedhigh-levelgeneral-purpose programming language. Created by Guido van Rossum and first released in 1991, Python has a design philosophy that emphasizes code readability, notably using significant whitespace. It provides constructs that enable clear programming on both small and large scales

Python was conceptualized in the late 1980s. Guido van Rossum worked that time in a project at the CWI, called Amoeba, a distributed operating system. In an interview with Bill Venners1, Guido van Rossum said: "In the early 1980s, I worked as an implementer on a team building a language called ABC at Centrum voor Wiskunde en Informatica (CWI). I don't know how well people know ABC's influence on Python. I try to mention ABC's influence because I'm indebted to everything I learned during that project and to the people who worked on it." 


Guido Van Rossum published the first version of Python code (version 0.9.0) at alt.sources in February 1991. This release included already exception handling, functions, and the core data types of list, dict, str and others. It was also object oriented and had a module system. 

Python version 1.0 was released in January 1994. The major new features included in this release were the functional programming tools lambda, map, filter and reduce, which Guido Van Rossum never liked. 

Six and a half years later in October 2000, Python 2.0 was introduced. This release included list comprehensions, a full garbage collector and it was supporting unicode. 

Python flourished for another 8 years in the versions 2.x before the next major release as Python 3.0 (also known as "Python 3000" and "Py3K") was released. Python 3 is not backwards compatible with Python 2.x. The emphasis in Python 3 had been on the removal of duplicate programming constructs and modules, thus fulfilling or coming close to fulfilling the 13th law of the Zen of Python: "There should be one -- and preferably only one -- obvious way to do it." 

Some changes in Python 3.0:



  • Print is now a function
  • Views and iterators instead of lists
  • The rules for ordering comparisons have been simplified. E.g. a heterogeneous list cannot be sorted, because all the elements of a list must be comparable to each other.
  • There is only one integer type left, i.e. int. long is int as well.
  • The division of two integers returns a float instead of an integer. "//" can be used to have the "old" behaviour.
  • Text Vs. Data Instead Of Unicode Vs. 8-bit.


Tuesday, 18 June 2019

What is Manual Testing

What is Manual Testing ?

Manual Testing is a process of finding out the defects or bugs in a software program. In this method the tester plays an important role of end user and verifies that all the features of the application are working correctly. The tester manually executes test cases without using any automation tools. The tester prepares a test plan document which describes the detailed and systematic approach to testing of software applications. Test cases are planned to cover almost 100% of the software application. As manual testing involves complete test cases it is a time consuming test.

The differences between actual and desired results are treated as defects. The defects are then fixed by the developer of software application. The tester retests the defects to ensure that defects are fixed. The goal of Manual testing is to ensure that application is defect & error free and is working fine to provide good quality work to customers.

Procedure of Manual Testing

  1. Requirement Analysis
  2. Test Plan Creation
  3. Test case Creation
  4. Test case Execution
  5. Defect Logging
  6. Defect Fix & Re-Verification

manual-testing-process