Skip to content
Snippets Groups Projects
Commit 02cabd9d authored by Sebastian's avatar Sebastian
Browse files

Add mobly test case and config

parent dcc6f76c
No related branches found
No related tags found
No related merge requests found
...@@ -15,3 +15,4 @@ ...@@ -15,3 +15,4 @@
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties local.properties
*.swp
...@@ -31,3 +31,7 @@ you can call the remote procedure `startActivity()` etc: ...@@ -31,3 +31,7 @@ you can call the remote procedure `startActivity()` etc:
>>> s.startActivity() >>> s.startActivity()
>>> s.startAdvertising() >>> s.startAdvertising()
>>> s.startDiscovery() >>> s.startDiscovery()
There's a mobly testbed configuration and script configured in
`mobly/mesh-run` see [mobly/mesh-run/README.md](mobly/mesh-run/README.md)
for instructions on how to work with that.
/logs/
# Mobly test case
To run this, prepare two devices by installing the testbed app from this
branch onto them.
Then connect the devices to your host machine using USB and run this:
python3 public_mesh_test.py -c public_mesh.yml
This is a typical output:
```
[PublicMeshTestBed] 11-25 12:45:50.931 INFO ==========> PublicMeshTest <==========
[PublicMeshTestBed] 11-25 12:45:51.309 INFO [AndroidDevice|PT99651AA1AC1803610] Initializing the snippet package org.briarproject.publicmesh.
[PublicMeshTestBed] 11-25 12:46:02.428 INFO [AndroidDevice|ZY32BSN89S] Initializing the snippet package org.briarproject.publicmesh.
[PublicMeshTestBed] 11-25 12:46:04.028 INFO [Test] test_basic_discovery
[PublicMeshTestBed] 11-25 12:46:14.258 INFO [Test] test_basic_discovery PASS
[PublicMeshTestBed] 11-25 12:46:28.831 INFO Summary for test class PublicMeshTest: Error 0, Executed 1, Failed 0, Passed 1, Requested 1, Skipped 0
[PublicMeshTestBed] 11-25 12:46:28.831 INFO Summary for test run PublicMeshTestBed@11-25-2022_12-45-50-929:
Total time elapsed 37.901148029006436s
Artifacts are saved in "/PATH/TO/public-mesh-testbed/mobly/mesh-run/logs/PublicMeshTestBed/11-25-2022_12-45-50-929"
Test results: Error 0, Executed 1, Failed 0, Passed 1, Requested 1, Skipped 0
```
and the logs end up in `logs` in the current directory:
```
logs/
└── PublicMeshTestBed
├── 11-25-2022_12-44-13-683
│ ├── PublicMeshTest
│ │ ├── AndroidDevicePT99651AA1AC1803610
│ │ │ └── logcat,PT99651AA1AC1803610,wolverine_00eea,11-25-2022_12-44-13-925.txt
│ │ └── AndroidDeviceZY32BSN89S
│ │ └── logcat,ZY32BSN89S,capri_retailen,11-25-2022_12-44-14-021.txt
│ ├── test_log.DEBUG
│ ├── test_log.INFO
│ └── test_summary.yaml
├── 11-25-2022_12-45-50-929
│ ├── PublicMeshTest
│ │ ├── AndroidDevicePT99651AA1AC1803610
│ │ │ └── logcat,PT99651AA1AC1803610,wolverine_00eea,11-25-2022_12-45-51-197.txt
│ │ └── AndroidDeviceZY32BSN89S
│ │ └── logcat,ZY32BSN89S,capri_retailen,11-25-2022_12-45-51-298.txt
│ ├── test_log.DEBUG
│ ├── test_log.INFO
│ └── test_summary.yaml
└── latest -> /PATH/TO/public-mesh-testbed/mobly/mesh-run/logs/PublicMeshTestBed/11-25-2022_12-45-50-929
```
MoblyParams:
LogPath: './logs'
TestBeds:
- Name: PublicMeshTestBed
Controllers:
AndroidDevice: '*'
from mobly import base_test
from mobly import test_runner
from mobly.controllers import android_device
import time
class PublicMeshTest(base_test.BaseTestClass):
def setup_class(self):
# Registering android_device controller module declares the test's
# dependency on Android device hardware. By default, we expect at least one
# object is created from this, here we expect at least 2 devices.
self.ads = self.register_controller(android_device, min_number=2)
self.droid1 = self.ads[0]
self.droid2 = self.ads[1]
self.droid1.load_snippet('pm', 'org.briarproject.publicmesh')
self.droid2.load_snippet('pm', 'org.briarproject.publicmesh')
def test_basic_discovery(self):
self.droid1.pm.startActivity()
self.droid2.pm.startActivity()
self.droid1.pm.startAdvertising()
self.droid2.pm.startDiscovery()
time.sleep(10)
if __name__ == '__main__':
test_runner.main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment