User Tag List

Thanks Thanks:  0
Likes Likes:  0
Dislikes Dislikes:  0
Results 1 to 2 of 2
  1. #1
    Junior Member
    Join Date
    Mar 2005
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    Loading scripts programmatically

    Hi mates,

    We have created a utility that automatically generates script code depending on some variables pertaining to the application under test. The code is saved in txt files. Now, we need to load all the scripts in the SQL database, but everytime we have a look-see inside the database, to figure out what needs to be done, the information looks to encrypted (garbage characters, basically).

    Our programmer wants to know if it is possible to programmatically load these txt files as scripts into the SQL database. Thanks.

  2. #2
    Senior Member
    Join Date
    Sep 2001
    Post Thanks / Like
    0 Post(s)
    0 Thread(s)
    Total Downloaded

    Re: Loading scripts programmatically

    Yes, db info is in binary, so you can't go directly to the tables. Import/Export is an upcoming feature of TP.

    As a workaround, created a script that can drive another instance of testpartner, ultimatly automating the import of scripts into the UI using the Insert~File menu. Note that you will have to put this script into the tp db, and run it from the command line with the second instance of TP already open on the machine.

    </font><blockquote><font size="1" face="Verdana, Arial, Helvetica">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">Sub Main()
    'This script will drive a seperate instance of TP.
    'It must be in a seperate db, and called via Command Line
    ' tp -u&lt;Username&gt; -p&lt;Password&gt; -d&lt;ODBC DSN&gt; -r&lt;Project name&gt; -s&lt;list of script names delimited by space&gt;
    'The instance of TP that you are driving must be open to the Asset Browser Window
    ' Change the loop count for how many of the scripts (starting from top) that you want to add the new ref for

    Window.Type &quot;{AltGr A}&quot;

    For X = 1 To 2 'This will add ref for the top 20 scripts in the Asset Browser

    Window.Type &quot;{Alt FN}&quot;

    Window(&quot;Application=TESTPARTNER.EXE Caption='New Asset'&quot.Attach
    ListView(&quot;Index = 1&quot.Select &quot;Script&quot;
    ComboBox(&quot;Index=1&quot.Select &quot;Common&quot;
    ' EditBox(&quot;Label='Asset &amp;name:'&quot.SetText &quot;testtest&quot;

    Window.Type &quot;{Ctrl A}&quot;
    Window.Type &quot;{ExtDelete}&quot;
    Window.Type &quot;{Alt IF}&quot;

    Dim theScriptName As String

    Window(&quot;Application=TESTPARTNER.EXE Caption='Insert File'&quot.Attach
    EditBox(&quot;Label='File &amp;name:'&quot.SetText &quot;C:\Program Files\TMX\Demo&quot;
    ListView(&quot;Parent.Label='Look &amp;in:'&quot.SelectIndex X
    theScriptName = EditBox(&quot;Label='File &amp;name:'&quot.Text

    ScriptName = RemoveCharacters(theScriptName, &quot;-+$(),./\:*?&lt;&gt;|'&quot

    Window.Type &quot;{Alt FC}&quot;

    Window(&quot;Application=TESTPARTNER.EXE Caption=TestPartner&quot.Attach

    Window(&quot;Application=TESTPARTNER.EXE Caption='Save As'&quot.Attach
    EditBox(&quot;Label='&amp;Name:'&quot.SetText ScriptName

    Next X

    MsgBox &quot;Done!&quot;

    End Sub

    ' Replaces the characters set in strUnwanted as spaces, then removes the spaces
    Public Function RemoveCharacters(strDataPrep As String, strUnwanted As String) As String
    Dim intCurrLoc As Integer
    Dim intLength As Integer
    Dim tmpChar As String

    intLength = Len(strDataPrep)
    For intCurrLoc = 1 To intLength
    tmpChar = Mid$(strDataPrep, intCurrLoc, 1)
    If InStr(strUnwanted, tmpChar) Then
    ' Replace with a space
    Mid(strDataPrep, intCurrLoc, 1) = &quot; &quot;
    End If
    ' Removes all spaces
    strActual = strActual &amp; Trim$(Mid$(strDataPrep, intCurrLoc, 1))

    RemoveCharacters = strActual
    End Function</pre><hr /></blockquote><font size="2" face="Verdana, Arial, Helvetica">



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Search Engine Optimisation provided by DragonByte SEO v2.0.36 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Resources saved on this page: MySQL 11.11%
vBulletin Optimisation provided by vB Optimise v2.6.4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.2.8 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominate (Lite) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 01:04 AM.

Copyright BetaSoft Inc.