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

Test Estimation : Understanding Test Efforts Calculation

Estimates plays very important role in successful projects as incorrect estimates can lead to time crunches , or improper resource utilization in case of excessive time in estimates.
In this article we will discuss various factors in estimation and how to create good estimates in a testing project.
Before providing estimates, we need to know the requirements of the project. First step before any testing task including test plans and estimates is to know what we are delivering to the client. Once we are clear on the requirements, we need to define the tasks that need to be done as exit criteria for the project. 


We have to answer following points before progressing with estimates:


1.   What is the time required to set-up the basic infrastructure. This includes acquiring resources, testing tools, setting up environment and training requirements of resources.

2.   What are the testing types we are performing in project? Does it include automation testing, API Testing, and other testing types?

3.   What is the Software Development Life cycle followed in the project, i.e. it is agile, waterfall or V-model, if iterative, what is the scope of each iteration.

4.   Is this project new phase of an existing project or a version of existing application to released in the current project.

5.  Techni Experience of resources working in Project. This helps to determine the time for preparing test artifacts.


So Once we know answers to above questions, we need to create a WBS document most preferably in Microsoft Project which helps in defining the tasks with time estimates, resources overloading  and defining milestones in project. Below points should be considered while creating the Work Breakdown Sheet.


1.  First of all create the high level milestone for the project. This can be various phases of the project or iterations of project in and agile methodology.


2.  Now create subtask for each milestones of the project. This will include tasks like test planning, test review, test execution, test data preparation for various forms of testing and regular team meetings.


3.  Task test planning, test review, test data preparation and test execution requires further breakdown of requirements into test scenarios and further into Test cases. Once the requirements are broken down into test scenarios/ test cases, we require estimates for each of the tasks.

Example: 


  • Suppose we have 250 test cases in an application for a particular milestone. We need to define time for test planning, test review, test execution, and test data preparation for each of the test artifact, can be test case for manual execution and test script in automation testing. Automation testing will also include task for framework development.

  • Now divide each of the test cases based on test complexity into high, medium and low complexity. Dividing and allocating time for each test case using test case complexity is very useful in case of large number of test cases where estimates for a particular test case in not feasible and time required for each test case is more or less uniform based on complexity. In this approach, time estimates are provided for test cases based on complexity. For e.g.  10 hours for test case preparation for high complexity, 6 hours for medium complexity, and 4 hours for low complexity.

  • In Point b), we provide test estimates based on complexity and was useful since time for test cases was uniform and there was large set of test cases. 

  • In case the project has 10 requirement of varying complexity, like 1 requirement will take 100 hours and other 2 hours, So Rather providing estimates based on complexity, we can define the estimate based on past experience of users, and provide below time:
    • Min Time to complete the task
    • Worst Scenario Time to complete the task.
    •  Average time to complete the task

  • We can calculate the average of above time to calculate time to complete the task. While providing the estimate as calculated in step c) we must take into consideration resources experience in the application and technology.

4.   We can provide time for each of the tasks in the work breakdown sheet. Summing time for all the activities will give us the test efforts required in the project.


5.   We further need to assign task to different types of resources based on the tasks and can provide resourcing estimates  for the project. we can define the resources utilization during different phases of project .


I will try to cover further in future articles on estimates things I might have missed here.



Creating First Test in Selenium IDE using FireFox

Starting working with Selenium IDE:

1. Before Working with Selenium IDE, we will need to have mozilla firefox installed in the machine.
2. Also plugins and add-ons for using Selenium needs to be installed from selenium official webSite.
3. Once the add-ons are properly installed, To Open Selenium IDE, go to Web Developer>Selenium IDE or Press "Ctrl+Alt+S"


Understanding Selenium IDE

Below Figure explains various components of Selenium IDE



File Menu - File Menu provides the options to create a new test case, test suite, and the test suite can be exported to Ruby/Java/c# Web Driver or Remote Control.
Recording - Recording starts automatically on launching the IDE.
Test Run - Icon to run  all tests or individual tests is available on Selenium IDE
Test Execution Speed - Test execution script can be set as fast or slow as shown  in figure 1.


Creating First Test in Selenium IDE

Recording starts automatically once we launch Selenium IDE, and perform some action on the Firefox browser.Once some action is performed, the action is displayed is command , e.g : Click , Open, etc. Target displays the property of object on which command is to executed and value is value to be set in input.

Assertions and Verification can not be done during recording and needs to be added manually.Difference between assert and verify Commands is test execution stops once assert statement fails but test execution continues to next step if we execute the Verify command, although the test status fails in both cases.

Tips for adding command: 
User is provided with all the possible commands on a object when Selenium IDE is open. 

Steps:
1. Right Click on an object in Firefox browser.
2. Click on Show All Available Commands>Select the required Command.
3. Command will be added in the test.


Adding command to selenium test

How to compare 2 dictionary object and report the differences in QTP results

This post discusses how to compare two dictionary objects and display the difference between the values in two dictionary objects in table format in QTP results using Reporter.logevent.


''function to compare two Dictionaries 

Public Function Comfunct_CompareDictionary(ObjDictBase, ObjDictGen)

Comfunct_CompareDictionary = True 
''Check if both dictionary objects have the same number of items
If ObjDictBase.Count <> ObjDictGen.Count Then
Reporter.reportevent micFail,"Data in Dictionary 1 and 2","Data mismatch in the dictionary. there are " & objDictBase.Count & "records in dictionary 1 compared to " & objDictGen.Count & "records in dictionary 2" 
Comfunct_CompareDictionary = False
Exit Function
End If
''Compare keys and values
arrKeys = ObjDictBase.Keys
''Create a table for the differences
strTable = "<table border=""""2""""><tr><td>Key Name</td><td><Value in Dictionary 1</td><td><Value in Dictionary 2</td></tr>"
For i = 0 to uBound(arrKeys)
''Compare key names in both dictionaries and validate keys in one dictionary exists in other dictionary
  If Not ObjDictGen.Exists(arrKeys(i)) Then
''ObjDictBase has a key which ObjDictGen doesn't have, hence exiting the function
Comfunct_CompareDictionary = False
Reporter.ReportEvent micFail, "Key " & arrKeys(i) & " exists in dictionary 1 but not in dictionary 2, " Key difference in both dictionaries"
Exit Function 
  End If
  ''Compare value of each keys in both dictionary and display the difference between 2 dictionary in Qtp results 
  If ObjDictBase(arrKeys(i)) <> ObjDictGen(arrKeys(i)) Then
''ObjDictBase value for arrKeys(i) differs from ObjDictGen, then log the difference in the table created above
Comfunct_CompareDictionary = False
strTable = strTable & "<tr><td>" & arrkeys(i) & "</td><td>" & ObjDictBase(arrKeys(i)) & "</td><td>" & ObjDictGen(arrKeys(i)) & "/td></tr>" 
  End If
Next
If Comfunct_CompareDictionary = True Then
Reporter.ReportEvent micPass, "Comparision of dictionary 1 and dictionary 2","Both dictionary matches"
Else
strTable = strTable & "</Table>"
''Compare value of each keys in both dictionary and display the difference between 2 dictionary in Qtp results 
Call reportinQTPhtmlContent(strTable)
End If 
End Function


''Function to report in QTP result in table format

Public Function reportinQTPhtmlContent(strTable)
Set objdict = CreateObject("Scripting.dictionary")
objdict.Add "Status", micdone
objdict.Add "NodeName", "Table Data"
objdict.Add ("StepHtmlInfo"), strTable
Reporter.LogEvent "User", objdict, Reporter.GetContext
End function