Concerto remote test run environment

general idea

The general idea of Concerto remote test run environment is to make it possible to insert Concerto tests hosted on remote servers into external websites.

It means that in practice there can be a Concerto server located somewhere in the world and though your website is located on a remote host you can still run the tests from that server as if the Concerto instance was installed on the same host as your website.


the package

Concerto has a dedicated package just for that. Here is the structure of the package:


installation

  1. download the package
  2. extract it's contents to the directory located inside your website root folder
  3. link following CSS files in your HTML head tag:
  4. include following JS file in your HTML head tag:
  5. edit /SETTINGS.php file and set two variables:

usage

Now you can just use this javascript code somewhere on your website:

$(selector).concerto(options);

... where selector is jQuery selector, for the test container, e.g.:

$("#divTest").concerto(options);

... means that we want to place the contents of the test inside container with id divTest on your HTML. The second variable options is required options object you want to pass to Concerto object. It contains the following fields:

name description default example
workspaceID specifies id of the workspace you want to run the test from null 1
testID specifies id of the test you want to run null 1
sessionID specifies id of the session you want to resume null 1
sessionHash specifies hash of the session you want to resume null 1af3577e1445c4c35ff3cabd0a36255a
params object containing additional parameters you want to pass to the test, it's the same as adding additional URL parameters when running the test through regular test run environment { } { var1: 128, var2:'concerto' }
WSPath path to /concerto_client.php file from the package "client/concerto_client.php" "client/concerto_client.php"
loadingImageSource source of the default loading image used in transitions between test HTML templates null "image/loading.png"
callback to be called whenever there is response received from Concerto server function(response) { } function(response) { alert('response received'); }
resumeFromLastTemplate used only when resuming session, if set to true it will just show the last template shown in the session and will wait for user input false false

One option from the table needs some more explanation. It's the callback option. You should set it's value to a function accepting response object as a argument. The argument object will contain data returned from the Concerto server.

Here are couple of fields from response.data object with it's possible usage:

name description usage
TEST_SESSION_ID unique test session id can be stored by remote website to implement session resuming mechanism
HASH test session hash can be stored by remote website to implement session resuming mechanism
FINISHED is 1 if session is finished or 0 if session is ongoing can be used in custom session resuming mechanism to mark session as not resumable

full example


    $(function(){
    $("#divTest").concerto({
    workspaceID:1,
    testID:1,
    callback:function(response){
    if(response.data.FINISHED==1) alert("test is finished");
    }
    });
    });

limitations

There is no built in session resuming mechanism. You have to implement your own. It can be achieved by using workspaceID, testID, response.data.TEST_SESSION_ID, response.data.HASH and response.data.FINISHED variables.