Forum Discussion

ChristopheC's avatar
ChristopheC
Contributor
13 years ago

Problem with Project.TestItems

Hello,



I have a problem with the following example demonstrates how to obtain the list of project test items and how to post the name of the currently running test item to the log.




Sub Test



  Dim TestItems

  …

  Set TestItems = Project.TestItems

  Call Log.Message("The " & TestItems.Current.Name & " test item is currently running.")

  …



End Sub



When I run current routine without enable debugging, i have an error and when I run current routine with enable debuging (Step by step), i don't have error (see attached file).



I have the same problem with TestComplete et TestExecute 9.20.2460.7 and 9.30.3373.11.



Thank you to take time to reply us.



Best regards,



Christophe

 

2 Replies

  • Hi Cristophe.



    This as nothing to do with debugging.

    In fact, TestItems.Current is only available when you run the project.



    Right click on the project in the Project Explorer, and click Run ... [Project]

    Project.TestItems.Current is defined
    .



    If you run a TestItem directly from the Test Items panel of the project, Project.TestItems.Current will be undefined. Same goes if you run a script or a keyword from the projet explorer.



    You can find out more about this Current Property.



    Regards, 



    Guillaume.
  • Hi MGDIS TIA,



    Thank.



    I do not understand it does not work when I run project with TestExecute because I did not start current routine but project !



    At worst, I get what I want by using "Project.TestItems.TestItem(0).Enabled" to retrieve the name of current Test Item because I have only one active Test Item at a time.



    Best regards,



    Christophe