UFT Report is broken - hp-uft

Lately we are getting more and more often confronted with problems with UFT. Many API components can't executed anymore, but there are 2 possible outputs:
UFT gives a message from "object reference not set to an instance of an object" without even starting the test, let alone reporting. The Output Pane contains the following message:
Start
object reference not set to an instance of an object
End
when we execute a test using ALM we get a KeyNotFoundException:
2020-01-22 12:04:38,039 HP.ST.Fwk.ReporterFWK.Reporter [ 1] ERROR Problem in writing Step Xml
System.Collections.Generic.KeyNotFoundException: The specified key was not listed in the dictionary.
For System.Collections.Concurrent.ConcurrentDictionary`2.get_Item(TKey key)
for HP.ST.Fwk.ReportCreator.QTPEngine.Utils.GetNodeInfo(Object stepId, XmlDocument xmlDoc, IReportDataContainer reportData)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateOuterCheckpointsXML(Object stepId, XmlDocument doc, XmlNode node, String innerCheckpointsFileName, String childId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateFileForReferencedValues(XmlDocument doc, XmlNode& reportNode, Object stepId, IReportDataContainer reportDataContainer)
for HP.ST.Fwk.ReportCreator.QTPEngine.CPNodeWriter.CreateXmlFile(Dictionary`2 nodeInfo, Object stepId, XmlDocument doc, IReportDataContainer IReportDataContainer)
for HP.ST.Fwk.ReporterFWK.Reporter.WriteStepToDisk(String stepId, String fileName)
for HP.ST.Fwk.ReporterFWK.Reporter.<>c__DisplayClass36_0.<FlushReport>b__0()
for System.Threading.Tasks.Task.InnerInvoke()
for System.Threading.Tasks.Task.Execute()
We've tried every direction, reinstalling UFT, patching... all to no avail. The behavior seems to be present in both UFT 14.53 and UFT 14.53 Patch 1 - 3. UFT One is also affected.
The UFT support could not help us at all, you know how they are.

Related

Warning- "SAPEdit" description mismatch, " The object was not found using the test object description.Check the object properties

I'm a new entrant to UFT and while i'm trying to access the columns of a webtable, to identify the test object "SAPEdit", UFT takes a longer time and throws a warning "SAPEdit" -description mismatch. The object was not found using the test object description.Check the object's properties. Kindly suggest me a workaround to clear this warning and speed up the test object identification. BTW, i'm not using descriptive programming.
Code follows:
strPENXPath = strTblXPath & "/TBODY[1]/TR[" & iRow & "]/TD[1]/SPAN[1]/INPUT[1]"
Browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Child Care Quota Program_2").SAPEdit("SAPEdit").SetTOProperty "xpath", strPENXPath
oPersonnelNo = Browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Child Care Quota Program_2").SAPEdit("SAPEdit").GetROProperty("value")
If iPersonnelNo <> oPersonnelNo Then
strMessage=strMessage & "Failed -Personnelno Type "
End If
This means that the object's description doesn't match an object in your application.
There are several ways to fix this problem.
Probably the simplest one is to Maintenance Run Mode.
From the Run menu select Maintenance Run Mode... then when UFT will see an object it can't find it will ask you to point at the object and then it will suggest a solution.

HP UFT - WebElement cannot be found even after using correct xpath

I am new to UFT. I have a long "complex" xpath that finds precisely one element in chrome browser developer tools. When I use the same xpath in uft, the tool complains that the xpath is not in the object repository. Why does this happen and how do I fix it ?
This is what the xpath looks like:
//div[#class='a b c']//div[#class='p-q r-s']//div[#class='m n']//button[contains(text(), 'yes')]
I have to use such complex xpath because there are no ID attributes in this part of the page or any other 1-2 attributes which can uniquely identify the element.
Please help.
EDIT: My Vbscript code looks similar to this code:
Dim aButtonLoc
aButtonLoc = "//div[#class='a-b c-d-e g']" & _
"//div[#class='p-q r-s-t']//div[#class='uv w-x']" & _
"//button[contains(text(), 'Yes')]"
Error message: The {full xpath here} object was not found in the Object Repository. Check the Object Repository to confirm that the object exists or to find the correct name for the object.
There is an error in my aButtonLoc locator. It should have xpath mentioned, like this: aButtonLoc = "xpath:=//d...etc."

How can I access the Google Contact 'File As' field programmatically via the API?

I desperately need to access this field in order to develop a Google Contacts sync tool that predominately utilizes the company name as the NAME or FILE AS field, NOT First/Last.
I see it in the XML but no dice via the libraries. I'm using the .NET library.
I figured it out. Here's a little VB.NET code snippet in case anyone else needs to know how to manipulate values not directly exposed by the gData library. This returns the XML node (and creates first it if it doesn't exist). I actually change the value through the innerText property.
Private Function GetFileAsObject() As XmlNode
For Each ext As Object In _contactEntry.ContactEntry.ExtensionElements
If (ext.GetType() Is GetType(XmlExtension)) Then
If ext.XmlName = "fileAs" Then
Return ext.Node
End If
End If
Next
Dim doc As New XmlDocument
doc.LoadXml("<gContact:fileAs xmlns:gContact='http://schemas.google.com/contact/2008'></gContact:fileAs>")
Dim node As XmlNode = doc.DocumentElement
Dim newExt As XmlExtension = New XmlExtension(node)
_contactEntry.ContactEntry.ExtensionElements.Add(newExt)
Return node
End Function
This link helped immensely: http://code.google.com/p/google-gdata/wiki/UnderstandingTheUnknown

