Forum Discussion

Madhi's avatar
Madhi
Contributor
15 years ago

Unit Name, Project Name from script

Is there a way to store the unit name, projectname by giving a command similar to project.path gives the path.

Also is there a way to get the status of the run result, start and end time at the end of every test.

4 Replies

  • Hi,



    You can extract the file name from the path by using the aqFileSystem.GetFileName method. After that, remove the file extension from the resulting string. You can do this, for example, using regular expressions or just by cutting off the last 4 characters. See the "aqFileSystem.GetFileName" and "Working With Strings" help topics.
  • path = Project.FileName


    x = aqFileSystem.GetFileName(path)


    length = aqString.GetLength(x)


    xfilename = aqString.Remove(x,length-4,4)

    Did work for me..

    thanks..

  • Hi,



    Is there a way to store the unit name


    There's no way to obtain unit names.



    ...projectname...


    You can use the Project.FileName property.



    to get the status of the run result, start and end time


    You need to work with logs from scripts. See the "Scripting Access to the Test Log Contents" help topic.
  • project.filename gives us the whole path.. is there any function to give us just the projectname

    ex. c:\documents\testcomplete7projects\project1.mds... is the result for project.filename.. I need the result to be just project1