Is it possible to call C # code from a Protractor test?

I would like to use C # to implement some of my Protractor unit tests. Is it possible?

The reason for this is that I want to fetch some data from my DB and compare it with the expected results, which are stored in text files. There is too much hard work in JavaScript for that. So, I would like to call a C # DLL or EXE to do this part.

+3


source to share


1 answer


You can do it with Edge.js

Ultimately, Protractor runs inside a node process, and so anything you can do with a node you can do with Protractor.

You just need to set edge:



npm install edge -g

And then require it and do something with .Net code inside your spec file:

var edge = require('edge');

var hello = edge.func(function () {/*
 async (input) => {
 return "CSharp welcomes " + input.ToString();
 }
 */});

describe('.Net is in your node!', function(){

  beforeEach(function(){
    hello('Node.js', function (error, result) {
      if (error) throw error;
      console.log(result);
    });
  });

});

      

+5


source







All Articles