private void GetValue(Dictionary <string, MyTestResult> resultDictionary, XElement test, bool isParametrizedTest)
        {
            try
            {
                String testName = test.Attribute("name").Value;
                if (isParametrizedTest)
                {
                    int paranIdx = testName.IndexOf('(');
                    if (paranIdx > 0)
                    {
                        testName = testName.Substring(0, paranIdx);
                    }
                }

                var result = new MyTestResult(test.Attribute("name").Value);
                if (test.Attribute("success") != null)
                {
                    result.Success = test.Attribute("success").Value == "True";
                }
                //_log.Debug("Found test case: " + testName + " with success: " + result.Success);
                if (!result.Success)
                {
                    result.Message    = test.Descendants(XName.Get("message", "")).Single().Value;
                    result.StackTrace = test.Descendants(XName.Get("stack-trace", "")).Single().Value;
                }

                resultDictionary.Add(result.Name, result);
            }
            catch (Exception e)
            {
                _log.Error("Log file parsing error", e);
            }
        }
示例#2
0
        private void dgvTrackId_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
        {
            foreach (DataGridViewRow myRow in dgvTrackId.Rows)
            {
                if (tabControl.SelectedIndex == 0)
                {
                    MyTestSummary myTrackId = (MyTestSummary)myRow.DataBoundItem;

                    if (myTrackId.FilePath.Contains("PASS"))
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Green;
                    }
                    else
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
                else
                {
                    MyTestResult myTestResult = (MyTestResult)myRow.DataBoundItem;

                    if (myTestResult.FilePath.Contains("PASS"))
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Green;
                    }
                    else
                    {
                        myRow.DefaultCellStyle.ForeColor = Color.Red;
                    }
                }
            }
        }
示例#3
0
        unsafe List <MyTestResult> BenchAll <T>(string name, T item, IntPtr ptr, int length, Random random, int testRuns)
        {
            var methods = new Benchy <T>[] {
                Newtonsoft,
                Jil,
                ProtoBuf,
#if FPBENCH
                Brianary,
#endif
                CameronismPointer,
                CameronismStream,
                CameronismFakeStream,
            };

            var testGroup = new TestGroup(name);

            return(methods
                   .OrderBy(_ => random.Next())
                   .Select(method =>
            {
                var positions = new List <long?>();
                var result = new MyTestResult
                {
                    Case = testGroup.Name,
                    Serializer = method.Method.Name,
                    Lengths = positions,
                };

                Action plan = () =>
                {
                    using (var ms = new UnmanagedMemoryStream((byte *)ptr, 0, length, FileAccess.Write))
                    {
                        method.Invoke(item, ms);
                        positions.Add(ms.Position);
                    }
                };

                var serializeResult =
                    testGroup
                    .Plan(method.Method.Name, plan, testRuns)
                    .GetResult();

                var filter = new SimpleSpeedTester.Core.OutcomeFilters.ExcludeMinAndMaxTestOutcomeFilter();
                var summary = serializeResult.GetSummary(filter);

                result.Summary = summary;
                positions.Sort();
                if (positions.Count > 1 && positions.First() != positions.Last())
                {
                    throw new Exception("Inconsistent results from " + method.Method.Name);
                }

                return result;
            })
                   .ToList());
        }
示例#4
0
        private void dgvTrackId_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (tabControl.SelectedIndex == 0)
            {
                try
                {
                    MyTestSummary tid = (MyTestSummary)dgvTrackId.Rows[e.RowIndex].DataBoundItem;

                    if (tid != null)
                    {
                        rTxtBox.BackColor = tid.FilePath.Contains("PASS") ? rTxtBox.BackColor = Color.DarkGreen : rTxtBox.BackColor = Color.DarkRed;
                        rTxtBox.Text      = File.ReadAllText(tid.FilePath);
                    }
                }
                catch (Exception)
                {
                    rTxtBox.Text = rm.GetString("uiCantReadTrackidFile");
                }
            }
            else
            {
                try
                {
                    MyTestResult tr = (MyTestResult)dgvTrackId.Rows[e.RowIndex].DataBoundItem;

                    if (tr != null)
                    {
                        string json = File.ReadAllText(tr.FilePath);
                        tr.MyTestResultList = TestCaseBase.ToObject(json);

                        bindingListTestResult.Clear();

                        foreach (var item in tr.MyTestResultList)
                        {
                            bindingListTestResult.Add(item);
                        }

                        dgvTestResult.DataSource = null;
                        dgvTestResult.DataSource = bindingListTestResult;
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }
        private void GetValue(Dictionary<string, MyTestResult> resultDictionary, XElement test, bool isParametrizedTest)
        {
            
            try
            {
                String testName = test.Attribute("name").Value;
                if (isParametrizedTest)
                {
                    int paranIdx = testName.IndexOf('(');
                    if (paranIdx > 0)
                        testName = testName.Substring(0, paranIdx);
                }
                

                var result = new MyTestResult(test.Attribute("name").Value);
                if (test.Attribute("success") != null)
                {
                    result.Success = test.Attribute("success").Value == "True";
                }
                //_log.Debug("Found test case: " + testName + " with success: " + result.Success);
                if (!result.Success)
                {
                    result.Message = test.Descendants(XName.Get("message", "")).Single().Value;
                    result.StackTrace = test.Descendants(XName.Get("stack-trace", "")).Single().Value;
                }

                resultDictionary.Add(result.Name, result);
              
            }
            catch (Exception e)
            {
                _log.Error("Log file parsing error", e);
            }
        }