Forum Discussion

dbur's avatar
dbur
New Contributor
15 years ago

Trying to access assertion name from script

Hi.
I have a script assertion and in that script I'm trying to access the name of the assertion. I can't seem to find a way from the context variable to access the current assertion object (I can see how to get to the current test step but not the assertion). Is it possible to get the assertion's name from the assertion's script?
Cheers
David
  • Hi David,

    Actually, this isn't doable in a generic way; if you want we could add an "assertion" variable that would be available from inside the script assertions script giving you access to the containing GroovyScriptAssertion instance.. then you could do something like

    log.info assertion.name

    Does that seem ok?

    regards!

    /Ole
    eviware.com
  • dbur's avatar
    dbur
    New Contributor
    Thanks Ole, that's what I'm looking for, as it would give me a handle on the assertion's properties.

    Cheers
    David