public void ValidateNewPackage()
        {
            try
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(PropertiesReference.Properties.CurrentDirectory + @"\XML Test Data\CreatePackage.xml");
                XmlNode node = webService.CreatePackage(xmldoc.OuterXml.ToString());

                Assert.AreEqual("Success", node.FirstChild.Name);
                if (node.FirstChild.Name == "Success")
                {
                    TestReport.AddTestStep("Verify the response of the Create Package to be successful",
                                           "Response of the Create Package to be successfull", "Pass",
                                           "Package ID: " + node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText +
                                           " and Package Number: " + node.ChildNodes[0].ChildNodes[0].ChildNodes[1].InnerText + " generated successfully");
                    HTMLReport.AddTestRow(TestContext.TestName, "Pass");
                }
                else
                {
                    TestReport.AddTestStep("Verify the response of the Create Package to be successful", "Response of the Create Package to be successfull", "Fail", "Responses received is not Success as Child node has " + node.FirstChild.Name);
                    HTMLReport.AddTestRow(TestContext.TestName, "Fail");
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                TestReport.AddTestStep("Verify the response of the Create Package to be successful", "Response of the Create Package to be successfulls", "Fail", "Responses received is not Success. Exception:" + e);
                HTMLReport.AddTestRow(TestContext.TestName, "Fail");
            }
        }
Exemplo n.º 2
0
        private void tokenReportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HTMLReport htmlReport = new HTMLReport();

            htmlReport.generateReport("listadoTokens.html", ListToken);
            if (File.Exists(Directory.GetCurrentDirectory() + "\\listadoTokens.html"))
            {
                Process.Start(Directory.GetCurrentDirectory() + "\\listadoTokens.html");
            }
        }
        public static void BeforeBeginTests(TestContext TestContext)
        {
            DirectoryInfo currentDir       = new DirectoryInfo(Directory.GetCurrentDirectory());
            string        parentResultpath = currentDir.Parent.Parent.Parent.FullName + @"\Result Folder\API_" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + @"\";
            string        curdir           = currentDir.Parent.Parent.Parent.FullName;

            PropertiesReference.Properties.CurrentDirectory = curdir;
            PropertiesReference.Properties.ParentPath       = parentResultpath;
            ComponentHelper.Generic.CreateFolder(parentResultpath);

            PropertiesReference.Properties.BatchBeginTime = DateTime.Now;
            HTMLReport.CreateHTML(TestContext);
            LogReport.CreateLogFile(TestContext);
        }
