Ask a Question

Unit Name, Project Name from script

Madhi
Contributor

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 4
YMinaev
Staff

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.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Madhi
Contributor

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
YMinaev
Staff

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.
------
Yuri
TestComplete Customer Care Engineer

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Madhi
Contributor

path = Project.FileName


x = aqFileSystem.GetFileName(path)


length = aqString.GetLength(x)


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

Did work for me..

thanks..

cancel
Showing results for 
Search instead for 
Did you mean: