Example #1
0
 def test_aqf_decorators(self):
     Aqf.hop()
     Aqf.step("Setup")
     #Aqf.sensor('sim.sensors.asc_wind_speed').get()
     # Set something on the simulator.
     Aqf.stepBold("Bold Setup")
     Aqf.stepline("Underlined Step")
     Aqf.wait(1)
     value_from_sensor = 10
     Aqf.equals(10, value_from_sensor,
                'Test that the sensor has a value of 10')
     Aqf.more(11, value_from_sensor,
              "Test that the sensor has a value more than 10")
     Aqf.less(6, value_from_sensor,
              "Test that the sensor has a value less than 10")
     Aqf.step("Set elevation limits")
     min_ap_elevation = 15.0
     max_ap_elevation = 90.0
     Aqf.in_range(30, min_ap_elevation, max_ap_elevation,
                  "Check if result falls within expected limits")
     Aqf.step("Check that result has a value almost equal")
     Aqf.almost_equals(
         10.2, value_from_sensor, 0.5,
         "Test that the sensor has an almost equal value to 10")
     Aqf.step("Give Minimum and Maximum Limits for AP Elevation")
     Aqf.array_almost_equal([15, 90], [min_ap_elevation, max_ap_elevation],
                            "Check max and min elevation")
     Aqf.step("Check is system in on.")
     system_on = True
     Aqf.is_true(system_on, 'Check that the system_on switch is set.')
     Aqf.step("Read the first message from the system.")
     ## Your Code here.
     message = 'hallo world'
     Aqf.equals('hallo world', message,
                'Check that "hallo world" is returned.')
     message = 'Hello world'
     Aqf.is_not_equals('hallo world', message,
                       'Check that "hallo world" is returned.')
     Aqf.step('Open KatGUI and observe sensors')
     Aqf.checkbox(
         'On the sensor display and observe that there are sensors')
     Aqf.step("Switch off.")
     Aqf.skipped("Skipped. We cannot switch the system off at the moment.")
     Aqf.step("Log into KatGUI")
     Aqf.keywait("Press Enter to continue")
     Aqf.step("Test TBD.")
     Aqf.waived("This next task has been waived")
     Aqf.tbd("TBD. Still to do test.")
     Aqf.wait(2, "Wait to proccess next step")
     Aqf.step("Add line at end of the test")
     linewidth = 100
     Aqf.addLine('_', linewidth)
     Aqf.end()
Example #2
0
def executed_by():
    """Get who ran the test."""
    try:
        user = pwd.getpwuid(os.getuid()).pw_name
        if user == 'root':
            raise OSError
        Aqf.hop('Test ran by: {} on {} system on {}.\n'.format(
            user,
            os.uname()[1].upper(), time.strftime("%Y-%m-%d %H:%M:%S")))
    except Exception as e:
        _errmsg = 'Failed to detemine who ran the test with %s' % str(e)
        LOGGER.error(_errmsg)
        Aqf.hop('Test ran by: Jenkins on system {} on {}.\n'.format(
            os.uname()[1].upper(), time.ctime()))
Example #3
0
def test_heading(heading):
    Aqf.hop('-' * 50)
    Aqf.stepBold(heading)
    Aqf.hop('-' * 50)