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.

Sunday, 10 February 2019

UFT with GIT


GIT is a source code management and revision control system. There are various version control system are available, GIT has become very popular lately with its lots of enhanced feature, easy to use, availability and speed.

Basics of GIT: 


Lets understand Version Control System first, a Version Control System allows you and your team to work on the same project simultaneously. It does not allow overwrite the changes and maintains a history of each change. There are two types of Version Control System 

  1. Centralized Version Control System
  2. Distributed Version Control System
GIT is a Distributed Version Control System, it maintains a fully mirrored repository at client which make it distributed and different than centralized one. If any of the server goes down then a copy from client be brought back to restore. Every checkout is the full backup of repository.

GIT is Secure, Powerful, Easy to use , Fast and Free!

There are four main steps to work with GIT
  1. Modify a file in working directory. 
  2. Add files to Staging area
  3. Perform Commit operation to move files from staging area. 
  4. Perform Push Operation to store the changes permanently to the GIT repository
Step by Step integration of UFT and GIT

Step 0: Install GIT and Create Account at GITHub

If you don’t have an account with github, create an account at github.com
Download and install GIT on your System
Configure GIT, Open GIT Bash and run below commands one by one
[gistpen id=”3249″]
Step 1: Create GitHub Repository
Login to your GitHub account which you created, and create a new repository for your test. Here you can create a public or private repository. GitHub charges some amount for private repository. 
Step 2: Clone Repository to Local GIT
It is required to get your repository at GitHub to you local repository and linked. To do this you need to perform clone repository operation either at GIT GUI or GIT Bash.
  1. Create a folder on your system, say “C:\GIT”
  2. Launch GIT GUI and click on “Clone Existing Repository”
  3. Go to your GitHub and Copy the clone path for your repository, this path should be source location  and the folder you created at your local should be the destination
  4. Click on Clone, and your local repository should be ready
Step 3: Create Test


Launch UFT and Create a test in the local repository path, i.e the same path where GIT repository has been initialized. 


If you will notice in the solution explorer, a red exclamation mark has been added to all the file icon, which indicates that the files are currently in you local repository and not yet pushed to the GitHub.

Step 4: Push Test to GitHub Repository

Two easy steps – Commit the changes and then Push the changes. These options are available in the right click menu on the test at Solution explorer. Push Option will be disable at first, which means that you will need to commit the changes first.

Once you have successfully pushed your changes to GitHub Repository, you can open the repository there and see the files from UFT test there.


Wednesday, 6 February 2019

Test Batch Runner Tool in UFT/QTP

Creating  and Running a Test Batch

Relevant for GUI tests and components and API testing.

-Open Test Batch Runner
-Access the test batch file on next page
-Add batches or tests on next page
-Select the tests to be part of the test batch run on next page
-Run the test batch
-View the test batch run results

1. Open Test Batch Runner

Select Start > All Programs > HP Software > HP Unified Functional Testing > Tools > Test Batch Runner. This opens a separate window for the Test Batch Runner program. You do not need to have UFT open to use Test Batch Runner.

2. Access the test batch file

To create a new test batch file, select File > New or click the New batch file button. Give your batch file a meaningful name and assign it to a place in your directory.

To open an existing batch file, select File > Open or click the Open batch file button. In the Open dialog box, navigate to the folder in which the batch file is found and click Open. The tests from the opened batch file are added to the Test Batch Runner main window.

3. Add batches or tests

To add a test batch file (.mtb), select File > Add or click the Add button. Navigate to the folder in which the batch file is saved.

To add individual tests, select Tests > Add or click the Add button. In the Browse For Folder dialog box, select the folder in which your tests are located. All the tests from the selected folder are added to the Tests pane in the main Test Batch Runner window.

Note: When adding tests through the Tests > Add menu command, you must select all the tests from the target folder. If you do not want to run all the tests in the target folder, select the check boxes next to the tests you want to run before you run the test batch.

4. Select the tests to be part of the test batch run.

