Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
integration [2021/02/17 03:34] 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 // | There are several ways to integrate // | ||
- | * [[plugins# | ||
* [[#Cloud Services]] | * [[#Cloud Services]] | ||
* [[# | * [[# | ||
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/ | * [[# Integrate TestOptimal in your web project (javascript/ | ||
+ | * [[plugins# | ||
---- | ---- | ||
Line 73: | Line 73: | ||
---- | ---- | ||
==== Jenkins ==== | ==== Jenkins ==== | ||
- | Add steps to [[https://www.jenkins.io/ | Jenkins]] build job to run models using // | + | For current version v6, you would use REST API documented at http://localhost: |
- | This feature is only available for V5.0. For v6.0, you would achieve the same with http://localhost:8888/ | + | For V5, add steps to [[https://www.jenkins.io/ |
- | + | | |
- | | + | |
* 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: | ||
// | // | ||
- | You can use these REST APIs to access start and stop model execution, access model artifacts/ | + | You can use these REST APIs as documented at http:// |
==== Organization of REST APIs ==== | ==== Organization of REST APIs ==== | ||
Line 150: | Line 149: | ||
< | < | ||
< | < | ||
- | < | + | < |
</ | </ | ||
Line 158: | Line 157: | ||
See [[http:// | See [[http:// | ||
+ | |||
+ | ---- | ||
==== Integrate TestOptimal in your web project (javascript/ | ==== Integrate TestOptimal in your web project (javascript/ | ||
Line 170: | Line 171: | ||
- | === Making Connection | + | === Connecting to TestOptimal Server |
TOSvr = new TOServer(" | TOSvr = new TOServer(" | ||
| | ||
Line 181: | Line 182: | ||
}); | }); | ||
+ | === State Model Sample Scripts === | ||
+ | |||
+ | |||
+ | == Creating State Model == | ||
+ | var model = new Model (" | ||
+ | var Welcome = model.addStateInitial(" | ||
+ | var Q1 = model.addState(" | ||
+ | var Q2 = model.addState(" | ||
+ | var Q3 = model.addState(" | ||
+ | var Q4 = model.addState(" | ||
+ | var ThankYou = model.addStateFinal(" | ||
+ | |||
+ | Welcome.addTrans(" | ||
+ | Q1.addTrans(" | ||
+ | Q2.addTrans(" | ||
+ | Q3.addTrans(" | ||
+ | Q4.addTrans(" | ||
+ | |||
+ | // TOSvr is the connection object created in Making Connection section above. | ||
+ | TOSvr.uploadModel(model).then (function(){alert(" | ||
+ | |||
+ | == Generating Test Cases == | ||
+ | TOSvr.genPaths(" | ||
+ | function printPaths (sum) { | ||
+ | | ||
+ | } | ||
+ | |||
+ | == Opening Graphs == | ||
+ | // graph types: model, sequence, msc and coverage | ||
+ | // except model graph, all other graphs are available for model execution. | ||
+ | var url = TOSvr.getGraphURL(" | ||
+ | console.logMsg(" | ||
+ | window.open(url, | ||
+ | |||
+ | == Online MBT == | ||
+ | var execReq = { | ||
+ | modelName: | ||
+ | statDesc: " | ||
+ | options: { " | ||
+ | }; | ||
+ | var agentID = " | ||
+ | TOSvr.execModel(execReq).then((data) => { | ||
+ | console.logMsg(data); | ||
+ | console.logMsg(" | ||
+ | TOSvr.regAgent(execReq.modelName, | ||
+ | }); | ||
+ | |||
+ | function getNextCmd() { | ||
+ | | ||
+ | if (rmtCmd && rmtCmd.cmd) { | ||
+ | var result = { | ||
+ | result: "I don't know", | ||
+ | reqTag: " | ||
+ | assertID: | ||
+ | } | ||
+ | console.logMsg(" | ||
+ | console.logMsg(" | ||
+ | TOSvr.setResult (agentID, result).then (function(ret) { | ||
+ | setTimeout(getNextCmd, | ||
+ | }, errHandler); | ||
+ | } | ||
+ | else modelExecDone(); | ||
+ | }, errHandler); | ||
+ | } | ||
+ | |||
+ | function modelExecDone() { | ||
+ | | ||
+ | }function errHandler (err) { | ||
+ | | ||
+ | | ||
+ | | ||
+ | } | ||
+ | |||
+ | == Retrieve Execution Results == | ||
+ | | ||
+ | |||
+ | === Combinatorial Model Sample Scripts === | ||
+ | |||
+ | == Create DataSet == | ||
+ | var ds = new DataSet(" | ||
+ | ds.addField (" | ||
+ | ds.addField (" | ||
+ | TOSvr.uploadDataSet (ds).then(console.logMsg, | ||
+ | |||
+ | == Generate Test Cases == | ||
+ | | ||
+ | |||
+ | |||
+ | === Demo Web Client === | ||
+ | You may try out above sample scripts with the web client bundled in // | ||
+ | http:// | ||