Exemplo n.º 4
0
        private void errorReportToolStripMenuItem_Click(object sender, EventArgs e)
        {
            HTMLReport htmlReport = new HTMLReport();

            htmlReport.generateReport("listadoErroresLexicos.html", ListLexicalErrors);
            htmlReport.generateReport("listadoErroresSintacticos.html", ListSyntacticErrors);

            if (File.Exists(Directory.GetCurrentDirectory() + "\\listadoErroresLexicos.html"))
            {
                Process.Start(Directory.GetCurrentDirectory() + "\\listadoErroresLexicos.html");
            }

            if (File.Exists(Directory.GetCurrentDirectory() + "\\listadoErroresSintacticos.html"))
            {
                Process.Start(Directory.GetCurrentDirectory() + "\\listadoErroresSintacticos.html");
            }
        }
        public void ValidateCreateEmployee()
        {
            try
            {
                XmlDocument xmldoc = new XmlDocument();
                xmldoc.Load(PropertiesReference.Properties.CurrentDirectory + @"\XML Test Data\CreateEmployee.xml");
                XmlNode hierarchyNode = xmldoc["Request"]["CometCreateEmployee"]["Employee"];

                hierarchyNode.ChildNodes[0].ChildNodes[1].InnerText = RandomString(8);
                xmldoc.Save(PropertiesReference.Properties.CurrentDirectory + @"\XML Test Data\CreateEmployee.xml");
                XmlNode node = webService.CreateEmployee(xmldoc.OuterXml.ToString());

                Assert.AreEqual("Success", node.FirstChild.Name);

                if (node.FirstChild.Name == "Success")
                {
                    TestReport.AddTestStep("Verify the response of the Create Employee to be successfull",
                                           "Response of the Create Employee to be successfull", "Pass", "Employee ID: "
                                           + node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText + " and Employee Number: "
                                           + node.ChildNodes[0].ChildNodes[0].ChildNodes[1].InnerText + " created successfully");

                    XmlDocument xmlPackageDoc = new XmlDocument();
                    xmlPackageDoc.Load(PropertiesReference.Properties.CurrentDirectory + @"\XML Test Data\CreatePackage.xml");

                    XmlNode hierarchyPackageNode = xmlPackageDoc["Request"]["CometCreatePackage"];

                    //Update EmployeeID and PackagePayroll from the response received from Create Employee method
                    hierarchyPackageNode.ChildNodes[0].InnerText = node.ChildNodes[0].ChildNodes[0].ChildNodes[0].InnerText;                             //Employee ID
                    hierarchyPackageNode.ChildNodes[1].ChildNodes[2].ChildNodes[0].InnerText = node.ChildNodes[0].ChildNodes[0].ChildNodes[1].InnerText; //Employee Number

                    xmlPackageDoc.Save(PropertiesReference.Properties.CurrentDirectory + @"\XML Test Data\CreatePackage.xml");
                    HTMLReport.AddTestRow(TestContext.TestName, "Pass");
                }
            }
            catch (Exception e)
            {
                TestReport.AddTestStep("Verify the response of the Create Employee to be successfull", "Response of the Create Employee to be successfull", "Fail", "Response received is not Success. Exception: " + e);
                HTMLReport.AddTestRow(TestContext.TestName, "Fail");
            }
        }
        /// <summary>
        ///     Produce the report.
        /// </summary>
        /// <returns>The report.</returns>
        public String ProduceReport()
        {
            var report = new HTMLReport();

            AnalyzeFile();
            report.BeginHTML();
            report.Title("Encog Analyst Report");
            report.BeginBody();

            report.H1("General Statistics");
            report.BeginTable();
            report.TablePair("Total row count", Format.FormatInteger(_rowCount));
            report.TablePair("Missing row count", Format.FormatInteger(_missingCount));
            report.EndTable();

            report.H1("Field Ranges");
            report.BeginTable();
            report.BeginRow();
            report.Header("Name");
            report.Header("Class?");
            report.Header("Complete?");
            report.Header("Int?");
            report.Header("Real?");
            report.Header("Max");
            report.Header("Min");
            report.Header("Mean");
            report.Header("Standard Deviation");
            report.EndRow();


            foreach (DataField df  in  _analyst.Script.Fields)
            {
                report.BeginRow();
                report.Cell(df.Name);
                report.Cell(Format.FormatYesNo(df.Class));
                report.Cell(Format.FormatYesNo(df.Complete));
                report.Cell(Format.FormatYesNo(df.Integer));
                report.Cell(Format.FormatYesNo(df.Real));
                report.Cell(Format.FormatDouble(df.Max, FiveSpan));
                report.Cell(Format.FormatDouble(df.Min, FiveSpan));
                report.Cell(Format.FormatDouble(df.Mean, FiveSpan));
                report.Cell(Format.FormatDouble(df.StandardDeviation,
                                                FiveSpan));
                report.EndRow();

                if (df.ClassMembers.Count > 0)
                {
                    report.BeginRow();
                    report.Cell("&nbsp;");
                    report.BeginTableInCell(EightSpan);
                    report.BeginRow();
                    report.Header("Code");
                    report.Header("Name");
                    report.Header("Count");
                    report.EndRow();

                    foreach (AnalystClassItem item  in  df.ClassMembers)
                    {
                        report.BeginRow();
                        report.Cell(item.Code);
                        report.Cell(item.Name);
                        report.Cell(Format.FormatInteger(item.Count));
                        report.EndRow();
                    }
                    report.EndTableInCell();
                    report.EndRow();
                }
            }

            report.EndTable();

            report.H1("Normalization");
            report.BeginTable();
            report.BeginRow();
            report.Header("Name");
            report.Header("Action");
            report.Header("High");
            report.Header("Low");
            report.EndRow();


            foreach (AnalystField item  in  _analyst.Script.Normalize.NormalizedFields)
            {
                report.BeginRow();
                report.Cell(item.Name);
                report.Cell(item.Action.ToString());
                report.Cell(Format.FormatDouble(item.NormalizedHigh, FiveSpan));
                report.Cell(Format.FormatDouble(item.NormalizedLow, FiveSpan));
                report.EndRow();
            }

            report.EndTable();

            report.H1("Machine Learning");
            report.BeginTable();
            report.BeginRow();
            report.Header("Name");
            report.Header("Value");
            report.EndRow();

            String t = _analyst.Script.Properties
                       .GetPropertyString(ScriptProperties.MlConfigType);
            String a = _analyst.Script.Properties
                       .GetPropertyString(ScriptProperties.MlConfigArchitecture);
            String rf = _analyst.Script.Properties
                        .GetPropertyString(
                ScriptProperties.MlConfigMachineLearningFile);

            report.TablePair("Type", t);
            report.TablePair("Architecture", a);
            report.TablePair("Machine Learning File", rf);
            report.EndTable();

            report.H1("Files");
            report.BeginTable();
            report.BeginRow();
            report.Header("Name");
            report.Header("Filename");
            report.EndRow();

            foreach (String key  in  _analyst.Script.Properties.Filenames)
            {
                String v = _analyst.Script.Properties
                           .GetFilename(key);
                report.BeginRow();
                report.Cell(key);
                report.Cell(v);
                report.EndRow();
            }
            report.EndTable();

            report.EndBody();
            report.EndHTML();

            return(report.ToString());
        }
