Showing posts with label QTP. Show all posts
Showing posts with label QTP. Show all posts

Thursday, 16 May 2013

Extend HP TestResultsDeletionTool.exe for more advanced test result clean up customization by using OTA API with VB scripting


Extend the TestResultsDeletionTool more for advanced deletion customization such as test plan folder/sub folder deletion, test result count constraint deletion etc by using OTA API with VB scripting


Problem

Test executing via Quality Center, 250 testsets, 400 manual scripts which run bi-weekly, and 1000 automated scripts which run nightly leads to tons of test results (since 2010) has been generated and this has indirectly consumes up to GBs of disk spaces in the running environment.

HP's TestResultsDeletionTool can be use to clean up the mess, however I wish to do something more advances like
- Batch cleaning
- Test Plan folder/sub folder cleaning
- Clean up the test result if it has more than 100 counts (to keep results for low frequent execution test cases)

Solution

By using OTA API with VB scripting. VB script can be downloaded by clicking on vbscript.

As TestResultsDeletionTool is using test case as the primary source to delete its run history, hence we need a way to navigate from [Test Case -> Test Set (Test Lab) -> Test Instance -> Run History] to find its way for the clean up

Explanation 1: Below codes is needed to do a cross filter from Test Set to Test Case in order to list out all Test Set that has an instance of Test Case being assigned to.
'filter by test case idSet TestFilter = TestFact.FilterTestFilter.Filter("TS_TEST_ID") = Chr(34) & oTest.ID & Chr(34)            'setup to retrieve test set listSet TestSetFact = objTDConnection.TestSetFactorySet TestSetTreeManager = objTDConnection.TestSetTreeManagerSet TestSetFilter = TestSetFact.Filter            'Set cross filter to filter by test case idTestSetFilter.SetXFilter "TESTSET-TEST", True, TestFilter.Text
'retreive testset listSet TestSetList = TestSetFact.NewList(TestSetFilter.Text)
Explanation 2: Below code is needed to retrieve the Run History count from each test instance in each test of the selected Test Set
ForEach itemTestSet In TestSetList    'print("TestID[" & oTest.ID & "], TestSetName[" & itemTestSet.Name & "], TestSetID[" & itemTestSet.ID & "]")    strTestSetName = itemTestSet.Name    Set TSTestFact = itemTestSet.TSTestFactory    Set TestSetTestsList = TSTestFact.NewList("")    'print(TestSetTestsList.Count)    'Get the total count for the particular test case    'In case total count > 100 (as per define in variable), proceed with the deletion    'Else keep the record, as it is not regularly run                     ForEach testInstanceItem In TestSetTestsList          IfStrComp(testInstanceItem.TestID, oTest.ID, vbTextCompare)=0Then              Set runFactory = testInstanceItem.RunFactory              Set runFactoryList = runFactory.NewList("")              'print("TestSetName[" & itemTestSet.Name & "], TestID[" & testInstanceItem.TestID & "], Instances[" & testInstanceItem.Instance & "], runFactoryList.Count[" & runFactoryList.Count & "]" )              intTotalCount = intTotalCount + runFactoryList.Count          EndIf     NextNext
Explanation 3: Code to trigger TestResultsDeletionTool silently. TestResultsDeletionTool will only works if it is running from the QC Server machine. From observation, if you run from remote machine, nothing will be clean up. Please be aware

The VB script has to call from the machine where the QC
Set wcshell = WScript.CreateObject("WScript.Shell")'Call TestResultsDeletionTool.exestrExeTest = " -Test " & Chr(34) & "[QualityCenter] " & oSubjectNode.Path & "\" & oTest.Name & Chr(34)'print("Deleting test results for --> " & oSubjectNode.Path & "\" & strTestSetName)wcshell.Run strExeDefault & strExeTest, 1, True

Lesson learnt 

N/A

Happy testing!

Tuesday, 11 December 2012

QTP Java Extensibility - Treat particular class as Internal Frame


Problem

Wish to treat particular class to be internal frame

For example, http://dock.javaforge.com/ where wish to treat particular dockable as internal frame

Solution


</code>
public String class_attr return "mdi" 
</code>

This way, QTP treats the docables as internal-frames

Wednesday, 8 August 2012

Solution to 'The QuickTest Java Add-in Extensibility SKD is not supported for 64-bits operating systems

Problem:
As the title clearly mentioned, was hit into trouble when trying to install QuickTest Professional Java Add-in Extensibility SDK in 64 bits machines. Nevermind, here is the solution

Solution:
To make things easy, lets separate the solutions into 2 sections

Preparation:
Unzip skd.zip

Section 1: Install QTP Java Add-in extensibility plugin into Eclipse
  • Assume Eclipse is installed in drive D (fullpath :- D:/eclipse)
  • Create a new folder to store the QTP related add-in (D:/eclipse-thirdparty)
  • In eclipse-thirdparty directory, create a new folder called eclipse (D:/eclipse-thirdparty/eclipse)
  • Copy the features and plugins from sdk folder into D:/eclipse-thirdparty/eclipse
  • Create a new folder called links in Eclipse (fullpath :- D:/eclipse/links
  • In links directory, create a file with link extension (any name will do). For example, quicktest.link with content 'path=D:/eclipse/thirdparty. Refer to more detail on how to deal with plugin Install eclipse plugins the easy way


Section 2: QuickTest Profession (How to manually install add-in in 64 bits operating system)
  • Make sure QuickTest Professional is install in C:\Program Files (x86)\HP\QuickTest Professional
  • Access to C:\Program Files (x86)\HP\QuickTest Professional\bin\java
  • Copy sdk folder into C:\Program Files (x86)\HP\QuickTest Professional\bin\java 
  • Access to C:\Program Files (x86)\HP\QuickTest Professional\bin\java\sdk\eclipse
  • Double click on deploysdkplugins, then point to D:/eclipse and click OK
Happy testing!