Пример #1
0
        void Start()
        {
            logger = new AQALogger();
            if (AutomatedQARuntimeSettings.hostPlatform == HostPlatform.Cloud &&
                AutomatedQARuntimeSettings.buildType == BuildType.FullBuild)
            {
                DontDestroyOnLoad(this.gameObject);
                RecordedPlaybackPersistentData.SetRecordingMode(RecordingMode.Playback);
                DeviceFarmConfig dfConf = CloudTestManager.Instance.GetDeviceFarmConfig();
                Application.quitting += () =>
                {
# if UNITY_EDITOR
                    logger.Log($"Counters generated - {CloudTestManager.Instance.GetTestResults().ToString()}");
#else
                    CloudTestManager.UploadCounters();
#endif
                    RuntimeClient.LogTestCompletion(dfConf.testName);
                };

                // Optionally us a settings json file other than the default.
                TextAsset settings = Resources.Load <TextAsset>(Path.GetFileNameWithoutExtension(dfConf.settingsFileToLoad));
                if (!string.IsNullOrEmpty(dfConf.settingsFileToLoad) && settings != null && !string.IsNullOrEmpty(settings.text))
                {
                    logger.Log($"Updating default Automated QA settings file to {dfConf.settingsFileToLoad}");
                    AutomatedQARuntimeSettings.AutomatedQaSettingsFileName = dfConf.settingsFileToLoad;
                    AutomatedQARuntimeSettings.RefreshConfig();
                }
                RunTest(dfConf.testName);
            }
 public void TestFinished(ITestResult result)
 {
     if (!result.Test.IsSuite)
     {
         //TODO: Add xml reports to artifacts
         // var xmlResult = result.ToXml(true).OuterXml;
         CloudTestManager.Instance.ResetTestResults();
         CloudTestManager.Instance.SetCounter(result.Name, result.ResultState.Status == TestStatus.Passed ? 1 : 0);
         var deviceModelName = SystemInfo.deviceModel;
         var dfConfOverrides = new DeviceFarmOverrides(result.FullName, deviceModelName);
         if (_dfConf.awsDeviceUDID == null)
         {
             dfConfOverrides.awsDeviceUDID = "Local-Device-UDID";
         }
         CloudTestManager.UploadCounters(dfConfOverrides);
     }
 }