Exemplo n.º 7
0
        private void AnalyzeButton_Click(object sender, EventArgs e)
        {
            LexicalAnalyzer lexicalAnalyzer = new LexicalAnalyzer();
            HTMLReport      htmlReport      = new HTMLReport();

            RichTextBox richTextBox = tabControl1.SelectedTab.Controls.Cast <RichTextBox>().FirstOrDefault(x => x is RichTextBox);
            string      content     = richTextBox.Text;

            lexicalAnalyzer.scanner(content);

            if (graphVizBox.Image != null)
            {
                graphVizBox.Image.Dispose();
            }
            graphVizBox.Image    = null;
            flagBox.Image        = null;
            countryLabel.Text    = null;
            populationlabel.Text = null;

            intelliSense();
            if (!lexicalAnalyzer.ListError.Any())
            {
                if (lexicalAnalyzer.ListToken.Any())
                {
                    htmlReport.generateReport("listadoTokens.html", lexicalAnalyzer.ListToken);
                    if (File.Exists(Directory.GetCurrentDirectory() + "\\listadoTokens.html"))
                    {
                        Process.Start(Directory.GetCurrentDirectory() + "\\listadoTokens.html");
                    }

                    if (!verifySaturation(lexicalAnalyzer.ListToken))
                    {
                        createGraph(lexicalAnalyzer.ListToken);
                        if (File.Exists(Directory.GetCurrentDirectory() + "\\" + graph.Name.Replace(" ", "") + ".png"))
                        {
                            Image image = Image.FromFile(Directory.GetCurrentDirectory() + "\\" + graph.Name.Replace(" ", "") + ".png");
                            graphVizBox.Image = image;
                            // graphVizBox.Image = new Bitmap(Image.FromFile(Directory.GetCurrentDirectory() + "\\" + graph.Name.Replace(" ", "") + ".png"));
                        }

                        betterOption();
                    }
                    else
                    {
                        MessageBox.Show("EL archivo posee saturaciones mayores al 100%", "Error");
                    }
                }
            }
            else
            {
                htmlReport.generateReport("listadoTokens.html", lexicalAnalyzer.ListToken);
                htmlReport.generateReport("listadoErrores.html", lexicalAnalyzer.ListError);

                MessageBox.Show("El archivo de entrada posee errores", "Error");

                if (File.Exists(Directory.GetCurrentDirectory() + "\\listadoTokens.html") &&
                    File.Exists(Directory.GetCurrentDirectory() + "\\listadoErrores.html"))
                {
                    Process.Start(Directory.GetCurrentDirectory() + "\\listadoTokens.html");
                    Process.Start(Directory.GetCurrentDirectory() + "\\listadoErrores.html");
                }
            }
        }
 public static void AfterClass()
 {
     PropertiesReference.Properties.BatchEndTime = DateTime.Now;
     HTMLReport.Summary();
 }
