Skip to content

Commit

Permalink
WindowCovering add mandatory commands test case (#9496)
Browse files Browse the repository at this point in the history
* WC: Add new test cases

* WC: Add Mandatory Command support in all cluster app

* WC: Add autogen test case generated  + add WindowCovering handler in all cluster app

* WC: Add missing StopMotion as weak callback definition

* Restyled by whitespace

* Restyled by clang-format

* Restyled by prettier-yaml

* WC: Yaml remove useless returnValue checks

* WC: Update autogen Zap

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
jmeg-sfy and restyled-commits authored Sep 20, 2021
1 parent 8319ab0 commit 80f7986
Show file tree
Hide file tree
Showing 11 changed files with 1,253 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9286,23 +9286,23 @@
"code": 0,
"mfgCode": null,
"source": "client",
"incoming": 0,
"incoming": 1,
"outgoing": 0
},
{
"name": "DownOrClose",
"code": 1,
"mfgCode": null,
"source": "client",
"incoming": 0,
"incoming": 1,
"outgoing": 0
},
{
"name": "StopMotion",
"code": 2,
"mfgCode": null,
"source": "client",
"incoming": 0,
"incoming": 1,
"outgoing": 0
},
{
Expand Down Expand Up @@ -17539,4 +17539,4 @@
}
],
"log": []
}
}
1 change: 1 addition & 0 deletions examples/all-clusters-app/esp32/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ set(SRC_DIRS_LIST
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/application-launcher-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/audio-output-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/barrier-control-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/window-covering-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/general-commissioning-server"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/network-commissioning"
"${CMAKE_SOURCE_DIR}/third_party/connectedhomeip/src/app/clusters/groups-server"
Expand Down
2 changes: 1 addition & 1 deletion examples/chip-tool/templates/tests-commands.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

#include <commands/tests/TestCommand.h>

{{>test_cluster tests="TV_TargetNavigatorCluster, TV_AudioOutputCluster, TV_ApplicationLauncherCluster, TV_KeypadInputCluster, TV_AccountLoginCluster, TV_WakeOnLanCluster, TV_ApplicationBasicCluster, TV_MediaPlaybackCluster, TV_TvChannelCluster, TV_LowPowerCluster, TV_MediaInputCluster, TestCluster, TestConstraints, TestDelayCommands, TestSubscribe_OnOff, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1, Test_TC_CC_3_4, Test_TC_CC_5, Test_TC_CC_6, Test_TC_CC_7, Test_TC_CC_8, Test_TC_WNCV_1_1, Test_TC_WNCV_2_1, Test_TC_BI_1_1, Test_TC_FLW_1_1, Test_TC_TM_1_1, Test_TC_OCC_1_1, TestOperationalCredentialsCluster, Test_TC_LVL_1_1, Test_TC_CC_1_1, Test_TC_RH_1_1, Test_TC_MC_1_1, Test_TC_TSTAT_1_1, Test_TC_PCC_1_1, Test_TC_TSUIC_1_1"}}
{{>test_cluster tests="TV_TargetNavigatorCluster, TV_AudioOutputCluster, TV_ApplicationLauncherCluster, TV_KeypadInputCluster, TV_AccountLoginCluster, TV_WakeOnLanCluster, TV_ApplicationBasicCluster, TV_MediaPlaybackCluster, TV_TvChannelCluster, TV_LowPowerCluster, TV_MediaInputCluster, TestCluster, TestConstraints, TestDelayCommands, TestSubscribe_OnOff, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1, Test_TC_CC_3_4, Test_TC_CC_5, Test_TC_CC_6, Test_TC_CC_7, Test_TC_CC_8, Test_TC_WNCV_1_1, Test_TC_WNCV_2_1, Test_TC_WNCV_3_1, Test_TC_WNCV_3_2, Test_TC_WNCV_3_3, Test_TC_BI_1_1, Test_TC_FLW_1_1, Test_TC_TM_1_1, Test_TC_OCC_1_1, TestOperationalCredentialsCluster, Test_TC_LVL_1_1, Test_TC_CC_1_1, Test_TC_RH_1_1, Test_TC_MC_1_1, Test_TC_TSTAT_1_1, Test_TC_PCC_1_1, Test_TC_TSUIC_1_1"}}

12 changes: 12 additions & 0 deletions src/app/clusters/window-covering-server/window-covering-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,18 @@ bool emberAfWindowCoveringClusterDownOrCloseCallback(chip::EndpointId endpoint,
return true;
}

/**
* @brief Cluster StopMotion Command callback (from client)
*/
bool __attribute__((weak))
emberAfWindowCoveringClusterStopMotionCallback(chip::EndpointId endpoint, chip::app::CommandHandler * commandObj)
{
emberAfWindowCoveringClusterPrint("StopMotion command received");

emberAfSendImmediateDefaultResponse(EMBER_ZCL_STATUS_SUCCESS);
return true;
}

/**
* @brief Cluster GoToLiftValue Command callback (from client)
*/
Expand Down
110 changes: 110 additions & 0 deletions src/app/tests/suites/certification/Test_TC_WNCV_3_1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Window Covering [TC-WNCV-3.1] UpOrOpen Verification with server as DUT

# TODO: WindowCovering tests TC-WNCV-3.1 finalize featuremap conditional dependencies

config:
cluster: "Window Covering"
endpoint: 1

tests:
### Step 1x -> Initialize Position
### MANDATORY Command
- label: "1a: TH adjusts the the DUT to a non-open position"
command: "DownOrClose"

### Depends on the FeatureMap
- label:
"1b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"1b: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionTiltPercent100ths"
response:
constraints:
type: uint16

### Step 2x -> Check Command instant effect
### MANDATORY Command
- label: "2a: TH sends UpOrOpen command to DUT"
command: "UpOrOpen"

### Depends on the FeatureMap
- label:
"2b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionTiltPercent100ths"
response:
constraints:
type: uint16

### Depends on a sleep/wait command how to do this with a real device
- label: "2d: Wait for the movement to finish"
disabled: true

### Step 3x -> Check longer period effect
### MANDATORY reads
- label: "3a: TH reads OperationalStatus attribute from DUT"
command: "readAttribute"
attribute: "OperationalStatus"
response:
value: 0

### Depends on the FeatureMap
- label:
"3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionTiltPercent100ths"
response:
constraints:
type: uint16
110 changes: 110 additions & 0 deletions src/app/tests/suites/certification/Test_TC_WNCV_3_2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Window Covering [TC-WNCV-3.2] DownOrClose Verification with server as DUT

# TODO: WindowCovering tests TC-WNCV-3.2 finalize featuremap conditional dependencies

config:
cluster: "Window Covering"
endpoint: 1

tests:
### Step 1x -> Initialize Position
### MANDATORY Command
- label: "1a: TH adjusts the the DUT to a non-closed position"
command: "UpOrOpen"

### Depends on the FeatureMap
- label:
"1b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"1b: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionTiltPercent100ths"
response:
constraints:
type: uint16

### Step 2x -> Check Command instant effect
### MANDATORY Command
- label: "2a: TH sends DownOrClose command to DUT"
command: "DownOrClose"

### Depends on the FeatureMap
- label:
"2b: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"2c: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionTiltPercent100ths"
response:
constraints:
type: uint16

### Depends on a sleep/wait command how to do this with a real device
- label: "2d: Wait for the movement to finish"
disabled: true

### Step 3x -> Check longer period effect
### MANDATORY reads
- label: "3a: TH reads OperationalStatus attribute from DUT"
command: "readAttribute"
attribute: "OperationalStatus"
response:
value: 0

### Depends on the FeatureMap
- label:
"3b: If (PA & LF) TH reads CurrentPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionLiftPercent100ths"
response:
constraints:
type: uint16

### Depends on the FeatureMap
- label:
"3c: If (PA & TL) TH reads CurrentPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionTiltPercent100ths"
response:
constraints:
type: uint16
87 changes: 87 additions & 0 deletions src/app/tests/suites/certification/Test_TC_WNCV_3_3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
# Copyright (c) 2021 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

name: Window Covering [TC-WNCV-3.3] StopMotion Verification with server as DUT

# TODO: WindowCovering tests TC-WNCV-3.3 finalize featuremap conditional dependencies

config:
cluster: "Window Covering"
endpoint: 1

tests:
### Step 1x -> Initialize Position
### MANDATORY Command
- label: "1a: TH adjusts the the DUT to a non-open position"
command: "UpOrOpen"

### Depends on a sleep/wait command how to do this with a real device
- label: "1b: Wait for the movement to start and go on for a few seconds"
disabled: true

### Step 2x -> Check Command instant effects + longer effects
### MANDATORY Command
- label: "2a: TH sends StopMotion command to DUT"
command: "StopMotion"

### MANDATORY reads
- label: "2b: TH reads OperationalStatus attribute from DUT"
command: "readAttribute"
attribute: "OperationalStatus"
response:
value: 0

### 2c Check equality with a tolerance between Target & Current for Lift
### Depends on the FeatureMap
- label:
"2c-1: If (PA & LF) TH reads TargetPositionLiftPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionLiftPercent100ths"
response:
constraints:
type: uint16

- label:
"2c-2: If (PA & LF) TH reads CurrentPositionLiftPercent100ths
attribute from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionLiftPercent100ths"
response:
constraints:
type: uint16

### 2d Check equality with a tolerance between Target & Current for Tilt
### Depends on the FeatureMap
- label:
"2d-1: If (PA & TL) TH reads TargetPositionTiltPercent100ths attribute
from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "TargetPositionTiltPercent100ths"
response:
constraints:
type: uint16

- label:
"2d-2: If (PA & TL) TH reads CurrentPositionTiltPercent100ths
attribute from DUT"
disabled: true # Step applied conditionnally with an !expected response value
command: "readAttribute"
attribute: "CurrentPositionTiltPercent100ths"
response:
constraints:
type: uint16
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/templates/clusters-tests.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ CHIPDevice * GetPairedDevice(uint64_t deviceId)
[self waitForExpectationsWithTimeout:kTimeoutInSeconds handler:nil];
}

