chun2014
chun2014

Reputation: 91

Can you run Java code from within protractor spec?

I wonder if from protractor test specs, in the beforeEach() and afterEach() function, whether I can make some call to backend server API using java? If it is possible, where do I put the Java jar file to be able to run? If it is not possible to do this, what could be the alternative approach?

Upvotes: 2

Views: 916

Answers (1)

Andres D
Andres D

Reputation: 8900

Run a child process with node. Try this:

var exec = require('child_process').exec;

exec('java foo', function(error, stdout, stderr) {
  console.log('stdout: ' + stdout);
  console.log('stderr: ' + stderr);
  if (error !== null) {
    console.log('exec error: ' + error);
  }
});

Upvotes: 2

Related Questions