Sunday, February 27, 2011

Find a specified requirement in a specified folder: OTA

Work with QC Requirements using OTA API

Public Function GetReqByPath(fullPath$, _
Optional delimChar As String = "\") _
As Req
' This function returns a Req object specified by its
' full path.
' For example:
' Set r = GetReqByPath("SCRATCH\OTA_REQ_DEMO\OTA_S_O_1")
' will return the OTA_S_O_1 object.
' A requirement name is not unique in the project, but it is
' unique as a direct child of another requirement.
' Therefore, these routine works by walking down the
' requirement tree along the fullPath until the requirement
' is found at the end of the path.
' If a backslash is not used as the folder delimiter, any other
' character can be passed in the delimChar argurment.

Dim rFact As reqFactory
Dim theReq As Req, ParentReq As Req
Dim reqList As list
Dim NodeArray() As String, PathArray() As String
Dim WorkingDepth As Integer
On Error GoTo GetReqByPathErr

'Trim the fullPath and strip leading and trailing delimiters

fullPath = Trim(fullPath)
Dim pos%, ln%
pos = InStr(1, fullPath, delimChar)
If pos = 1 Then
fullPath = Mid(fullPath, 2)
End If
ln = Len(fullPath)
pos = InStr(ln - 1, fullPath, delimChar)
If pos > 0 Then
fullPath = Mid(fullPath, 1, ln - 1)
End If

' Get an array of requirements, and the length
' of the path
NodeArray = Split(fullPath, delimChar)
WorkingDepth = LBound(NodeArray)

' Walk down the tree
'tdc is the global TDConnection object.
Set rFact = tdc.reqFactory

For WorkingDepth = LBound(NodeArray) To UBound(NodeArray)
'First time, find under the root (-1)
'After that, under the previous requirement found: ParentReq.ID

If WorkingDepth = LBound(NodeArray) Then
Set reqList = rFact.Find(-1, "RQ_REQ_NAME", _
NodeArray(WorkingDepth), TDREQMODE_FIND_EXACT)
Else
Set reqList = rFact.Find(ParentReq.ID, "RQ_REQ_NAME", _
NodeArray(WorkingDepth), TDREQMODE_FIND_EXACT)
End If
' Delete parent. Each loop has to find it again.
Set ParentReq = Nothing
Dim strItem, reqID&, strID$, thePath$

For Each strItem In reqList
' The List returned from ReqFactory.Find is a List
' of strings of format ID,Name.
' For example "9,Products/Services On Sale"
' Extract the ID from the string by splitting the
' string at the comma.
pos = InStr(strItem, ",")
strID = Mid(strItem, 1, pos - 1)

' Convert the ID to a long, and get the object
reqID = CLng(strID)
Set theReq = rFact.Item(reqID)

'Now check that the object is at the correct depth.
'If so, we've found the requirement. On the next loop,
'we'll look from here down.
thePath = theReq.Path
PathArray = Split(thePath, "\")

' Debug.Print "Number of elements is " & UBound(PathArray)
' Debug.Print theReq.ID, theReq.Name

If UBound(PathArray) = WorkingDepth Then
Set ParentReq = theReq
Exit For
End If
Next strItem
If ParentReq Is Nothing Then Exit For
Next WorkingDepth
Set GetReqByPath = ParentReq
Exit Function

GetReqByPathErr:
ErrHandler err, "GetReqByPath"
Set GetReqByPath = Nothing
End Function

How to Use Filter method to filter the results (Bug Factory)

Connect to Bug Factory object using OTA API

Sub BugFilter()
Dim BugFact As BugFactory
Dim BugFilter As TDFilter
Dim BugList As list
Dim theBug As Bug
Dim i%, msg$

'Get the bug factory filter
'tdc is the global TDConnection object.
Set BugFact = tdc.BugFactory
Set BugFilter = BugFact.Filter

'Set the filter values
BugFilter.Filter("BG_STATUS") = "Closed"
BugFilter.Order("BG_PRIORITY") = 1
MsgBox BugFilter.Text

'Create a list of defects from the filter
' and show a few of them
Set BugList = BugFilter.NewList
msg = "Number of defects = " & BugList.Count & Chr(13)

For Each theBug In BugList
msg = msg & theBug.ID & ", " & theBug.Summary & ", " _
& theBug.Status & ", " & theBug.Priority & Chr(13)
i = i + 1
If i > 10 Then Exit For
Next
MsgBox msg
End Sub

How to Connect to Quality Centre using OTA API

Connect to Quality Center using OTA API

Private Function makeConnection(ByVal qcHostName$, qcDomain$, qcProject$, _
qcUser$, qcPassword$, Optional qcPort) As Boolean
'------------------------------------------------------------------------
' This routine makes the connection to the gobal TDConnection object,
' declared at the project level as Global tdc as TDConnection,
' and connects the user to the specified project.
'-----------------------------------------------------------------------
Dim qcServer As String
Const fName = "makeConnection" 'For error message

On Error GoTo makeConnectionErr
errmsg = ""

'Construct server argument of format "http://server:port/qcbin"
qcServer = "http://" & qcHostName

If Not (IsMissing(qcPort)) Then
If Len(qcPort) > 0 Then qcServer = qcServer & ":" & qcPort
End If

qcServer = qcServer & "/qcbin"

errmsg = "Failed to create TDConnection"
If (tdc Is Nothing) Then Set tdc = New TDConnection
If (tdc Is Nothing) Then GoTo makeConnectionErr
errmsg = ""
tdc.InitConnectionEx qcServer

'Log on to server
tdc.Login qcUser, qcPassword

' Connect to the project and user
tdc.Connect qcDomain, qcProject
makeConnection = SUCCESS
Exit Function

makeConnectionErr:
ErrHandler err, fName, err.Description & vbCrLf & errmsg
makeConnection = FAILURE
End Function

Here you can customise this to be a public function and create an object as in QcObject to connect to Quality Centre and set it to Nothing once the job is done. Some issues I have encountered while working with OTA API is if you keep connected to the object and working away for long time, you may get Automation Error: suggesting Quality Centre connections is no more available or something similar to this. Its always suggested to connect to it before performing an operation and close the connection once the job done and so on.

Saturday, February 26, 2011

QA role in an Agile Environment

How best QA should work with Scrum team (Development + others) and Scrum Master in an agile environment?

Well this is a very big complicated question. An arguable & debatable topic. As one can assume all the time, if not, most of the times, QA gets the blame for what they can not do. CODE WELL. If something goes wrong its always the QA who gets the blame for it. Well reason is simple, every project that goes live must have been tested by QA and if it doesn't work well, QA gets the blame saying why you didn't catch it in the first place? whether its a developer's fault not to code to fit to the requirements, or QA has no time to test it, or whatever. It doesn't really matter. At time when managers turn back to Development team, you would also listen to few complaints to do with the coordination between QA & Development. Because QA didn't work well with us, we can not finish the project - umnn.. It doesn't sound so nice. All these things are unprofessional.

I think - Its a communication issue.
I think team should be made aware of what all tasks that QA should do, what're they responsible for and what should they deliver etc Same way for development as well.



PhaseQA responsibilities should include
Sprint PlanningThere's only 1 thing QA can do. Be Vocal. Suggest the scrum master that with the current team capacity we can only do x number of stories. Look at a bigger picture of every story that's being planned for this sprint. Ensure most if not, all stories are testable. Plan resources for the amount of stories. Take in only what you can deliver. Its better to keep the velocity taking a moderate spike then a sudden spike that results in losing the quality - Warn about this fact.
Kick-off Meeting Think of whom to assign a story to. If possible, rotate the people from 1 functional area to other for every 3 - 4 sprints. This allows testers to have a bigger picture of business arena that is required.
Implementation Write tests as soon as the sprint starts. May be you use QC to write tests. Print these tests off. Sit with the developer & the product owner/ Business Analyst and agree with the developer to pass these tests by writing unit/ integration tests before handing over to QA for test. Business Analyst/ Product Owner is required in this meet to make sure your tests are a comprehensive list of acceptance tests.

Once step-1 is done, Dev is ready to code to pass the acceptance tests. QA is ready to start automating the tests. use proper tools to automate. Well there's loads of other issues that you might encounter if you want to automate in an agile environment that should be a separate discussion altogether
QA Testing This might start on the 1st day or 2nd day or any day during the sprint because we work in an agile environment, there's no separate time schedule rather once development is done QA will be done on that particular piece of work. When you QA this other pieces of functionality might still be under development.

Responsibility of tester when code dropped in to is to test it from a system perspective, raise defects. Catch: Every time you raise a defect analyse why this issue was not caught in the unit/ integration tests that dev created? Ensure this is included in Dev tests if its not already done so!

Well after all this is done, QA will sign off on individual features.

Thursday, February 17, 2011

What is OTA? How to use OTA API? What all are possible with OTA API?

Quality Centre is a HP product, well before was HP it was owned by Mercury. Well this product is basically used by QA Organization with in a company as a Test Management Tool. Most of the organizations use this. However there could be a scenario where a particular project requires to use some other tool to log defects/ bugs. For ex: a project running in an Agile development environment that may use BugZilla for example, so development using 1 tool and QA using its organization specific QualityCentre may not be possible or in other words its hell a lot of work to enter bugs in to both the tools & keep them in sync as the project goes along.

To handle those scenarios QualityCentre comes with an API that a project can use to sync up other tools with QualityCentre. This API is called Open Test Architecture (OTA). You may notice QuickTest Professional and Quality Centre also uses this API to speak to each other. Another example is, people exporting bulk tests/  defects/ requirements in to QualityCentre from excel. This process also uses OTA in the background. However for this API the entry point is TDconnect.exe. You can download this exe file from internet by google'ing for it. Once you install this you will have the flexibility to use this in Excel or use the references/ API's in any other programming languages.

This way user can directly play with the database that the Quality Centre is running on without opening the GUI for it. You can literally perform every function that you can perform by logging on to its console, like
  • Logging in to QC
  • Find specific details about a Defect/ Requirement/ Test/ TestSet
  • Filtering Tests/ defects/ Requirements etc
  • Perform CRUD operations on Requirements/Tests/ TestSets/ Runs/ Defects etc
  • Also create links between Requirements > Tests, Tests > TestSets, TestSets > Defects and so on
You name it, you got it. Everything that you can manually on Quality Centre can also be done programatically using this API.

In order to perform most of the above mentioned stuff you would need to know the database structure/ schema so you know which table, which column to hit to get a value associated with a particular field in QC. Database schema is all open for everyone to know and is available on-line as well.

If you have Quality Centre installed on your machine, you can find the OTA reference guide, OTA database guide, and OTA custom type help files in your help folder. Alternatively, you can hit Help and then go to documentation page where you should get all this documentation ready available for you to either reference or download. In these help files you should see a good set of examples for each and every class module that we can use. an Example code to connect to QC is found as below:


Reference: OTA COM 9.0 Type Library

Note: You can find a list of open source tools that're currently available by searching for them on the internet. I found this link on the net http://www.software-pointers.com/en-defecttracking-opensource-tools.html

Sunday, February 6, 2011

Quality Centre: All about it

Quality Centre is a test management tool that provides a web interface to manage the test cases from
Writing the Requirements (Requirements Module is used to tracker requirements),
Planning tests for those requirements (Test Plan module is used to track the tests associated with a requirement),
Executing the tests (Test Lab module is used to track the execution of tests and associated defects),
Defects (Defects module is used to track the execution of defects raised while executing the tests in Test Lab)


Note: as a tester you're not expected to know the technical information of where the quality centre application is deployed & which server it is running on rather your QC Admin will provide you with a log-in credentials as soon as you join the company and you will soon find all the details about in no time.


Quality Center Login Procedure:


Quality centre is a quality management tool that is widely used to manage the test planning, execution and Defects. User can write a requirement, create tests for that particular requirement, run the tests and create defects thus completing a test cycle using Quality Centre.

Typically quality centre can be accessed using a link provided by your QC administrator. It could be something like http://localhost:8080/qcbin/start_a.jsp or http://localhost:8080/qcbin/start_a.html depending on the deployment server etc

Here localhost is server address, 8080 is the port number where the application server is running. It could be something like http://qc.companyname.com/qabin/start_a.html where companyname is the company you're working for.

Steps to follow to start working on QC are:
1. Obtain the link to access QC from your team lead or if you have access to QC administrator
2. Obtain authentication details from the above mentioned people
3. Obtain the Domain name & Project name that you should use to see ONLY your project. You can find this information from your project lead
4. Access the link obtained for QC by entering in to a IE browser & hit Enter. Remember, QC can not be accessed in Firefox or Chrome or any other latest browsers. Make sure the browser you're using is in the list of compatible browsers
5. Now enter userID, Password and click Authenticate button. This would enable Domain, Project combo-box where user can select the correct project name, domain name to which he has access to. Click Login button to complete Login

User Interface & Architecture: Depending on your installation, you may see the modules like Cycles/ Releases, Requirements, Business Components, Test Plan, Test Lab, Defects.

Business components module is used only when required in addition to other modules. This is completely installation based. This is widely/ specifically used in SAP based application testing, however this is not limited to only SAP application testing.


Write Requirements:

How and where do we write requirements in Quality Centre
Requirements module will consist of a space available for user to create a requirement or user story so user can plan writing tests in Test Plan module specific to an already existing requirement. A Typical requirements module will look like below (screen shot taken from Hp's website for reference)
Writing a requirement would require the following details. Number of mandatory fields would be installation based. 
  1. Name: Name of the requirement. This could be unique description or a brief description of what is this requirement for?
  2. Author: Who actually created this requirement? This is field will get populated automatically with the user ID with which the user is logged in to Quality Centre
  3. Creation Date: The Date on which this requirement was initially created
  4. Creation Time: Time on which this requirement was initially created
  5. Modified: Last modified date/time value. Automatically gets populated as soon one of any fields of the requirements is updated. This log is maintained and is available to view under History TAB
  6. Priority: Priority of the requirement. It could be something like 1 - Urgent, 2 - Major, 3 - High, 4 - Medium, 5 - Normal etc. This could vary from 1 installation to the other
  7. Req Id: An automatically populated field. This is a unique ID for every requirement created in the database
  8. Description: a details description of the requirement giving full details from A to Z
  9. Req Type: Type of the requirement is something to suggest whether this requirement was initiated/ taken from? Example, business requirements document or a user story taken from acceptance criteria set in the product's system requirement specification and so on
  10. Product: which product this requirement belongs to? there could be a number of projects/ products running in a company. To differentiate the requirements from 1 specific product area to the other
  11. Reviewed: who reviewed this requirement as to certify this is right
  12. Targert Release: release name under which this requirement is set to be released? Ex: In a waterfall model it could be something like "April 2012" or if its in an agile environment it could be something like "Sprint 25"
  13. Targert Cycle: In which cycle you would expect this to run thru? Ex: Regression Cycle, or Cycle4 or Sprint12 etc

You can find more about requirements module available in HP's Quality Centre module at the following link  https://h10078.www1.hp.com/cda/hpms/display/main/hpms_content.jsp?zn=bto&cp=1-11-127-24^37802_4000_100__

Saturday, November 27, 2010

Testing Tools: Different tools used for Testing

Depending on the size of the company, testing is done using various tools for each phase of testing.

Quality Management Tools:
Quality Center (9.2+) - Latest version available is 11. You can actually download a copy of it from HP's BTO software website. Most of the medium to big organizations do use HP's Quality Centre for writing and running tests
Note: For version 11 onwards this is more referenced as Application Life Cycle Management software - ALM
Microsoft Excel - for writing test cases
Microsoft Word - for writing test plans and test strategy document

Test Tools:
SOAP UI: for making web service requests and to verify the responses coming back
QTP: for automating the regression tests & create a regression suite that can be run continuously
Test Complete: for automating the regression suites
Load Runner: for load testing purposes
Win Runner: for automating the regression suites. Most of the places is now replaced by QTP
Fitnesse: to test individual methods or classes. Generally used to Unit test, or may be used for integration testing purposes. Mostly used by development in Agile development projects
Selenium: to perform integration or system test on web application using specific technologies. Can not run on all platforms/ applications. Mostly used in agile development projects

and so on..there's no end to this because of wide variety of projects and environment today's projects running on