Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Introduction
Domain Specific Languages are languages created to support a particular set of tasks, as they are performed in a specific domain. Atomiton's TQL is a collection of number of DSL's each supporting specific function. Just like any GPL, in order for DSL to be successful, it must to have advanced tooling support around it. Ideally we want all all sort of simulators, debuggers, tools to analyze code coverage. Everything built on one platform.
In this section we describe the simple reporting that A-Stack (runtime for TQL) offers to deduce your TQL Code coverage. The advantage of finding the TQL Code coverage is to avoid or minimize all runtime errors
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<Query># Query: <DeleteAll> DeleteAll: <TempSensor> TempSensor: <sensorId sensorId(ne=: ""/>) </TempSensor> </DeleteAll> <Save Save(format="version, current">): <!-- This#This will read --> TempSensor: <TempSensor> Simulation: <Simulation>true PerifMsg: $Null() true Peripheral: </Simulation>serial <PerifMsg>Baudrate: 9600 $Null()InterfacePort: "/dev/cu.usbmodem1411" </PerifMsg>Interface: serial <Peripheral> Format: ascii serialOperation: receive </Peripheral> UniqueId: 76522 <Baudrate> Payload: $Null() 9600 TempValue: $Null() Query(Storage: "TqlSubscription"): </Baudrate> Save: <InterfacePort> TqlSubscription(Label: "TempSensor", sid: "20"): /dev/cu.usbmodem1411 </InterfacePort> <Interface> serial </Interface> <Format> ascii </Format> <Operation> receive </Operation> <UniqueId> 76522 </UniqueId> <Payload> $Null() </Payload> <TempValue> $Null() </TempValue> </TempSensor> </Save> </Query> <Query Storage='TqlSubscription'> <Save> <TqlSubscription Label='TempSensor' sid='20'> <Topic>*Atomiton.Sensors.TempSensor.TempValue*</Topic> </TqlSubscription> </Save> </Query> |
The output will be in this format
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "Bundle: tqlenginemanager/facets/nwChangeDetectionFacets.fs.xml":[Topic: *Atomiton.Sensors.TempSensor.TempValue* |
The output will be in this format
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
{ "Bundle: tqlenginemanager/facets/nwChangeDetectionFacets.fs.xml":[0,0,0,0,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,10,20,10,0,01,1,2,1,0,0,0,01,0,01,0,0,0,1,0,1,0,0,0,0,21,1,0,0,1,1,0,0,0,0,01,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,1], "resources/atomiton/AStackDevManagment/macros/devmanagmacros.xml":[0,0,02,2,02,02,0,2], "Bundle: tqlenginemanager/facets/macroFacet.fs.xml":[0,0,0,0,01,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,01,0,0,01,0,0,01,0,0,01,0,0,01,0,0,01,0,0,01,0,0,01,0,0,1,10,0,01,0,0,01,0,0,01,0,0,01,0,0,1,10,20,1,0,0,0,1,0,1,0,01,0,0,1,0,0,1,0,0,1,1,0,0,0,01,0,0,1,0,0,01,0,0,01,0,0,0,1,0,0,0,0,1,1], "resources/atomiton/AStackDevManagment/macros/devmanagmacros.xml":[0,0,2,2,2,2,2], "Bundle: tqlenginemanager/facets/macroFacet.fs.xml":[0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1], "SffFacetAgentFacet.xml":[0,0,1,0,01,1], "Bundle: tqlenginemanager/macros/getEngineSettings.mc.xml":[0,0,1,0,0,1,0,0,1,0,0,10,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,10,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1], "Bundle: tqlenginemanager/facets/networkStatus.af.xml":[0,0,10,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,11], "SffFacetAgentFacetBundle: tqlenginemanager/macros/executeSffFacetAgentQuery.mc.xml":[0,0,0,0,0,0,0,12,12], "Bundle: tqlenginemanager/macros/getEngineSettings.mcSffTqlFacet.xml":[0,0,0,0,0,0,10,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], "Bundle: tqlenginemanager/facets/networkStatus.af.xml":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,10,1], "Bundle: tqlenginemanager/macros/executeSffFacetAgentQuery.mc.xml":[0,0,0,0,0,0,0,0,0,0,20,2], "SffTqlFacet.xml":[0,0,0,0,0,0,0,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42,21,0,0,1,0,0,0,0,0,0,01,0,0,0,0,0,0,0,0,0,02,02,0,0,0,0,0,0,0,0,0,0,0,0,2,1], "Resource SffTqlFacet.xml":[0,0,10,10,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,038,19,0,0,038,019,0,0,0,0,0,0,0,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,0,0,0,0,02,0,1,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,2,1], "Resource SffTqlFacet.xml":[0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,38,19,0,0,38,19,0,0,0,0,0,0,0,19,0,04,02,0,0,0,0,0,0,0,0,0,0,0,0,038,019,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,022,011,0,0,011,011,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,011,0,0,0,0,0,0,0,0,0,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,3820,1910,0,0,010,0,0,0,0,0,0,010,0,0,0,0,0,0,0,0,22,11,0,02,112,11,0,0,0,0,0,0,0,0,0,0,0,0,020,0,0,10], "resources/hellotql/facets//tempfacetserial.tf.xml":[0,0,0,0,0,0,0,0,0,0,0,0,0,11,0,0,0,0,0,0,0,0,010,0,0,0,0,0,0,0,0,010,0,0,0,0,20,10,0,0,10,0,0,0,0,0,0,10,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,01,0,0,20,101], "resources/hellotql/facetsmacros//tempfacetserialexecutequery.tfmc.xml":[0,0,0,0,0,0,0,0,36,0,0,0,18], "Bundle: tqlenginemanager/facets/logSearchFacet.fs.xml":[0,0,0,0,0,1], "Bundle: tqlenginemanager/macros/checkForInternetAvailability.mc.xml":[0,0,0,0,0,101,0,0,0,0,0,0,0,0,0,100,0,0,0,0,0,0,101,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1], "Bundle: tqlenginemanager/macros/getMemoryInfo.mc.xml":[0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,1,0,1], "resources/hellotql/macros/executequery.mc.xml":[0,0,0,0,0,0,0,0,360,0,0,0,18], "Bundle: tqlenginemanager/facets/logSearchFacet.fs.xml":[0,0,0,0,0,1], "Bundle: tqlenginemanager/macros/checkForInternetAvailability.mc.xml":[0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,1,1,1,1], "Bundle: tqlenginemanager/macros/getMemoryInfo.mc.xml":[0,0,0,0,0,1,0,0,1,1,0,0,0,1,0,1,0,0,0,0,1,0,01,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,0,0,0,0,0,0,0,01], "/Users/baseerkhan/iot/atomiton/development/latest/prime/resources/hellotql/deploy/GenericTQLInterface.mqp.xml":[0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,01,01,01,01,01,1,1], "/Users/baseerkhan/iot/atomiton/development/latest/prime/resources/hellotql/deploy/GenericTQLInterface.mqp.xml":[0,10,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,1,1,1,1,1,10,1,0,0,0,0,0,0,12,0,2,0,0,0,0,0,12,0,0,0,0,0,0,1,0,02,0,04,02,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,2,0,2,0,0,0,0,02,2,0,0,0,0,0,0,0,2,0,4,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,01,01,01,0,1], "Bundle: tqlenginemanager/macros/executeQuery.mc.xml":[0,0,0,0,0,0,0,0,020,0,10], "Bundle: tqlenginemanager/facets/upgradeService.fs.xml":[0,0,0,0,1,1,2,1,0,0,0,0,0,0,0,0,0,0,0,0,20,20,0,1,1,0,1,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,1,1,1,1], "Inline":[0,2], "Bundle: tqlenginemanager/macros/executeQueryexecuteRemoteQuery.mc.xml":[0,0,0,0,0,0,0,0,20,10], "Bundle: tqlenginemanager/facets/upgradeService.fs.xml":[0,2,2,0,0,0,0,10,10,20,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,2], "/sff/tqlenginemanager/deploy/tqlenginemanager.mqp.xml":[0,1,0,0,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,1], "Inline":[0,0,2], "Bundle: tqlenginemanager/macros/executeRemoteQuery.mc.xml":[0,0,0,0,0,0,0,0,0,0,2,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,2], "/sff/tqlenginemanager/deploy/tqlenginemanager.mqp.xml":[01,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,10,1,10,0,0,0,0,01,0,0,0,01,01,01,01,01,01,01,0,0,0,0,0,0,0,0,0,0,01,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,0,0,0,0,01,0,0,0,0,0,01,0,0,0,0,01,0,1,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,01,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,01,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,01,01,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,0,0,0,0,0,0,01,0,0,0,0,0,0,0,1,1,], "SffTqlPolicyFacet.xml":[0,0,0,0,0,0,0,0,0,0,2], "Bundle: tqlenginemanager/macros/scheduleJob.mc.xml":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2], "resources/hellotql/macros/setsimulatedtemp.mc.xml":[0,0,0,0,19,0,0,0,9], "/sff/tqlenginemanager/facets/appStartupInitialization.fs.xml":[0,1,0,0,2,1,0,0,0,0,0,0,0,1], "SffTqlPolicyFacet.xml":[0,0,0,0,1,1,1,0,0,0,0,1,1,0,0,2], "Bundle: tqlenginemanager/macros/scheduleJob.mc.xml":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,2], "resources/hellotql/macros/setsimulatedtemp.mc.xml":[0,0,0,0,0,9,0,0,0,9], "/sff/tqlenginemanager/facets/appStartupInitialization.fs.xml":[0,1,0,0,2,1,0,0,0,0,0,0,02,01,0,0,0,1,1,1,0,0,0,0,1,1,0,0,01], "Bundle: tqlenginemanager/facets/loggerFacet.fs.xml":[0,0,0,0,0,1,0,0,0,0,0,0,0,1,1,1], "Bundle: tqlenginemanager/facets/engineActivationFacet.fs.xml":[0,0,0,0,0,1,2,1,0,0,1,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,20,10,0,0,0,0,0,0,0,10,10,1], "Bundle: tqlenginemanager/facets/loggerFacet.fs.xml":[0,0,0,0,0,01,1,0,0,0,0,0,0,0,10,1,1], "Bundle: tqlenginemanager/facets/engineActivationFacet.fs.xml":[00,0,0,0,0,0,1,2,1,0,0,10,10,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,0,01,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,01,0,01,0,1,1,0,0,01,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,10,0,10,0,0,1,0,01,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1], "Bundle: tqlenginemanager/macros/checkForEngineUpgrade.mc.xml":[0,0,0,0,0,01,0,0,0,01,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,01,0,01,01,01,0,01,0,0,0,0,0,0,0,0,0,0,1], "Bundle: tqlenginemanager/macros/checkForEngineUpgrade.mc.xml":[0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,01,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,01,01,01,01,01,01,01,01,01,01,01,0,0,1,1,0,0,1], "resources/hellotql/macros/schedulejob.mc.xml":[0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,9], "Bundle: tqlenginemanager/facets/engineMonitoringActivation.fs.xml":[0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1] } |
Determine TQL Code Coverage
Prerequisites
One of the prerequisite is to determine the number of source files, executable code line number for each of the source file. It would be ideal to generate the source code line numbers in a same array format as reported by A-Stack code coverage.
Pseudo code to generate source file line number array
- Input to the pre-processing code can be parent directory name under which all the source code files are present
- Make a list of all the source code file names
- Iterate through each file in the list from (2) and create a array whose index is the line number and value is 1 if the line is a TQL instruction (example, Process, JavaScript, Workflow, Invoke, etc)
- Output the array in the format [ 0,0,0,
...
- 1,
...
- 1,
...
- 1,0,
...
- 1 ]
Calculating code coverage
Once you have prerequisite data, you can take the code coverage data generated by A-Stack and determine the coverage. The table below will help you give examples -
Source File | Lines # of executable instruction (Found from prerequisite) | Line Number reported in array with value > 0 | Number of non-zero value source lines (say, sl) | Number of lines covered by tests (say, cl) | Code Coverage cc = (100*cl)/sl |
---|---|---|---|---|---|
resources/hellotql/macros/ |
...
executequery.mc.xml |
...
[0,0,0,0,0,0,0,0 |
...
,1, |
...
0,0,0, |
...
1] | [0,0,0,0, |
...
0,0,0,0, |
...
36,0,0,0, |
...
18] | 2 | 2 | 100% | ||
list all your files here | .. | .. | .. | ||
TOTAL | . | .. | Total coverage value |