protected override void CleanupTest ()
		{
			if (HasDevices && TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed &&
					TestOutputDirectories.TryGetValue (TestContext.CurrentContext.Test.ID, out string outputDir)) {
				string local = Path.Combine (outputDir, "screenshot.png");
				string deviceLog = Path.Combine (outputDir, "logcat-failed.log");
				string remote = "/data/local/tmp/screenshot.png";
				RunAdbCommand ($"shell screencap {remote}");
				RunAdbCommand ($"pull {remote} \"{local}\"");
				RunAdbCommand ($"shell rm {remote}");
				RunAdbCommand ($"logcat -d > {deviceLog}");
				if (File.Exists (local)) {
					TestContext.AddTestAttachment (local);
				} else {
					TestContext.WriteLine ($"{local} did not exist!");
				}
				if (File.Exists (deviceLog)) {
					TestContext.AddTestAttachment (deviceLog);
				} else {
					TestContext.WriteLine ($"{deviceLog} did not exist!");
				}
			}

			base.CleanupTest ();
		}
Beispiel #2
0
        protected override void CleanupTest()
        {
            if (HasDevices && TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed &&
                TestOutputDirectories.TryGetValue(TestContext.CurrentContext.Test.ID, out string outputDir))
            {
                string local  = Path.Combine(outputDir, "screenshot.png");
                string remote = "/data/local/tmp/screenshot.png";
                RunAdbCommand($"shell screencap {remote}");
                RunAdbCommand($"pull {remote} \"{local}\"");
                RunAdbCommand($"shell rm {remote}");
                TestContext.AddTestAttachment(local);
            }

            base.CleanupTest();
        }