Common mistakes by QTP tester

Below are the items to make sure you include to avoid mistakes

1. Capture screen for failure steps: Many times we ignore this and many a times we end up in unable to reproduce it. Its safe to capture a screenshot and save it in a location for future reference and escalation

2. Improper reporting: One need to report after each and every step such that the report should look like a test case with all steps in detail

3. Type casting: While comparing the expected and actual value, the values have to be converted and both of them should belong to the same data type to get compared. Else the step fails though the value is correct

4. Mandate Else block: For each If statement there should be an Else statement to ensure the coverage of all the flows

5. Using on error resume next: Many a times the errors go unnoticed due to this line. Ensure that you use On error go to 0 after the block where you think the error will not occur. Else, you need to comment this line every time you debug the code to identify theh exact error

6. Using of Exit for and exit loop: One should use these statement liberally to improve the performance of the script

7. Use .exist with a timeout ex. broswer().page().exist(3) to improve the performance

8. Check the qtp run status or error number before reporting it to the custom report like excel or html, else the actual report would be failed but the custom report shows pass

9. Always clear the local object repository while using share repository as the objects in local repository will be given preference and properties would change and script would fail

10. Delete the Browser chache each time you start the execution so that the latest/updated files would be downloaded from the server.
 
11. Use print instead of msgbox so that if you miss to delete or comment it, print wouldnt stop the execution.

 

Capture password from email in outlook using QTP


Consider the message by auto sending "Password service" is as below 

Hi User, 

Please find the credentials below. 

User Name is: name597406 
New password is: KI7UJ6$x^3DIwul 

Note: Please change your password as soon as you login into your application 

Thanks & Regards, 
Admin 

Check the "From" field and note the Display name of the sender and let it be "Password Service" 

The code is as below
Dim olFolderInbox, iTotalMails, sSubject
olFolderInbox = 6 : sSubject = ""
 
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
 
'Create reference to Inbox Folder
Set oInbox = objNamespace.GetDefaultFolder(olFolderInbox)
 
'Find all items in the Inbox Folder
Set oAllMails = oInbox.Items
iTotalMails = oAllMails.Count
 
'Loop through the mail items
For i=1 to iTotalMails
  'Check if the mail is UnRead or not
    If oAllMails(i).UnRead = True Then
'        msgbox oAllMails(i).sendername
        If oAllMails(i).sendername="Password Service" then
            res=split(oAllMails(i).Body,"password is: ")
            res1=split(res(1),"Note:")
            msgbox res1(0)
            Exit for
        end if
    
    End If
Next



Log4j implementation

Following are the steps to generate logs for the applications,

Step1: Create one sample project
Step2: Create Package in the project to place java classes
Step3: Download Lo4j jar file from http://logging.apache.org/log4j/1.2/download.html
Step4: Add log4j jar file to the project build path
Step5: Create log4j property file at the project level and add the properties into the file as shown in fig1.

#All==>all messages
#WARN==>only warning message  etc..
log4j.rootLogger=ALL

#log4j.logger.<Package>=,<log file name>FileAppender
log4j.logger.com.pack=,logTestFileAppender

# junit_log4jFileAppender - used to log messages in the junit_log4j.log file.
log4j.appender.logTestFileAppender=org.apache.log4j.FileAppender
log4j.appender.logTestFileAppender.File=logTest.log
log4j.appender.logTestFileAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.logTestFileAppender.layout.ConversionPattern=%d{dd MMM yyyy HH:mm:ss} %-4r [%t] %-5p %c %x - %m%n
 Fig 1: log.properties

Step6: Create one java class in the package
Step7: Create reference variable for logger class as shown in fig2.

public static Logger logger=Logger.getLogger(classname.class)
                Fig2: Reference Variable for Logger Class

Step8: In the main method load the logger properties by using configure() method in PropertyConfigurator Class.
Step9: By using Logger reference variable write info, debug and error etc types of logs as shown in fig3.

Logger.info(“START:: Starting of some XY()”);
Logger. debug(“Values passed to the some XY() are ::  a: ”+a);
 Logger. error(“ERROR:: Error occurred in some XY()”);
                Fig3: Sample code to write info, debug and error logs

Step10:  After completion of code run the project and find the generated logs in the path given in log.propeties for the property log4j.appender.logTestFileAppender.File”.

Example:

package com.pack;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class LogExample {

    public static Logger logger=Logger.getLogger(LogExample.class);
   
    public void test() {
        WebDriver driver=new FirefoxDriver();
        logger.info("Browser Launched");
        driver.get("http://www.gmail.com");
        logger.info("URL Entered");
        logger.debug("Hi");
        logger.fatal("Hello");
    }
    public static void main(String[] args) {
        PropertyConfigurator.configure("log.properties");
LogExample example=new LogExample();
example.test();
    }

}
 

Differences between Quality Assurance and Quality control


Sno
Quality Assurance
Quality Control
1
Quality assurance is a planned and systematic set of activities necessary to provide adequate confidence that products and services will conform to specified requirements and meet user needs.
Quality control is the process by which product quality is compared with applicable standards,
and the action taken when nonconformance is detected.
2
Quality assurance is a staff function, responsible for implementing the quality policy defined through the development and continuous improvement of software development processes.
Quality control is a line function, and
the work is done within a process to ensure that the work product conforms to standards and
requirements.
3
Quality assurance is an activity that establishes and evaluates the processes that produce
products.
Quality control activities focus on identifying defects in the actual products produced. These
activities begin at the start of the software development process with reviews of requirements,
and continue until all application testing is complete.
4
Quality assurance helps establish processes.
Quality control relates to a specific product or service.
5
Quality assurance sets up measurement programs to evaluate processes.
Quality control verifies whether specific attribute(s) are in, or are not in, a specific product or service.
6
Quality assurance identifies weaknesses in processes and improves them.
Quality control identifies defects for the primary purpose of correcting defects.
7
Quality assurance is a management responsibility
Quality control is the responsibility of the team/worker.
8
Quality assurance is concerned with all of the products that will ever be produced by a process.
Quality control is concerned with a specific product.
 
Compiled from CSTE CBOK

2013: Major software failures

2013: Major software failures

Every industry is impacted with software  failures/bugs in 2013. It is very important to perform extensive QA &  testing before release to market to avoid losses

1) Health Care: 
Sebelius admitted that the testing done before the Oct. 1 launch was "clearly not" enough. "We did not adequately do end-to-end testing," she said.

http://www.foxnews.com/politics/2013/10/30/sebelius-to-face-grilling-at-hearing-on-glitch-ridden-obamacare-website-rollout/

2) Airlines:
"Sabre is experiencing a system issue,"

http://www.cnn.com/2013/08/06/travel/sabre-outage-flight-delays/

3) Financial:

A mysterious technical glitch halted trading on the Nasdaq

http://news.yahoo.com/nasdaq-trading-halts-3-hours-due-glitch-203619288.html

4) Retail:

"We experienced a technical error that caused some items to show incorrect pricing," Walmart

http://abcnews.go.com/Business/walmart-super-low-prices-website-glitch/story?id=20804317

5) Payroll:

California sues SAP over payroll system failures

http://articles.latimes.com/2013/nov/21/local/la-me-pc-california-sues-sap-20131121

Compiled by Damodhara Reddy Jammli( DJ)