Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts

Showing posts with label trivial. Show all posts
Showing posts with label trivial. Show all posts

How to capture images and create movie to be saved with QTP

QTP provides options to captures images and record movies of test script execution. User can define the setting for image Capture and screen recorder before test script execution. 

To define settings for images capture and screen recorder, Navigate to Tools>Options>Run>Screen Capture.

Click on Checkbox to save still image captures to results or click on checkbox for save movies to results.


Select whether to save images/capture movies always or only for error as shown below.



Settings for Screen capture in QTP
Settings for Screen capture in QTP

Once test is executed, recorded movie can be viewed in results as shown below



Viewing recorded movie in results
Viewing recorded movie in results

How to create and run a batch file

Batch files help user to execute a set of command to be executed in the defined order by  executing a batch file. We can execute large number of commands in one go using bat file.

Creating a batch file


A batch file has extension .bat .To create a new bat file, we can save a file in text editor like notepad in format .bat.

Some useful batch commands


@echo off – this will not echo the text post the command and will show only the execution result in the command prompt.

@echo on – this will echo the text post the command and will show the command as well as the execution result in the command prompt.

Pause If we use pause, the batch file execution is halted until further intervention of user by pressing keys.

Arguments %1,%2,….. – This gives the parameter for the batch file.

echo val will display val in the command prompt

:: and rem can be used to add remarks to the script

Cls can be used to clear the command prompt


Example :

For e.g we need to compare 2 txt files, but name of files to be compared needs to be passed dynamically and log path also needs to be defined dynamically.

The content of batch file for this will look like

@echo off

Fc %1 %2 /n>%3

Pause

To execute this bat file, we have to write in run as

D:\Sample\new.bat d:\Sample\test4.txt d:\Sample\test7.txt d:\Sample\test9.txt


How to create and run a batch file