Scenarios

Scenarios describe what you need. They define the tests and the necessary devices for them. Here you can find all scenarios that are implemented in this BalderHub package.

Note

This BalderHub project doesn’t have any scenarios.

Heart-Rate-Monitor Profile Scenarios

class balderhub.ant.scenarios.hrm.BaseHrmScenario

Bases: Scenario

Base test scenario for working with Heart-Rate Monitor devices

class HeartRateHost

Bases: Device

device receiving the heart rate data

class HeartRateSensor

Bases: Device

device detecting the row heart rate

class balderhub.ant.scenarios.hrm.ScenarioHrmBatteryMeasuring

Bases: BaseHrmScenario

Test Scenario validating the sending of the correct battery values when the battery level is changed

class BatterySimulator

Bases: Device

device manipulating the battery voltage

class Heart

Bases: Device

device simulating a heart beat

class HeartRateHost

Bases: HeartRateHost

device receiving the heart rate data

class HeartRateSensor

Bases: HeartRateSensor

device detecting the row heart rate

chest_strap(heart_beat_established)

make sure that the chest strap is attached, before entering the variation

disconnect_if_necessary()

fixture that makes sure that current sensor is disconnected

heart_beat_established(disconnect_if_necessary)

make sure that heart beat is established, before entering the variation

power_off_device(disconnect_if_necessary, heart_beat_established, chest_strap)

make sure that the device is powered off, before entering the variation

test_check_different_measurements(battery_level)

Test that validates if the different battery levels are presented by the dut while changing them with the battery simulator.

Parameters:

battery_level – feature paramized battery level (provided by BatteryTestCriteriaConfig.validation_with_battery_levels())

wait_for_reset(power_off_device)

wait a second before entering any testcase

class balderhub.ant.scenarios.hrm.ScenarioHrmDeviceProfileFullTransmissionPattern(*args, **kwargs)

Bases: BaseHrmScenario

Test scenario that observes a full ANT transmission pattern time frame and then validates requirements defined in the HRM device profile

class BatterySimulator

Bases: Device

device manipulating the battery voltage

class Heart

Bases: Device

heart beat simulating device

class HeartRateHost

Bases: HeartRateHost

device receiving the heart rate data

class HeartRateSensor

Bases: HeartRateSensor

device detecting the row heart rate

ant_is_disconnected(device_powered_on)

make sure that ANT is disconnected, before entering the variation

chest_strap_attached(heart_beat_established)

make sure that chest strap is attached, before entering the variation

device_powered_on(heart_beat_established, chest_strap_attached)

make sure that device is powered on, before entering the variation

heart_beat_established()

make sure that heart beat is established, before entering the variation

property min_expected_heart_beats
Returns:

returns the minimum expected heart beats according to the observation time given in ScenarioHrmDeviceProfileFullTransmissionPattern.total_observing_time() divided by heart beat frequency

run_transmission_pattern_session(ant_is_disconnected)

fixture that runs the recoding session - during this fixture the normal transmission pattern is recorded, which will be analyzed by the tests within this scenario

test_background_page_1_operating_time()

This test validates the content of the background page 1, which was sent during the session, if it was expected, that this page is an active background page.

test_background_page_2_manufacturer()

This test validates the content of the background page 2, which was sent during the session, if it was expected, that this page is an active background page.

test_background_page_3_product()

This test validates the content of the background page 3, which was sent during the session, if it was expected, that this page is an active background page.

test_background_page_6_capabilities()

This test validates the content of the background page 6, which was sent during the session, if it was expected, that this page is an active background page.

test_background_page_7_battery()

This test validates the content of the background page 7, which was sent during the session, if it was expected, that this page is an active background page.

test_background_page_9_device_info()

This test validates the content of the background page 9, which was sent during the session, if it was expected, that this page is an active background page.

test_general_profile_consistency()

This test executed the profile validation method AntplusControllerHrmFeature.validate_profile_consistency() that validates all general valid conditions of the profile.

test_main_page_0_default()

This test validates the content of the main page 0, if it is expected that this page is the main page.

test_main_page_4_previous_beat()

This test validates the content of the main page 4, if it is expected that this page is the main page.

test_no_other_background_pages_exists()

test that validates that every expected background page is within the recorded pages

test_no_other_main_pages_exists()

test that validates that no other main pages, then the expected one, are within the recorded pages

test_validate_heart_beat_counts()

This test reads all messages and makes sure that there is no beat loss.

test_validate_heart_beat_event_time()

This test reads the beat time of all events and check that these values have a exact diff-time of the set heart rate.

property total_observing_time
Returns:

returns the total observing time calculated based on ScenarioHrmDeviceProfileFullTransmissionPattern.transmission_pattern_duration_sec() multiplied with ScenarioHrmDeviceProfileFullTransmissionPattern.transmission_pattern_sequence_count()

property transmission_pattern_duration_sec

expected seconds to receive a full transmission pattern

property transmission_pattern_sequence_count

amount of transmission pattern sequences that should be waited for receiving the initial data

class balderhub.ant.scenarios.hrm.ScenarioManualRequestForAck

Bases: BaseHrmScenario

Test scenario for validating the correct responses when sending a Common70RequestDataPage and ask for ACK messages as response. This scenario tests every possible background page and expects that the HR-Sensor responses with an ACK message as answer. It also validates its content.

In case the page is not mentioned within AntplusHrmDeviceConfig.manual_request_possible_for(), the tests within this scenario expect that the DUT does not respond with the requested page. Instead, it just continues its usual messages without sending anything as ACK.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() returns true every test within this scenario expects, that the DUT responds with a BROADCAST message even when requested for an ACK message (like it is done with every page-request within this scenario).

class BatterySimulator

Bases: Device

device manipulating the battery voltage

class Heart

Bases: Device

device simulating the heart beat

class HeartRateHost

Bases: HeartRateHost

device receiving the heart rate data

class HeartRateSensor

Bases: HeartRateSensor

device detecting the row heart rate

ant_connected(chest_strap_attached)

fixture that ensures that ANT channel is open, before entering the variation

chest_strap_attached(heart_beat_established)

fixture that ensures that the chest strap is attached, before entering the variation

device_powered_on()

fixture that ensures that the device is powered on, before entering the variation

classmethod get_page_to_send(page_to_request: type[balderhub.ant.lib.utils.pages.hrm.base_hrm_page.BaseHrmPage], transmit_no: int) Common70RequestDataPage

Helper method to get the Request-Data-Page object filled with the given data

Parameters:
  • page_to_request – the page that should be requested

  • transmit_no – the requested transmit number

Returns:

the filled and ready to send request-page

heart_beat_established(device_powered_on)

fixture that ensures that the heart beat is active, before entering the variation

test_ack_page_1_operating_time(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm1CumulativeOperationTimePage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_ack_page_2_manufacturer(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm2ManufacturerInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_ack_page_3_product(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm3ProductInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_ack_page_6_capabilities(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm6CapabilitiesPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_ack_page_7_battery(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm7BatteryStatusPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_ack_page_9_device_info(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a ACK message of Hrm9DeviceInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If AntplusHrmDeviceConfig.manual_request_redirect_ack_as_broadcast() is True, the test validates that the DUT responds with a BROADCAST message instead of responding with the requested ACK message.

Depending on what is expected, the test also checks that no messages from requested type arrive as ACK or BROADCAST if this is not expected.

If the test expects a response it will also validate the content of the messages.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

class balderhub.ant.scenarios.hrm.ScenarioHrmManualRequestForBrdcst

Bases: BaseHrmScenario

Test scenario for validating the correct responses when sending a Common70RequestDataPage and ask for BROADCAST messages as response. This scenario tests every possible background page and expects that the HR-Sensor responses with an BROADCAST message as answer. It also validates its content.

In case the page is not mentioned within AntplusHrmDeviceConfig.manual_request_possible_for(), the tests within this scenario expect that the DUT does not respond with the requested page. Instead, it just continues its usual messages without sending anything as ACK.

class BatterySimulator

Bases: Device

device manipulating the battery voltage

class Heart

Bases: Device

heart beat simulating device

class HeartRateHost

Bases: HeartRateHost

device receiving the heart rate data

class HeartRateSensor

Bases: HeartRateSensor

device detecting the row heart rate

ant_connected(chest_strap_attached)

fixture that ensures that ANT channel is open, before entering the variation

chest_strap_attached(heart_beat_established)

fixture that ensures that the chest strap is attached, before entering the variation

device_powered_on()

fixture that ensures that the device is powered on, before entering the variation

classmethod get_page_to_send(page_to_request: type[balderhub.ant.lib.utils.pages.hrm.base_hrm_page.BaseHrmPage], transmit_no: int) Common70RequestDataPage

Helper method to get the Request-Data-Page object filled with the given data

Parameters:
  • page_to_request – the page that should be requested

  • transmit_no – the requested transmit number

Returns:

the filled and ready to send request-page

heart_beat_established(device_powered_on)

fixture that ensures that the heart beat is active, before entering the variation

test_brdcst_page_1_operating_time(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm1CumulativeOperationTimePage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_brdcst_page_2_manufacturer(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm2ManufacturerInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_brdcst_page_3_product(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm3ProductInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_brdcst_page_6_capabilities(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm6CapabilitiesPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_brdcst_page_7_battery(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm7BatteryStatusPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent

test_brdcst_page_9_device_info(transmit_no: int)

Test that validates the correct behavior, when the controller ask for a BROADCAST message of Hrm9DeviceInformationPage. The test validates that the DUT answers the correct count of requested messages, when the page is mentioned in AntplusHrmDeviceConfig.manual_request_possible_for(). Otherwise, it will ensure that the DUT ignores the request.

If the test expects a response it will also validate the content of the messages. Additionally, it makes sure that no messages are sent as ACK because it requests BROADCAST messages only.

Parameters:

transmit_no – PARAMETRIZED value describing the requested times the message should be sent