npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@testoptimal/mbt

v1.0.0

Published

TestOptimal Model-Based Testing (MBT)

Downloads

3

Readme

TestOptimal_MBT

API to access TestOptimal Server for execution.

TestOptimal is a Model-Based Testing (MBT) tool, which generates test cases from a state diagram or from a set of variables.

Usage

You may integrate your web project with //TestOptimal// using javascript library: TOServer.js.

For web/javascript, just add one of the following to HEAD tag in your html page:

For //Node.js// project, use following npm command to install //TOServer.js// package: npm install @testoptimal/mbt

Connecting to TestOptimal Server

TOSvr = new TOServer("http://localhost:8888"); TOSvr.setDebugCB((msg)=> console.logMsg ("DEBUG: " + msg), 2); TOSvr.login("myUsername", "myPwd") .then(() => { console.logMsg("connected to TestOptimal server"); }, (err) => { console.logMsg(err); alert("Connection error"); });

State Model Sample Scripts

Creating State Model

var model = new Model ("VendingMachine");
var Welcome = model.addStateInitial("Welcome");
var Q1 = model.addState("25 cents");
var Q2 = model.addState("50 cents");
var Q3 = model.addState("75 cents");
var Q4 = model.addState("100 cents");
var ThankYou = model.addStateFinal("ThankYou");

Welcome.addTrans("add_quarter", Q1).addTrans("cancel", ThankYou);
Q1.addTrans("add_quarter", Q2).addTrans("cancel", ThankYou);
Q2.addTrans("add_quarter", Q3).addTrans("cancel", ThankYou);
Q3.addTrans("add_quarter", Q4).addTrans("cancel", ThankYou);
Q4.addTrans("select_drink", ThankYou).addTrans("cancel", ThankYou);

// TOSvr is the connection object created in Making Connection section above.
TOSvr.uploadModel(model).then (function(){alert("model uploaded");})

Generating Test Cases

TOSvr.genPaths("VendingMachine", "Optimal", 1000).then(printPaths);
function printPaths (sum) {
   console.logMsg(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("VendingMachine", "model");
console.logMsg("model graph: " + url);
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:8886/DemoApp/Demo_MBT.html

Developing

Tools

Created with Nodeclipse (Eclipse Marketplace, site)

Nodeclipse is free open-source project that grows with your contributions.