EQATEC Profiling Error - An item with the same key has already been added

I seem to be getting this error when I try to profile a specific WP7 project using the EQATEC Profiler
* ERROR: Could not process xap-file MusicApp.xap: An item with the same key has already been added. at
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue
value, Boolean add) at Ionic.Zip.ZipFile.InternalAddEntry(String
name, ZipEntry entry) at
Ionic.Zip.ZipFile._InternalAddEntry(ZipEntry ze) at
Ionic.Zip.ZipFile.AddEntry(String entryName, Stream stream) at
Ionic.Zip.ZipFile.AddEntry(String entryName, Byte[] byteContent)
at EQATEC.AssemblyInjector.Engine.XAP.XAPPackage.Save(XAPPackage xap)
at
EQATEC.AssemblyInjector.Engine.Assembly.AssemblyScout.VisitDirectory(DirectoryInfo
inputdir, DirectoryInfo outputdir, String subpath)
EQATECProfilerEngine.ProcessApp: An item with the same key has already
been added.
Has anyone experienced this or know why this happens? Or perhaps knows a solution?
The new release 3.8.20 of EQATEC Profiler has this fixed. See the release history.
The problem would occur for WP7 or Silverlight apps if the xap-file contained the same file name more than once, maybe even using different path-separators. Here is a real example from another user's xap-file:
Images\Tiles\TileBackground.png
Images/Tiles/TileBackground.png
The profiler would try to add the same file twice to the instrumented xap-file and fail. The new 3.8.20 will now simply skip any further duplicated files. Of course, you probably didn't mean to add the same file twice to your MusicApp.xap so you should check your project for duplicate file entries.

Add item to Error List in Macro

I want to notify the user of the macro if something went wrong during the execution of the macro. I was wondering if it would be possible to add an item to the Visual Studio error list?
It is possible to do so from within an AddIn (like here), but I would like to do the same thing from a macro.
Edit
To further clarify what i want to achive, here is the sample from the Samples macro library (Alt+F8 -> Samples -> Utilities -> SaveView())
Sub SaveView()
Dim name As String
name = InputBox("Enter the name you want to save as:", "Save window layout")
If (name = "") Then
MsgBox("Empty string, enter a valid name.")
Else
DTE.WindowConfigurations.Add(name)
End If
End Sub
Instead of the MsgBox("...") alert I want to put the error into the VS error list.
You can add an item in the Task List easily from your macro. Just use the AddTaskToList method from that article and change m_objDTE to DTE. I've tried it and it worked.
However, adding the item in Error List, is probably impossible. You need to call VS services, see how adding an error is done in an add-in. I created a macro from this code and it didn't work. In general, VS services don't work in macros. I was able to create ErrorListProvider successfully. I could access it's methods and properties. But calling ErrorListProvider.Task.Add caused COM exception. If you want to play with it, several notes:
As described in the article, you need to get 4 assemblies out of the GAC e.g. to c:\dlls\ directory. Since Macros IDE doesn't allow you to browse when you Add Reference, you need to copy these dlls into ...\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies directory (change the 10.0 to your VS version). Then, when you Add Reference in Macros IDE, you should see the assemblies.
The GetService function always returned Nothing. Add the following field to the class:
Private serviceProvider As IServiceProvider = New Microsoft.VisualStudio.Shell.ServiceProvider(CType(DTE, Microsoft.VisualStudio.OLE.Interop.IServiceProvider))
and in GetService function change line:
objService = Microsoft.VisualStudio.Shell.Package.GetGlobalService(serviceType)
to
objService = serviceProvider.GetService(serviceType)
As I wrote, everything seems OK then but ErrorListProvider.Task.Add fails.
I think that for your situation outputting something to your own output pane would be more suitable. The error list is generally used for errors within the project the user is working on, not for errors caused by running macros. Especially when someone says it can't be done. :)
Outputting to your own output pane is pretty easy:
DTE.Windows.Item(Constants.vsWindowKindOutput).Activate()
Dim panes As OutputWindowPanes = window.OutputWindowPanes
Dim my_pane As OutputWindowPane
Try
my_pane = panes.Item("SaveView")
Catch exception As System.ArgumentException
my_pane = panes.Add("SaveView")
End Try
my_pane.Activate()
my_pane.OutputString("Empty string, enter a valid name." + vbCrLf)
Hope this helps.
Cheers,
Sebastiaan
Is this not what you want?
HOWTO: Add an error with navigation to the Error List from a Visual Studio add-in
http://www.mztools.com/articles/2008/MZ2008022.aspx

Resources