Skip to content

google/mobly-windows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Mobly Windows Controller

Mobly Windows controller module for using Python code to operate Windows devices in Mobly tests.

Requirements

  • Python 3.7+
  • Mobly 1.12.2+

Installation

pip install mobly-windows

Start to Use

Mobly Windows controller is an add-on module to control Windows devices in Mobly. To learn more about Mobly, visit Getting started with Mobly.

Write Mobly Device Configs

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.

Write a Hello World Mobly Test

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()

Execute the Test

python hello_world_test.py -c sample_config.yaml

Expect: The system information of the Windows device under test is logged in your console.

About

Mobly Windows controller module for using Python code to operate Windows devices in Mobly tests.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages