Exemple #1
0
        public async Task AddTestAsync(TestMethodResult testMethodResult)
        {
            var testContent = new StringContent(JsonConvert.SerializeObject(testMethodResult), System.Text.Encoding.UTF8, "application/json");
            var response    = await client.PostAsync("testresult/items", testContent).ConfigureAwait(false);

            response.EnsureSuccessStatusCode();
        }
Exemple #2
0
        private static void testType(Assembly asm, Type type)
        {
            var methods = type.GetMethods();

            foreach (var m in methods)
            {
                if (!m.IsStatic)
                {
                    continue;
                }

                var att = m.GetCustomAttributes(typeof(TestAttribute), false);
                if (att.Length <= 0)
                {
                    continue;
                }

                TestMethodResult t = null;
                try
                {
                    t = (TestMethodResult)m.Invoke(null, null);
                }
                catch (Exception e)
                {
                    t           = new TestMethodResult(TestMethodResult.generalTestResult.testError);
                    t.message   = e.Message + " // " + asm.FullName + "->" + type.FullName + "->" + m.Name;
                    t.errorInfo = e.StackTrace;
                }
            }
        }
Exemple #3
0
        private void OnTestResult(object sender, TestResultEventArgs e)
        {
            TestResult testResult       = e.Result;
            var        testMethodResult = new TestMethodResult(project.Id, build.Id, testResult);

            testsStoreService.AddTestAsync(testMethodResult).GetAwaiter().GetResult();

            if (!isFailed && testResult.Outcome == TestOutcome.Failed)
            {
                isFailed = true;
            }
        }
Exemple #4
0
 /// <summary>
 /// Initializes new instance of <see cref="TestMethodResultModel"/>
 /// from <see cref="TestMethodResult"/> object
 /// </summary>
 /// <param name="result">method test result</param>
 public TestMethodResultModel(TestMethodResult result)
 {
     Name          = result.Name;
     ExecutionTime = result.ExecutionTime;
     IgnoreMessage = result.IgnoreMessage;
 }
 protected bool Equals(TestMethodResult other)
 {
     return(string.Equals(TestMethodName, other.TestMethodName) && Result == other.Result);
 }
Exemple #6
0
 public void Create(out ITestMethodResult @object) => @object = new TestMethodResult();
 /// <summary>
 /// Initializes a new instance of the <see cref="TestMethodFinishedEventArgs"/> class.
 /// </summary>
 /// <param name="result">The result from running the test method.</param>
 public TestMethodFinishedEventArgs(TestMethodResult result)
 {
     Result = result;
 }