Forum Discussion

hpdvs2's avatar
hpdvs2
Occasional Contributor
14 years ago

Variable for Current Test Name, as it would show up in the log.

I'm trying to write a script that tells a database when a test case starts. 



I'm planning on just having a simple command called as the first step in each test.



Essentially this: (psuedo code)

function AnnounceTest()

{

  string CurrentTest = Tests["Current"]["Name"];

  // additional code that tells the database that it started.

}



Presently I have this, where each call is required to pass in a manually typed test name.

function AnnounceTest(CurrentTest)

{

  // additional code that tells the database that it started.

}





The problem is that any typo or change to the original test case name, will through off the end reporting from what this script is delivering. 



I essentially need the variable for the current test name like I can get the current host name, NameMapping["Sys"]["HostName"]


Any ideas?



1 Reply

  • hpdvs2's avatar
    hpdvs2
    Occasional Contributor
    Solved: 

    Project["TestItems"]["Current"]["Name"]


    ["TestItems"]["Current"]["Name"]- this is the text name of the current test, as it shows up in the log.