Android 测试工具

版权所有,禁止匿名转载;禁止商业使用。

有时候会发现给手机烧入的信息里少了某一些文件,比如一个图标,或者一个mp3文件之类的等等,为此做了一个小工具检查指定手机里面是否包含相应的文件。


通过程序执行手机的命令来操作手机,感觉还挺有意思的。

static void Main(string[] args)
    {
      string result = "";
      string error = "";
      string str = "";
      do
      {
        Console.WriteLine("请通过数据线连接手机...");
        string cmd = "adb wait-for-devices";
         
        ProcessExcuter.Run(Global.Adb.ToString(), cmd, 10000, out result, out error);
        bool isOk = false;
        isOk = Comm.WaitForDevices(ref result);

        Console.WriteLine("--> " + result);
        if (!result.Contains("成功"))
        {
          return;
        }
        Console.WriteLine("<-- OK");

         

        System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();


         sw.Start();

Console.ReadLine(); 
return; 
}

Console.WriteLine(“FAIL:Total ” + (decimal)sw.ElapsedMilliseconds + “S”); 
Console.ReadLine(); 
return; 
}

{ 
isOk = false; 
} 
}

Console.WriteLine(“缺少音频文件【校验音频文件未通过】.”); 
Console.WriteLine(“FAIL:Total ” + (decimal)sw.ElapsedMilliseconds + “S”); 
Console.ReadLine(); 
return; 
} 
Console.WriteLine(“–> ” + cmd); 
Console.WriteLine(“<– OK:” + result);

             
  sw.Stop(); 
  Console.WriteLine("\n");
  Console.WriteLine("PASS:Total " + (decimal)sw.ElapsedMilliseconds + "S");
  Console.WriteLine("\n");
  Console.WriteLine("按回车键继续...");
  str = Console.ReadKey().Key.ToString();

            } while (str.ToUpper().Trim() == "ENTER" || !string.IsNullOrEmpty(error));

            Console.ReadLine();
        }

meUBva.jpg

Z3iy6r.jpg

yAjYbee.jpg

0 0