VMware Aria Automation Blog

from Stefan Schnell

The building of an equivalent JavaScript execution environment, like in Aria Automation, can be very helpful, to support and simplify this kind of software development. Surely this is not an easy way and involved with some efforts. This requires many small steps, that fit together step by step, like the pieces of a puzzle. This blog post shows a first approach that tries to do this.

Program Example Using JavaScript Emulation

Based on the following list of blog posts an example is shown in which combines these approaches. The combination of these approaches allows to program source codes that can be executed unchanged with different operating systems, different JDKs and different system environments, also in Aria Automation. Using Java programs with different operating systems and JDKs is not magic, this is a fundamental approach of Java. Our stack is operating system > JDK > Rhino JavaScript engine > Aria Automation Dunes framework > JavaScript program. The challenge here is to simulate the Dunes framework, the bridge between the program and the JavaScript engine. First emulations of classes are available and will be used as an example to demonstrate this kind of scenario, here with the detection of system information.

The Program

This program collects information about the operating system, the Java runtime, the Rhino engine, if its executing in Aria Automation and the Linux distribution. Without the load commands it is possible to run this program unmodified in the JavaScript runtime environment of Aria Automation.


 * @author Stefan Schnell <mail@stefan-schnell.de>
 * @license MIT
 * @version 0.1.0
 * Set in the VMware Control Center the system property
 * com.vmware.js.allow-local-process to true and
 * com.vmware.scripting.javascript.allow-native-object to true.

// Operating system
var osName = String(java.lang.System.getProperty("os.name"));
var osVersion = String(java.lang.System.getProperty("os.version"));
var osArchitecture = String(java.lang.System.getProperty("os.arch"));

System.log("OS Name: " + osName);
System.log("OS Version: " + osVersion);
System.log("OS Architecture: " + osArchitecture);

// Java
var javaVendor = String(java.lang.System.getProperty("java.vendor"));
var javaVersion = String(java.lang.System.getProperty("java.version"));

System.log("Java Vendor: " + javaVendor);
System.log("Java Version: " + javaVersion);

// Rhino
var contextFactory = new org.mozilla.javascript.ContextFactory();
var context = contextFactory.getGlobal().enterContext();
var rhinoVersion = String(context.getImplementationVersion());


// Aria Automation
var OrchestrationUiServiceHost = java.lang.System.getenv(

if (OrchestrationUiServiceHost !== null) {

  var ariaVersion =
  System.log("Program is running in Aria Automation " + ariaVersion);
} else {
  System.log("Program is not running in Aria Automation");

// Linux distribution
if (osName.indexOf("Linux") !== -1) {

  var command = new Command("cat /etc/os-release");
  var osIdentificationData = command.output;




program uses javascript emulation on windows
Program Uses JavaScript Emulation in Windows


program uses javascript emulation on red hat enterprise linux
Program Uses JavaScript Emulation in Red Hat Enterprise Linux

Aria Automation

program uses javascript on aria automation
Program Uses JavaScript in Aria Automation


This is only a simple approach, but it shows us potential. This does not mean that all classes of Aria Automation have to be fully provided to use this approach. They can also be partially faked with a mock-up. But this approach can be used fast and very well when 3rd party JavaScript libraries are to be used in Aria Automation, e.g. to test calls and procedures - a lucrative use case.