Skip to main content

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

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mobly-windows-1.0.0.tar.gz (34.3 kB view hashes)

Uploaded Source

Built Distribution

mobly_windows-1.0.0-py3-none-any.whl (37.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page