简体   繁体   中英

How to get the current suiteName in jasmine?

Is there any way to get the name of the current suite that is being executed in jasmine/protractor? I would need it to generate some custom reports.

I am sure there is not any. However, nothing stops you from implementing it manually:

const suites = {
  suite1: 'suite name',
  suite2: 'suite name',
}

describe(suites.suite1, () => {
  it('test name', () => {
    ...
    myCustomReport(suites.suite1)
  })
})

PS The syntax is not precise, I don't remember it.

var spec = it("name for it", function() {
   console.log(spec.description); // prints "name for it"
});

Hope this helps you...

console.log(jasmine.getEnv().currentSpec.suite.description)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM