htf - Hardware Testing Framework

htf is a professional Hardware Testing Framework based on Python to easily realize Automated Hardware Tests. It has a strong focus on reporting, industrial applications and functional safety and integrates seamlessly with Continuous Integration and Continuous Delivery as well as end-of-line testing systems.

What makes htf special?

  • It is validated and certified for ISO/TR 80002-2: Medical device software - Part 2: Validation of software for medical device quality systems (see also certifications documentation).

  • It allows you to build teststands using Python-based tests for realtime testing with diverse hardware (PLC, Development-Boards, PyVisa, Arduino etc.).

  • It supports Behaviour Driven Development (BDD) to write low-code tests without prior coding experience.

  • It enables you to implement powerful tests in plain Python, too.

  • It provides you with the possibility to run interactive testing in case full automation is not possible and manual tests are required.

  • It produces visual Test Reports which can be showed to your clients or stakeholders.

  • It integrates seamlessly with QABench, which means it works smoothly with our Dashboard, allowing for easy management and tracking of requirements coverage.

  • It can be used for free with the community edition.

The framework can be easily extended to your liking, either by yourself or with our support. If you need help or have questions of any kind, send us an e-mail.

If you prefer video showcases, take a look at our demo.

Test Examples

Behavior Driven Development:

Feature: Device Boot
  Requirements: REQ-Boot-1
  Tags: boot

  Scenario: Boot Device
    Given the device is shut down
    And the power supply is set to 0 V
    When the power supply is switched 24 V
    And the power button is set to on
    Then the device boots up
    And the device is be running after 10 seconds

Python:

@requirements("REQ-Boot-1")
@tag("boot")
async def test_boot(device, power_supply, delay):
   """
   This tests checks that the device can be booted.
   """
   with step("Shut down device"):
      await device.shut_down()
      await power_supply.power_off()

   with step("Switch on device"):
      await power_supply.power_on()
      await device.switch_on()

   with step("Check that the device boots up within 10 s"):
      delay(10)
      assert_true(device.is_up_and_running(), "The device did not boot up within 10 s")

Getting Started

To get started, take a look at the installation instructions, the introduction and how to write tests, fixtures and available test reports.

Learn how to run tests from the command line and Python scripts.

If you prefer a more guided introduction take a look at our HILSTER Testing Framework Demonstrator.

Example

import htf

def test_example(step, assertions, attachments, threads):
   with step("Tests can be structured with steps"):
      assertions.assert_true(True, "This step succeeds")

      with step("Attach a file if the outer step succeeds"):
         attachments.attach_file("graph.png", "Important graph")

   with step("Run something in the background"):
      def tick():
         while True:
            print('tick')
      threads.run_background(tick)


if __name__ == "__main__":
   htf.main()

Contact

The framework can be easily extended to your liking, either by yourself or with our support.

If you have any questions or ideas, please don’t hesitate and e-mail us via support@hilster.io.

Documentation