Contributions
Re: Performance issues after converting JScript project to JavaScript in TC 12
Definately slower. I sent in a report to SmartBear about this on 9/15/2016. Still no improvements in the latest version 12. Here is an excerpt of results from the report. AVG time to iterate through 16 XML elements: Jscript 18.6ms, JavaScript 71.6ms, Python77.9ms AVG time to make 16 log messages: Jscript 48.4ms, JavaScript 354.2ms, Python76.5ms AVG time per log: Jscript 3ms, JavaScript 22.1ms, Python4.8ms AVG time to read the XML file into an object: Jscript ~8ms, JavaScript 28ms, Python43.8ms I also noticed issues with using TestComplete UserForms with javascript. In addition, Sys.OleObject used to create a DOM object seems to have a lower limit of the number of child elements that can be readas compared to using ActiveXObject with jscript. We would like to use javascript as it follows a newer ECMAscript standard but will need to stay with jscript until SmartBear makes some improvements in using javascript.1.8KViews0likes0CommentsRe: ODT disappeared in version "10.40"
I discovered once I migrated from ODT, (Object Driven Testing), to VB script classes, that the test code actually ran faster. The conversion ended up to be easier than I originally thought. This may be due in part to the fact that I mostly used ODT to create classes and arrays. Unfortunately, I also used the Owner.Owner stuff but that ended up to be easy to get rid of. I also used classes to drive UserForms and Network testing, but that ended up to be no problem either. The tests we run are completely data driven using DDT with an excel spreadsheet. (Hope they don't get rid of that ;-) The test server that needed to be converted was completely written in VB but fortunately the test clients were written using jscript. The test server had over 40 ODT classes. Several classes were fairly large with 30+ properties and 20+ methods. A good number of methods would also use ODT.Classes.NewArray(). So, in order, here is a high level view of what I did. Of course I would continually test the test code after each change. 1. Got rid of all uses "Owner.Owner." Used module level variables and/or functions to pass data from a parent class to a child class. 2. Made sure the organization of routines was such that all routines for a class were co-located. This does not include UserForm event modules that need to be kept outside any class. 3. Defined a custom array class that for the most part would replace ODT.Classes.NewArray() directly. See below. 4. Converted and tested each class one at a time. To save some time I simply used the Public keyword for public variables instead of defining the full Let/Get definitions. (Let/Get are done under the hood anyway.) When you test each class you will most likely discover something you forgot to convert. Each class most likely will need an accessor function outside the class so other "units" can instantiate an object based on that class. Once you have completed the conversion for all ODT classes and arrays, and your test code still run OK, you can remove ODT from your project. Class CustomArray ' --- Private properties Private m_Array() Private m_Count Private m_IsObject ' basic type of 1st item - object or non object ' --- Public Properties Public Property Let Count(value) m_Count = value End Property Public Property Get Count() Count = m_Count End Property ' Read only Public Property Get IsObject() IsObject = m_IsObject End Property ' --- Private Methods Private Function UseSet(ArrayItemToCheck) Dim strTemp Dim blnUnexpectType blnUnexpectType = False UseSet = False Select Case VarType(ArrayItemToCheck) Case 0 strTemp = "vbEmpty" blnUnexpectType = True Case 1 strTemp = "vbNull" blnUnexpectType = True Case 2 strTemp = "vbInteger" Case 3 strTemp = "vbLong" Case 4 strTemp = "vbSingle" Case 5 strTemp = "vbDouble" Case 6 strTemp = "vbCurrency" Case 7 strTemp = "vbDate" Case 8 strTemp = "vbString" Case 9 strTemp = "vbObject" UseSet = True Case 10 strTemp = "vbError" blnUnexpectType = True Case 11 strTemp = "vbBoolean" Case 12 strTemp = "vbVariant" Case 13 strTemp = "vbDataObject" UseSet = True Case 14 strTemp = "vbDecimal" Case 17 strTemp = "vbByte" Case 8192 strTemp = "vbArray" UseSet = True Case Else strTemp = "undetected: " & VarType(ArrayItemToCheck) blnUnexpectType = True End Select If blnUnexpectType Then Log.Error("Unexpected array item type: " & strTemp) End If End Function Private Sub Class_Initialize() m_Count = 0 m_IsObject = False ReDim m_Array(-1) 'Log.Message("UBound=" & UBound(m_Array)) End Sub ' --- Public Methods Public Function GetArray() GetArray = m_Array End Function ' Returns a specific array item Public Default Function Items(index) If index < m_Count And index > -1 Then If m_IsObject Then Set Items = m_Array(index) Else Items = m_Array(index) End If Else Log.Error("index out of range") End If End Function ' Used to change value of an existing item Public Function SetItem(index, value) if m_IsObject Then Set m_Array(index) = value Set SetItem = m_Array(index) Else m_Array(index) = value SetItem = m_Array(index) End If End Function Public Function AddItem(value) If m_Count = 0 Then If UseSet(value) Then m_IsObject = True Else m_IsObject = false End If Else If UseSet(value) <> m_IsObject Then Log.Error("Attempted to mix objects and non objects into the array. Item NOT added!") Exit Function End If End If ReDim Preserve m_Array(m_Count) 'Log.Message("UBound=" & UBound(m_Array)) if m_IsObject Then Set m_Array(m_Count) = value Set AddItem = m_Array(m_Count) Else m_Array(m_Count) = value AddItem = m_Array(m_Count) End If m_Count = m_Count + 1 End Function Public Sub DeleteItem(index) Dim index2 If index < m_Count and index > -1 Then If m_IsObject Then Set m_Array(index) = Nothing Else m_Array(index) = vbNull End If if m_Count > 1 And index < (m_Count - 1) Then ' Collapse array at the element that is being removed index2 = index + 1 While index2 < m_Count If m_IsObject Then Set m_Array(index2 -1) = m_Array(index2) Else m_Array(index2 -1) = m_Array(index2) End IF index2 = index2 + 1 Wend 'ElseIf index = 0 And m_Count = 1 Then ' We must be removing the 1st and only element ' Do nothing as the adjustment of m_Count and the ReDim will suffice 'Else ' We must be removing the last element ' Do nothing as the adjustment of m_Count and the ReDim will suffice End If m_Count = m_Count - 1 Redim Preserve m_Array(m_Count - 1) 'Log.Message("UBound=" & UBound(m_Array)) Else Log.Error("index out of range") End If End Sub End Class Function NewArray() Set NewArray = New CustomArray End Function2.8KViews1like0CommentsRe: ODT disappeared in version "10.40"
I see that now I can define VBScript classes in similar fashion as I had been use to in VBScript for office. I do not think I could do this back in TextComplete 5 and so I used ODT. Still a good size conversion task but more doable than converting to JScript as I would prefer.2.8KViews0likes0CommentsRe: ODT disappeared in version "10.40"
Wished there was a checkbox option for ODT in the 10.40 install but I did not see it. The oldest project I have is written in VBScript and since I like OO I used ODT. I have since moved to JScript for later projects as it is easier but have not yet converted the one old project. I would definately vote to keep ODT. It will be awhile before I convert 27,000 lines of VBScript into JScript. I will need the interim ODT plugin until then.2.8KViews1like0CommentsRe: namemapping items recorded on windows 7 are not recognized on Windows XP x64
Just FYI - When I had TC 8.7 installed on XP SP3, I could see the WinFormsObject items in the object browser. After installing TC 9.2, I now see Window objects in the browser instead. Changing the Method Invoke time out had no affect. Doing a Windows Update to get all the latest .Net updates did not help either. If I run the same program on Win7 (64bit) TC 9.2 object browser sees the WinFormsObject items OK. I can just move my stuff to Win7 butif I needed to stay on XP, it seems I would be stuck at this point. I will be curious if anyone comes up with a solution.2.9KViews0likes0Comments