Added testcase for validating power sensors

Signed-off-by: Jayashree-D <jayashree-d@hcl.com>
Change-Id: Ie1356e7859423d302f499ab246aeed859234f521
diff --git a/tests/test_hardware_sensors.robot b/tests/test_hardware_sensors.robot
index b1ce766..2d2d40b 100644
--- a/tests/test_hardware_sensors.robot
+++ b/tests/test_hardware_sensors.robot
@@ -226,6 +226,34 @@
      Should Be True  ${vddr_temp} > 0
    END
 
+Verify Power Sensors Attributes
+   [Documentation]  Check power sensor attributes.
+   [Tags]  Verify_Power_Sensor_Attributes
+   # Example:
+   # /xyz/openbmc_project/sensors/power/power_1
+   # /xyz/openbmc_project/sensors/power/power_2
+   # /xyz/openbmc_project/sensors/power/power0
+   # /xyz/openbmc_project/sensors/power/POWER1
+   # /xyz/openbmc_project/sensors/power/POWER_1
+
+   ${power}=  Get Endpoint Paths  /xyz/openbmc_project/sensors/  power*
+
+   # Access the properties of the power sensors and it should contain
+   # the following entries:
+   # /xyz/openbmc_project/sensors/power/power_1
+   # {
+   #     "MaxValue": 255.0,
+   #     "MinValue": 0.0,
+   #     "Unit": "xyz.openbmc_project.Sensor.Value.Unit.Watts",
+   #     "Value": 0.0
+   # }
+
+   FOR  ${entry}  IN  @{power}
+     ${resp}=  OpenBMC Get Request  ${entry}
+     ${json}=  To JSON  ${resp.content}
+     Run Keyword And Ignore Error  Should Be True  ${json["data"]["Target"]} >= 0
+     Should Be True  ${json["data"]["Value"]} >= 0
+   END
 
 Verify Power Redundancy Using REST
    [Documentation]  Verify power redundancy is enabled.