Using messages
What are messages?

Messages are a way for tests to interact with Nerrvana.
Why did we create messages?

There are two reasons.

  1. Once we started using Nerrvana for real testing, we wanted to have a quick and easy way to bring key information from the tests to Nerrvana. We wanted to be able to launch tests and look at a brief log in Nerrvana in order to decide if we needed to open up a report from one of our tests.
  2. Currently we allow Hubs to talk only to allocated nodes. You aren't able to connect to an external database, send http requests, or send email. With messages, we can quickly add email configuration options to a test run, aggregating messages from all platforms and applying the filters you set, and send a single email to you. For example, you can set it to send an email if at least one platform generated an error and include messages from platforms where errors were found.
We were forced to restrict access from Hubs to prevent a user from generating thousands of emails (as we once did by mistake), which could lead to Nerrvana's IP being banned. In the future this may change, and if your tests do need such access, please let us know. Our intention is to make the system flexible and easy to use without compromising security and the quality of our service.

How can you use messages?

While messages can't trigger email notifications, you can use them to mark key branching points in your tests. Messages are captured by Nerrvana in real time and shown in the UI while your tests are running, as well as after completion. From our experience, sometimes they contain enough info to understand a problem.

How do you send Nerrvana a runtime message?

Messages are generated by the Selenium command 'setContext'. This way your tests do not need any specific configurations to work with Nerrvana and they will run outside Nerrvana without any code changes.

To send a message, just run the following Selenium command:
selenium.setContext("SYS_NOTE@4@message to Nerrvana");
or following commands for WebDriver:
driver.manage().timeouts().implicitlyWait(0, TimeUnit.MILLISECONDS);
driver.findElements("SYS_NOTE@4@message to Nerrvana"));
driver.manage().timeouts().implicitlyWait(timeout, TimeUnit.MILLISECONDS);
  • SYS_NOTE - an indication that this is a message for Nerrvana
  • @ - the separator
  • 4 – message level (see below)
  • message to Nerrvana - any text that you want to pass to Nerrvana

Message level can be any value from 1 to 6:
  • 6 - FATAL
  • 5 - ERROR
  • 4 - WARN
  • 3 - INFO
  • 2 - DEBUG
  • 1 – TRACE

Note: A FATAL message will immediately stop a test's execution in Nerrvana.

To make it easier to use messages in your code, we recommend to creating a special function. For example:
public void notifySystem (int level, String msg)
    String system_msg = String.format ("SYS_NOTE @% d @% s", level, msg);
    try {
    } catch (Exception e) {
        // ...

You can then send Nerrvana a message by simply writing:
notifySystem (4, "message to nerrvana");