Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
integration [2021/02/17 03:38]
admin [Integrate TestOptimal in your web project (javascript/node.js)]
integration [2021/02/25 22:23] (current)
admin [Integrate TestOptimal in your java project (Java /IDE Connector)]
Line 3: Line 3:
 There are several ways to integrate //TestOptimal// with other systems and tools, allowing you to leverage your investment in the existing test automation tools. These interfaces are: There are several ways to integrate //TestOptimal// with other systems and tools, allowing you to leverage your investment in the existing test automation tools. These interfaces are:
  
-  * [[plugins#agent_plugin|Remote Agent]] 
   * [[#Cloud Services]]   * [[#Cloud Services]]
   * [[#Requirements]]   * [[#Requirements]]
Line 11: Line 10:
   * [[# Integrate TestOptimal in your java project (Java /IDE Connector)]]   * [[# Integrate TestOptimal in your java project (Java /IDE Connector)]]
   * [[# Integrate TestOptimal in your web project (javascript/node.js)]]   * [[# Integrate TestOptimal in your web project (javascript/node.js)]]
 +  * [[plugins#agent_plugin|Remote Agent]] - used to build Java Integration and Javascript/Node.js Integration above.
  
 ---- ----
Line 73: Line 73:
 ---- ----
 ==== Jenkins ==== ==== Jenkins ====
-Add steps to [[https://www.jenkins.io| Jenkins]] build job to run models using //TestOptimal// REST APIs+For current version v6, you would use REST API documented at http://localhost:8888/swagger.
  
-This feature is only available for V5.0. For v6.0you would achieve the same with http://localhost:8888/swagger.+For V5, add steps to [[https://www.jenkins.io/ | Jenkins]] build job to run models remotely
  
- +  Install [[https://plugins.jenkins.io/http_request/ | HTTP Request]] plugin installed in your //Jenkins//
-  Check and install [[https://plugins.jenkins.io/http_request/ | HTTP Request]] plugin installed in your //Jenkins//+
   * Add //admin// to connect to [[runtime_server | Runtime Servers]]   * Add //admin// to connect to [[runtime_server | Runtime Servers]]
     * select menu //Jenkins / Credentials//      * select menu //Jenkins / Credentials// 
Line 109: Line 108:
 //TestOptimal// provides a suite of REST APIs to allow 3rd party tools and applications to communicate with //TestOptimal// server.   //TestOptimal// provides a suite of REST APIs to allow 3rd party tools and applications to communicate with //TestOptimal// server.  
  
-You can use these REST APIs to access start and stop model execution, access model artifacts/files as well as perform system functions remotely.+You can use these REST APIs as documented at http://localhost:8888/swagger to access start and stop model execution, access model artifacts/files as well as perform system functions remotely.
  
 ==== Organization of REST APIs ==== ==== Organization of REST APIs ====
Line 150: Line 149:
      <groupId>com.github.testoptimal</groupId>      <groupId>com.github.testoptimal</groupId>
      <artifactId>JavaConnector</artifactId>      <artifactId>JavaConnector</artifactId>
-     <version>1.0.2</version>+     <version>1.0.4</version>
    </dependency>    </dependency>
  
Line 158: Line 157:
  
 See [[http://testoptimal.com/v6/JavaConnectorReadme.xml| JavaConnector README]] for more details. See [[http://testoptimal.com/v6/JavaConnectorReadme.xml| JavaConnector README]] for more details.
 +
 +----
  
 ==== Integrate TestOptimal in your web project (javascript/node.js) ==== ==== Integrate TestOptimal in your web project (javascript/node.js) ====
Line 170: Line 171:
        
  
-=== Making Connection ===+=== Connecting to TestOptimal Server ===
    TOSvr = new TOServer("http://localhost:8888");    TOSvr = new TOServer("http://localhost:8888");
    TOSvr.setDebugCB((msg)=> console.logMsg ("DEBUG: " + msg), 2);    TOSvr.setDebugCB((msg)=> console.logMsg ("DEBUG: " + msg), 2);
Line 181: Line 182:
       });       });
  
-=== Creating State Model ===+=== State Model Sample Scripts === 
 + 
 + 
 +== Creating State Model ==
  var model = new Model ("VendingMachine");  var model = new Model ("VendingMachine");
  var Welcome = model.addStateInitial("Welcome");  var Welcome = model.addStateInitial("Welcome");
Line 199: Line 203:
  TOSvr.uploadModel(model).then (function(){alert("model uploaded");})  TOSvr.uploadModel(model).then (function(){alert("model uploaded");})
  
-=== Generating Test Cases ===+== Generating Test Cases ==
  TOSvr.genPaths("VendingMachine", "Optimal", 1000).then(printPaths);  TOSvr.genPaths("VendingMachine", "Optimal", 1000).then(printPaths);
  function printPaths (sum) {  function printPaths (sum) {
Line 205: Line 209:
  }  }
  
-=== Opening Graphs ===+== Opening Graphs ==
  // graph types: model, sequence, msc and coverage  // graph types: model, sequence, msc and coverage
  // except model graph, all other graphs are available for model execution.  // except model graph, all other graphs are available for model execution.
Line 211: Line 215:
  console.logMsg("model graph: " + url);  console.logMsg("model graph: " + url);
  window.open(url, "ModelGraph");  window.open(url, "ModelGraph");
 +
 +== Online MBT ==
 + var execReq = {
 + modelName: "DEMO_RemoteAgent",
 + statDesc: "description",
 + options: { "autoClose": false }
 + };
 + var agentID = "DEMO";
 + TOSvr.execModel(execReq).then((data) => {
 + console.logMsg(data);
 + console.logMsg("Registering agent " + agentID);
 + TOSvr.regAgent(execReq.modelName, agentID).then(getNextCmd, errHandler);
 + });
 +
 + function getNextCmd() {
 +    TOSvr.nextCmd(agentID, 2000).then(function(rmtCmd) {
 +   if (rmtCmd && rmtCmd.cmd) {
 +   var result = {
 + result: "I don't know",
 + reqTag: "DEMO", 
 + assertID: "DEMO-" + rmtCmd.cmd
 + }
 + console.logMsg("received cmd: " + rmtCmd.cmd);
 + console.logMsg("sending result: " + result.result);
 + TOSvr.setResult (agentID, result).then (function(ret) {
 + setTimeout(getNextCmd, 1000);
 +   }, errHandler);
 +   }
 +   else modelExecDone();
 +    }, errHandler);
 + }
 +
 + function modelExecDone() {
 +    console.logMsg("Model execution completed");
 + }function errHandler (err) {
 +    console.log("errored");
 +    console.logMsg(err);
 +    TOSvr.stopModelExec(execReq.modelName);
 + }
 +
 +== Retrieve Execution Results ==
 +   TOSvr.getSummary("DEMO_RemoteAgent").then(function(ret) {console.logMsg(ret);})
 +
 +=== Combinatorial Model Sample Scripts ===
 +
 +== Create DataSet ==
 +    var ds = new DataSet("DemoDataSet");
 +    ds.addField ("F1", "text", ["aa","bbb"], "", false);
 +    ds.addField ("F2", "int", [1,2,3], "", false);
 +    TOSvr.uploadDataSet (ds).then(console.logMsg, console.logMsg);
 +
 +== Generate Test Cases ==
 +   TOSvr.genDataTable("DemoDataSet", "pairWise").then(console.logMsg, console.logMsg);
 +
 +
 +=== Demo Web Client ===
 +You may try out above sample scripts with the web client bundled in //TestOptimal// installation:
 +
 +http://localhost:8888/DemoApp/Demo_MBT.html
 +