{{>test_cluster tests="TestCluster, TestConstraints, TestDelayCommands, TestSubscribe_OnOff, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1, Test_TC_CC_3_4, Test_TC_CC_5, Test_TC_CC_6, Test_TC_CC_7, Test_TC_CC_8, Test_TC_WNCV_1_1, Test_TC_WNCV_2_1, Test_TC_BI_1_1, Test_TC_FLW_1_1, Test_TC_TM_1_1, Test_TC_OCC_1_1, TestOperationalCredentialsCluster, Test_TC_LVL_1_1, Test_TC_CC_1_1, Test_TC_RH_1_1, Test_TC_MC_1_1, Test_TC_TSTAT_1_1, Test_TC_PCC_1_1, Test_TC_TSUIC_1_1"}}
{{>test_cluster tests="TestCluster, TestConstraints, TestDelayCommands, TestSubscribe_OnOff, Test_TC_OO_1_1, Test_TC_OO_2_1, Test_TC_OO_2_2, Test_TC_DM_1_1, Test_TC_DM_3_1, Test_TC_CC_3_4, Test_TC_CC_5, Test_TC_CC_6, Test_TC_CC_7, Test_TC_CC_8, Test_TC_WNCV_1_1, Test_TC_WNCV_2_1, Test_TC_WNCV_3_1, Test_TC_WNCV_3_2, Test_TC_WNCV_3_3, Test_TC_BI_1_1, Test_TC_FLW_1_1, Test_TC_TM_1_1, Test_TC_OCC_1_1, TestOperationalCredentialsCluster, Test_TC_LVL_1_1, Test_TC_CC_1_1, Test_TC_RH_1_1, Test_TC_MC_1_1, Test_TC_TSTAT_1_1, Test_TC_PCC_1_1, Test_TC_TSUIC_1_1"}}

{{#chip_client_clusters}}
{{#unless (isStrEqual "Test Cluster" name)}}
Expand Down
Loading

0 comments on commit 80f7986

Please sign in to comment.