Forum Discussion

Igelqott's avatar
Igelqott
New Contributor
14 years ago

WriteToTextFile with + and ","

Hi, im currently evaluating your software, to see if its something we can use.



Atm, im trying to find memoryleaks by opening a WPF client from a SmallTalk enviorment, and by doing so i want to log the memory usage aswell as the CPU usage.



I found your tutorial and did the same thing, and the string input i used is this:

Sys.Process("Lokaldelen.Silverado.Client").CPUUsage + "," + Sys.Process("Lokaldelen.Silverado.Client").MemUsage + "\r\n"



If i remove all of the "," and + and "\r\n", it works flawlessly, i get the information in my csv or txt file, like so:



But if i add it, so i can read the output, i get nothing in the file.



Also textcodingtype 20 and 22, returns chinese letters.



The tutorial was an older version, so that might be the problem here.



hope you can help, best regards


  • Igelqott's avatar
    Igelqott
    New Contributor
    Okay so ive converted it to Script to see if I can get some sort of error message:




    ---------------------------

    TestComplete

    ---------------------------

    An exception occurred in the "Unit1" unit at line 10:

    Körningsfel i Microsoft VBScript

    Inkompatibla typer: '[string: ","]'

    ---------------------------

    OK   

    ---------------------------



    Its complaining about my , seperator.


    Heres how the script looks.


    Sub Test4()

      'Unable to convert the For Loop operation, because no loop variable is specified.

      'Selects the 'Grunddata' tab of the 'SysTabControl32' tab control.

      Call Aliases.VDEVW.wndSmalltalkVCDMMDIFrame.MDIClient.wndSmalltalkVCDMMDIChild1.SysTabControl32.ClickTab("Grunddata")

      'Double-clicks the 'A Biltvätt & Recond' subitem of the 0 item of the 'SysListView32' list view.

      Call Aliases.VDEVW.wndSmalltalkVCDMMDIFrame.MDIClient.wndSmalltalkVCDMMDIChild1.SysTabControl32.VGraph.VW32ANSI.VW32ANSI.SysListView32.DblClickItem(0, "A Biltvätt & Recond")

      'Closes the 'HwndSource_Shell' window.

      Call Aliases.Lokaldelen_Silverado_Client.HwndSource_Shell.Close

      'Writes the specified string to a text file. 

      Call aqfile.WriteToTextFile("C:\Users\2657\Desktop\Automated testing\Memory leak Silverado\MemoryOutput.csv", Sys.Process("Lokaldelen.Silverado.Client").CPUUsage + "," + Sys.Process("Lokaldelen.Silverado.Client").MemUsage +  "\r\n", 21)

      'End of the loop block

    End Sub
  • AlexKaras's avatar
    AlexKaras
    Champion Level 3
    Hi Alexander,



    If the problem in the line you mentioned in your first post and you are using VBScript, then instead of

    Sys.Process("Lokaldelen.Silverado.Client").CPUUsage + "," + Sys.Process("Lokaldelen.Silverado.Client").MemUsage +  "\r\n"



    I would use this:

    Sys.Process("Lokaldelen.Silverado.Client").CPUUsage & ", " & Sys.Process("Lokaldelen.Silverado.Client").MemUsage & vbCrLf



    BTW, you can also consider AQtime (http://smartbear.com/products/development-tools/performance-profiling/ or http://www.automatedqa.com/products/aqtime/) which is far better tool of the same company if you are interested in memory leaks and resources usage profiling.
  • Igelqott's avatar
    Igelqott
    New Contributor
    Thanks, Il try that tomorrow.



    Yea atm Im just evaluating the software, testing for memory leaks is just one small part in the test scope.