Nightwatch: How to retrieve current test case name

Created on 28 Mar 2016  路  5Comments  路  Source: nightwatchjs/nightwatch

Hello,

I m working with balloon pop up which will invoke for currently running test case, I need to pass the current test case name to that balloon popup. Is there a possibility of retrieving the current test case name,if so can someone help me in retrieving the current test case name. Thanks in advance.

Most helpful comment

@beatfactor :
In my use case I need the test case name before the test will actually run.
Is there a way to do this?

All 5 comments

+1

browser.currentTest.module should contain your testcase name.

Thanks for your quick response @rkavalap, tried with browser.currentTest.module, it is giving the suite name. Is there any way to get the indivdual test case name in the suite(for example if I have two test cases in a suite i want to retrieve names of two cases indivdually)

currentTest.name is available in the afterEach hook:

afterEach : function(client, done) {
  console.log(client.currentTest)
  done();
}

@beatfactor :
In my use case I need the test case name before the test will actually run.
Is there a way to do this?

Was this page helpful?
0 / 5 - 0 ratings