• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3# Copyright (C) 2024 Huawei Device Co., Ltd.
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15import time
16import pytest
17import re
18import os
19import subprocess
20import colorama
21
22class TestHicheckerjssdk:
23    @pytest.mark.L0
24    def test_hichecker_installhap(self):
25        subprocess.check_call("hdc install testModule/resource/hichecker.hap", shell=True)
26        time.sleep(2)
27        subprocess.check_call("hdc shell aa start -a EntryAbility -b com.example.myapplication", shell=True)
28        time.sleep(2)
29        subprocess.check_call("hdc uninstall com.example.myapplication", shell=True)
30        time.sleep(2)
31
32    @pytest.mark.L0
33    def test_hichecker_hicheckersdk(self):
34        process = subprocess.Popen("hdc shell \"hilog | grep HICHECKER | grep NotifySlowProcess\"", stdout=subprocess.PIPE, shell=True, text=True)
35        output = ""
36        for _ in range(1):
37            output += process.stdout.readline()
38        assert "NotifySlowProcess" in output
39        process.kill()