View Issue Details

IDProjectCategoryView StatusLast Update
0005644Compliance Test Tool (CTT) Unified Architecture1 - Script Issuepublic2020-05-22 14:22
ReporterMatti Siponen Assigned ToAlexander Allmendinger  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.04.09.394 
Fixed in Version1.03.341.396 
Summary0005644: Attribute Services / Attribute Write Values / 003.js only tests one of the configured Nodes
Description

The code that performs the test for different Nodes has been misplaced outside a for-loop that selects the Node to test. This results in testing only the last one of the configured Nodes instead of testing all of them.

This also effects CTT version 1.04.09.395.

Additional Information

This test script can be fixed by replacing the following lines of code starting from line 14

for( var t=0; t<items.length; t++ ){
    addLog("Testing type: " + getDataTypeNameFromNodeId( "i=" + UaNodeId.GuessType( items[t].NodeSetting ) ) );

    // first, create our list of items to write, and values.
    var values = [];
    var itemsByType = [];
    for ( var i = 0; i < 5; i++ ) { // i=item
        itemsByType.push( MonitoredItem.Clone( items[t], { IncludeValue: true } ) );
        for ( var v = i; v < 5; v++ ) {
            if ( isNaN( itemsByType[i].Value.Value ) ) UaVariant.SetValueMin( { Item: itemsByType[i] } );
            else UaVariant.Increment( { Item: itemsByType[i] } );
        }
        values.push( itemsByType[i].Value.Value );
    }
}
// second, write the values. Read them back...
WriteHelper.Execute({ NodesToWrite: itemsByType, ReadVerification: false } );
ReadHelper.Execute( { NodesToRead: itemsByType, TimestampsToReturn: TimestampsToReturn.Server, MaxAge: 0 } );

// compare the value received is the same for all values
var firstValue = itemsByType[0].Value.Value;
Assert.ValueInValues( firstValue, values, "Expected a value that was previously written. According to the specification a write should return after the write operation has been completed otherwise the server needs to return a Good_CompletesAsynchronously." );

addLog( "Checking that all returned values match: " + firstValue );
for ( var i = 1; i < ReadHelper.Response.Results.length; i++ ) {
    if ( !firstValue.equals( ReadHelper.Response.Results[i].Value ) ) addError( "Read.Response.Results[" + i + "].Value mismatch." ); result = false;
}//for i...
return ( result );

with the following lines of code

for( var t=0; t<items.length; t++ ){
    addLog("Testing type: " + getDataTypeNameFromNodeId( "i=" + UaNodeId.GuessType( items[t].NodeSetting ) ) );

    // first, create our list of items to write, and values.
    var values = [];
    var itemsByType = [];
    for ( var i = 0; i < 5; i++ ) { // i=item
        itemsByType.push( MonitoredItem.Clone( items[t], { IncludeValue: true } ) );
        for ( var v = i; v < 5; v++ ) {
            if ( isNaN( itemsByType[i].Value.Value ) ) UaVariant.SetValueMin( { Item: itemsByType[i] } );
            else UaVariant.Increment( { Item: itemsByType[i] } );
        }
        values.push( itemsByType[i].Value.Value );
    }

    // second, write the values. Read them back...
    WriteHelper.Execute({ NodesToWrite: itemsByType, ReadVerification: false } );
    ReadHelper.Execute( { NodesToRead: itemsByType, TimestampsToReturn: TimestampsToReturn.Server, MaxAge: 0 } );

    // compare the value received is the same for all values
    var firstValue = itemsByType[0].Value.Value;
    Assert.ValueInValues( firstValue, values, "Expected a value that was previously written. According to the specification a write should return after the write operation has been completed otherwise the server needs to return a Good_CompletesAsynchronously." );

    addLog( "Checking that all returned values match: " + firstValue );
    for ( var i = 1; i < ReadHelper.Response.Results.length; i++ ) {
        if ( !firstValue.equals( ReadHelper.Response.Results[i].Value ) ) addError( "Read.Response.Results[" + i + "].Value mismatch." ); result = false;
    }//for i...            
}        
return ( result );
TagsNo tags attached.
Files Affected

Activities

Alexander Allmendinger

2020-05-17 13:51

developer   ~0012065

As pointed out by Matti, the for loop was ending to early and therefore only verify one configured scalar instead of all of them. Moved the close for the for-loop to the end of the script so now every configured item is being tested.

Paul Hunkar

2020-05-22 14:22

administrator   ~0012093

reviewed in CMP call

Issue History

Date Modified Username Field Change
2020-05-14 10:02 Matti Siponen New Issue
2020-05-15 17:55 Paul Hunkar Assigned To => Alexander Allmendinger
2020-05-15 17:55 Paul Hunkar Status new => assigned
2020-05-17 13:51 Alexander Allmendinger Status assigned => resolved
2020-05-17 13:51 Alexander Allmendinger Resolution open => fixed
2020-05-17 13:51 Alexander Allmendinger Fixed in Version => 1.03.341.396
2020-05-17 13:51 Alexander Allmendinger Note Added: 0012065
2020-05-22 14:22 Paul Hunkar Status resolved => closed
2020-05-22 14:22 Paul Hunkar Note Added: 0012093