Mobly Windows controller module for using Python code to operate Windows devices in Mobly tests.
- Python 3.7+
- Mobly 1.12.2+
pip install mobly-windows
Mobly Windows controller is an add-on module to control Windows devices in Mobly. To learn more about Mobly, visit Getting started with Mobly.
To use a Windows device in Mobly tests, first you need to write a config to specify the information of the device under test. For example:
sample_config.yaml
TestBeds:
- Name: SampleWindowsTestbed
Controllers:
WindowsDevice:
- device_id: 'DEVICE_ID'
hostname: 'IP_ADDRESS'
username: 'USERNAME'
password: 'PASSWORD'
NOTE: Replace DEVICE_ID
, IP_ADDRESS
, USERNAME
, PASSWORD
with your device information.
hello_world_test.py
"""A basic Mobly Test with Windows device."""
from mobly import base_test
from mobly import test_runner
from mobly.controllers.windows import windows_device
class HelloWorldTest(base_test.BaseTestClass):
"""A sample test demonstrating using Mobly Windows controller."""
def setup_class(self):
super().setup_class()
# Registers windows_device controller module. By default, we expect at
# least one Windows device.
self._wind = self.register_controller(windows_device)[0]
def test_ssh_execute_command(self):
# Executes console command 'SYSTEMINFO' on the Windows device and gets the result.
result = self._wind.ssh.execute_command('SYSTEMINFO')
self._wind.log.info('Command execution result: %s', result)
if __name__ == '__main__':
test_runner.main()
python hello_world_test.py -c sample_config.yaml
Expect: The system information of the Windows device under test is logged in your console.