1

We are using SAHI to do some benchmark tests. Currently they are collecting some times while exercising the application. These times are stored in a text file. We now have an app to collect and analyze this data. We have a restful API in .Net MVC 4. We created a javascript API thinking SAHI should be able to call the javascript methods and go on its merry way. We are having problems figuring out how to get SAHI to use JQuery properly and reference the API.

Javascript API Object:

;
var BenchmarkService = (function (options) {
    var settings = $.extend({
        serverName: "http://localhost"
        }, options || {});

// public api
this.Benchmark = function (benchmarkName) {
    var benchmark;

    $.ajax({
        type: "GET",
        url: settings.serverName + '/BenchmarkServices/Services/Benchmark/' + benchmarkName,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        async: false,
        success: function (data) {
            benchmark = data;
        }
    }
    );

    return benchmark;
};

this.SaveBenchmarkResult = function (benchmarkResultObject) {
    var id;

    var url = settings.serverName + '/BenchmarkServices/Services/SaveBenchmarkResult';
    $.ajax({
        type: "POST",
        url: url,
        data: JSON.stringify(benchmarkResultObject),
        async: false,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (data) { id = data; }
    });

    return id;};
    }
);

We would like be be able to call these methods within SAHI simply by referencing the .js file.

Is this possible?

DanCaveman
  • 676
  • 1
  • 6
  • 22

1 Answers1

-1

Can you mention the Sahi version, your java version and os you are using. If you are a pro customer you can directly email to Sahi support team(after all you paid for the support)!

If you are using Sahi Os, let me know the version and I can look if it is possible or not.

Vivek V Dwivedi
  • 2,510
  • 2
  • 28
  • 39
  • Sorry, I just saw this post. It was a long time ago, so I don't remember the specifics, but we do have pro version and contacted support. They didn't think it was possible (the way it was written). We got around it by make curl.exe calls directly from Sahi command prompt functionality. I was hoping there was an easier way, but I couldn't find it. – DanCaveman Jan 29 '14 at 19:47
  • This is not an answer, it should be a comment. – Dave Kidder Jul 23 '15 at 13:40