Exemplo n.º 9
0
        public void CreateHTMLReport(string path)
        {
            HTMLReport rep = new HTMLReport(path);

            rep.BeginDocument("Fact universe");

            rep.AddSection(1, "Types");
            rep.BeginTable(1, "Name", "Realizations", "Mutable");
            KnownTypes
            .ToEnumerable()
            .OrderBy(t => t.TheType.FullName)
            .ToObservable()
            .AutoDo(t =>
                    rep.AddRow(t.TheType.FullName,
                               string.Join(", ", RealizationsOf(t.TheType).ToEnumerable().Select(tr => tr.FullName)),
                               t.IsMutable ? "yes" : "no"));
            rep.EndTable();

            rep.AddSection(1, "Methods");
            KnownMethodBases
            .ToEnumerable()
            .OrderBy(m => m.Method.Name)
            .ToObservable()
            .AutoDo(mf =>
            {
                rep.AddSection(2, mf.Method.ToString());
                rep.AddText("Declaring type: " + mf.Method.DeclaringType.FullName);
                rep.AddSection(3, "Callees:");
                rep.AddText(string.Join(", ", mf.CalledMethods.Select(cm => cm.ToString())));
                rep.AddSection(3, "Callers:");
                rep.AddText(string.Join(", ", mf.CallingMethods.Select(cm => cm.ToString())));
                if (mf.Method.GetParameters().Length > 0)
                {
                    rep.AddSection(3, "Argument candidates:");
                    rep.BeginBulletList();
                    foreach (ParameterInfo pi in mf.Method.GetParameters())
                    {
                        rep.BeginListItem();
                        rep.AddText(pi.Name + ": ");
                        var acs = mf.GetArgumentCandidates(pi);
                        if (acs.Any())
                        {
                            rep.BeginBulletList();
                            foreach (ElementSource src in acs)
                            {
                                rep.AddListItem(src.ToString());
                            }
                            rep.EndBulletList();
                        }
                        rep.EndListItem();
                    }
                    rep.EndBulletList();
                }
                if (mf.Mutations.Any())
                {
                    rep.AddSection(3, "Mutations:");
                    rep.BeginBulletList();
                    foreach (ElementMutation mut in mf.Mutations)
                    {
                        rep.BeginListItem();
                        if (mut is StoreFieldMutation)
                        {
                            rep.AddText("store field");
                        }
                        else if (mut is WriteArrayMutation)
                        {
                            rep.AddText("write array");
                        }
                        else if (mut is IndirectMutation)
                        {
                            rep.AddText("indirect store");
                        }
                        else
                        {
                            rep.AddText("???");
                        }

                        rep.BeginBulletList();
                        rep.AddListItem("Mutatee: " + mut.Mutatee);

                        var mt = mut.GetMutatedTerminals();
                        if (mt.Any())
                        {
                            rep.AddListItem("Mutated terminals:");
                            rep.BeginBulletList();
                            foreach (ElementSource src in mt)
                            {
                                rep.AddListItem(src.ToString());
                            }
                            rep.EndBulletList();
                        }

                        var st = mut.GetSubMutatedTerminals();
                        if (st.Any())
                        {
                            rep.AddListItem("Sub-mutated terminals:");
                            rep.BeginBulletList();
                            foreach (ElementSource src in st)
                            {
                                rep.AddListItem(src.ToString());
                            }
                            rep.EndBulletList();
                        }

                        rep.EndBulletList();
                        rep.EndListItem();
                    }
                    rep.EndBulletList();
                }
            });

            rep.EndDocument();
            rep.Close();
        }