Forum Discussion

johny2010_1's avatar
johny2010_1
Contributor
16 years ago

How to get item names for scripts?

I want to run a http load test with script bur I do not know where to get item names, from connection records, or from a keyword test ?

If so Do I have make a keyword record before every load test ? Please help.



The example in the help is like that; where these Item names come from ?



request2 = HTTPTask.Connection(0).Request(2);


request2.URLVariables.Item("firstname") = Orders[0];


request2.URLVariables.Item("lastname") = Orders[1];


request2.URLVariables.Item("cardname") = Orders[2];


request2.URLVariables.Item("cardnumber") = Orders[3];



I think maybe I can get something from keyword



Keyword test has some records like this



...formAspnetform.panelLoginPageBody.panelLoginMainWrapper.panelLoginLeftImage.panelLoginRightWrapper.panelLoginpanelcontainer.panelCtl00Pagecontent2Loginpanel.table.cell.table.cell.panelLoginBoxWrapper.panelInputRightPart.textboxCtl00Pagecontent2Username



and I think the needed name is User name here and another name

....formAspnetform.panelLoginPageBody.panelLoginMainWrapper.panelLoginLeftImage.panelLoginRightWrapper.panelLoginpanelcontainer.panelCtl00Pagecontent2Loginpanel.table.cell.table.cell1.panelLoginBoxWrapper.panelInputRightPart.passwordboxCtl00Pagecontent2Pass



so are the needed names are Username and Pass ? Are there standart for these web item names.

5 Replies


  • Hi Johny,





    I want to run a http load test with script


    After you have recorded a load test, in the 'Project Explorer' panel, you'll see a newly created task under the "LoadTesting | Tasks" entry. Also, there will be an automatically generated test under "LoadTesting | Tests". To run the recorded test from script, use the "LoadTesting.Tests.TestByName(<RecordedTestName>).Execute();" command (without quotation marks).





    Keyword test has some records like this


    These records mean that you recorded an ordinary functional test. To record a load test, you need to press the "Record Load Test" button on the Recording toolbar. See the 'To record traffic in TestComplete' section of Traffic Recording.





    Also, see Load Testing Basics Tutorial.


  • Thank you Allen,

    But these are not the questions I exactly ask. If you read carefully my post, I have peoblem with item names in the script.

    (I know the task and test that created automatically after recording)

    By the way,  Actually I got this script from a web page.



    http://www.bughuntress.com/portfolio/automated-testing/test-complete.html

    This is a simple and clear script, written in VBscript.



    I can also record script from recording. I perefer Jscript, but there are some points I do not understand from the generated script. It does not produce any names for links, It just recors clicking coordinates, What is this actually, how can it be useful ?



    for example like that


    internetExplorerServer.Click(308, 20);


    internetExplorerServer.Click(493, 379);


    internetExplorerServer.MouseWheel(-6);



    but if you look after script, there are names etc.



  • Hi Johny,





    From your first post:

    I want to run a http load test with script






    and from the second one:

    I can also record script from recording. I perefer Jscript, but there are some points I do not understand from the generated script. It does not produce any names for links, It just recors clicking coordinates, What is this actually, how can it be useful ?






    Note that load tests do not simulate user actions - they simulate HTTP traffic. Entries like

    internetExplorerServer.Click(308, 20);


    indicate that you recorded an ordinary functional test (i.e. you didn't press "Record Load Test"), but not a load test.





    The script provided on the page you've mentioned is manually written script code for a load test.


  • Hi Allen, When I record a script it records like that. So I see that recording a script actually records a keyword by default, so how can I record a http load test script ? Is there a way for this ?



    The other question I still wait answer that the manually written script I mentioned before uses some names for the areas, where these item names come from ? Lets say that I want use this script for my test, will it be compatible with the web site I Test ? How to get item names ? Manually reading source of http pages, or use the field names comes with the keyword test record ? So do I have make a keyword test record for each other web site ? Plaease helpme, I am confused.

  • Hi Johny,





    When I record a script it records like that. So I see that recording a script actually records a keyword by default, so how can I record a http load test script ? Is there a way for this ?


    To start recording a script, select "Test | Record | Record Script" from the TC main menu. Then, click the "Record HTTP Requests" button. I recommend that you read Recording Toolbar. There, you will see the button you need to click. However, note that TestComplete won't record a script like that on the page you mentioned. Such a kind of scripts can't be created automatically.





    The other question I still wait answer that the manually written script I mentioned before uses some names for the areas, where these item names come from ?


    See HTTPRequestVariables Object.





    Lets say that I want use this script for my test, will it be compatible with the web site I Test ?


    As I've said, I do not recommend you using that script.