Select the checkboxes for the tests that you want to include in the test batch run.

5. Run the test batch

Click the Run button to run the test batch. The Output pane provides run log details of the batch run while the batch is running.

6. View the test batch run results

In the Tests pane, click the results link for a specific test in the Run Results column. This opens the results for that test in the Run Results Viewer. For details on the Run Results Viewer, click F1 within the viewer window.


How to Run a Test Batch Using the Windows Command Line

Relevant for GUI tests and components and API testing

-Open the Windows Command Line window.
-Provide the source folder for the batch file or tests.
-Run the test batch.
-View the test batch run results (API testing only).

1. Open the Windows Command Line window

Run cmd.exe to open the Command Line window. (For example, from the Windows Run dialog box.)

2. Provide the source folder for the batch file or tests

In the Command Line window, enter UFTBatchRunnerCMD.exe and the source switch followed by the test batch file (.mtb) or folder containing the test.

For example, your command line might contain text like this:

UFTBatchRunnerCMD.exe -source "C:\users\MySample.mtb"
UFTBatchRunnerCMD.exe -source "C:\users\APITest1"

3. Run the test batch

After entering the Test Batch Runner command and the location of the folder containing your tests, press ENTER. Test Batch Runner runs the test batch. For API tests, the test log is displayed in the command window.

4. View the test batch run results (API testing only)

When the test batch run is complete:

a. Open the Run Results Viewer from the Start menu. The Open Run Results dialog box .
b. In the Open Run Results dialog box, select the Results XML file option.
c. Navigate to the Results.xml file under the test's Report folder and click Open. 
Each test has its own results. 

Monday, 4 February 2019

SAPGuiSession Objects

Close Method: 
Closes the SAP GUI for Windows session without displaying a warning message.

'The following example uses the Close method to close an SAP GUI for Windows session without displaying a warning message.

SAPGuiSession("Session").Close

CreateSession Method:

Creates a new SAP GUI for Windows session for the current connection.

'The following example uses the CreateSession method to create a new SAP GUI for Windows session and then resizes the new window. Note that by creating a new session, a new session object (Session_2) is saved in the object prepository.

SAPGuiSession("Session").CreateSession
SAPGuiSession("Session_2").SAPGuiWindow("SAP Easy Access").Resize 106, 24

Reset Method:

Navigates to the session initial screen or to the specified transaction

'The following example uses the Reset method to reset the SAP GUI for Windows session to the initial session 'window. Then it resets the SAP GUI for Windows session to the VA01 transaction

SAPGuiSession("Session").Reset
SAPGuiSession("Session").Reset "/nVA01"

Sync Method : 

Instructs UFT to wait until the SAP GUI for Windows session is available.

'The following example uses the Sync method to ensure that a second SAP GUI for Windows session (opened by pressing'the "New message" button) is loaded before performing operations on it. (It does this after first having performed several operations on another SAP GUI for Windows session.)

SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SAPGuiOKCode("OKCode").Set "sbwp"

SAPGuiSession("Session").SAPGuiWindow("SAP Easy Access").SendKey ENTER

SAPGuiSession("Session").SAPGuiWindow("Business Workplace").SAPGuiButton("New message").Click

SAPGuiSession("Session_2").Sync

SAPGuiSession("Session_2").SAPGuiWindow("Create Document").SAPGuiEdit("Title").Set "A new message on a different" 

SAPGuiSession("Session_2").SAPGuiWindow("Create Document").SAPGuiButton("Send... (Shift+F8)").Click

Python

  1. Introduction
  2. Data Types
  3. Conditional Statements



Sunday, 3 February 2019

WebList Verification through Keyword Driven

' Capture Weblist contests to a ; separated scripting
tmp = browser("micClass:=Browser").page("micClass:=Page").WebList("html id:=pname").GetROProperty("all items")


' Convert string to array
 wlValues = Split(tmp,";")


' List items
 For i = 0 To UBound(wlValues)
      MsgBox wmValues(i)
 Next