~aleteoryx/muditaos

ref: 675dc59c9a8b57126de7e26c1bcb7d809358d130 muditaos/test/service-desktop-test/main.py -rw-r--r-- 1.6 KiB
675dc59c — RobertPiet [EGD-3572] SettingsTable exchanged to settings::Settings (#968) (#1044) 5 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
# For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
import sys
from tests.messages import *
from tests.templates import *
from tests.contacts import *
from tests.update import *
from tests.deviceinfo import *
from tests.factoryReset import *
from tests.backup import *
from tests.calllog import *
from tests.calendarEvents import *
from termcolor import colored

from harness.harness import Harness


def main():
    if len(sys.argv) == 1 or sys.argv[1] is None:
        print('Please pass port name as the parameter: python main.py /dev/ttyACM0 ')
        exit(1)

    test_harness = Harness(sys.argv[1])
    serial = test_harness.get_connection()
    final_result = True
    failed_tests = []
    for test_instance in (DeviceInfoTest(serial), calendarEventsTest(serial), UpdateTest(serial), BackupTest(serial), MessageTest(serial),
                          MessageTemplateTest(serial), ContactTest(serial), CalllogTest(serial),
                          FactoryResetTest(serial)):
        test_name = type(test_instance).__name__
        result = test_instance.run()
        if result == False:
            failed_tests.append(test_name)
        final_result = final_result and result
        print(
            f'[{test_name}] {colored("PASS", "green") if result else colored("FAIL", "red")}')

    print("\nFinal result:", colored("PASS", "green") if final_result else colored("FAIL", "red"))
    print("Failed tests:")
    for test in failed_tests:
        print(colored(test, "red"))


if __name__ == '__main__':
    main()