public ResultsPanel(TestRunner testRunner)
        {
            this.testRunner = testRunner;
            this.testRunner.LoadComplete += new EventHandler(TestRunnerLoadComplete);
            this.testRunner.ExecutionStarted += new EventHandler(TestRunnerExecutionStarted);
            this.testRunner.ExecutionCompleted += new EventHandler(TestRunnerExecutionCompleted);
            this.testRunner.TestErrorOccured += new EventHandler<TestErrorEventArgs>(TestRunnerTestErrorOccured);
            //this.testRunner.TestCompleted += (sender, args) =>
            //                                     {

            //                                         Test e = (Test) sender;
            //                                         if(!e.ThrowErrors)
            //                                         {
            //                                             ListViewItem item = new ListViewItem();
            //                                             item.Text = e.Id;
            //                                             item.SubItems.Add(e.Id);
            //                                             item.SubItems.Add("....");
            //                                             item.SubItems.Add("Executado com sucesso!");
            //                                             item.Tag = e.Id;
            //                                             listErrors.Items.Add(item);
            //                                         }

            //                                     };
            //this.testRunner.Tests.FirstOrDefault().
            InitializeComponent();
        }
예제 #2
0
        public TestGrid(TestRunner testRunner)
        {
            this.testRunner = testRunner;
            this.testRunner.LoadComplete += new EventHandler(TestRunnerLoadComplete);
            this.testRunner.TestStarted += new EventHandler(TestRunnerTestStarted);
            this.testRunner.TestCompleted += new EventHandler(TestRunnerTestCompleted);
            InitializeComponent();

            InitializeControls();
        }
        public void Run()
        {
            this.errorsOccured = false;
            TestRunner testRunner = new TestRunner(this.fileName);

            testRunner.TestCompleted += new EventHandler(TestRunnerTestCompleted);
            testRunner.ExecutionCompleted += new EventHandler(TestRunnerExecutionCompleted);

            testRunner.Load();
            testRunner.Execute();
        }
예제 #4
0
        public MainForm()
        {
            this.testRunner = new TestRunner();
            this.servicoExportaTeste = new ServicoExportaArquivos();
            testRunner.execaoSucesso = true;

            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            InitializeControls();
        }
        public void test_started()
        {
            TestRunner testRunner = new TestRunner(FileName);

            var receberPagamento = typeof(TestRunner).GetMethod("TestManagerTestStarted", BindingFlags.NonPublic | BindingFlags.Instance);
            receberPagamento.Invoke(testRunner, new object[] { null, null });
        }
        public void LoadTest2()
        {
            TestRunner testRunner = new TestRunner(FileName);

            testRunner.LoadComplete += new EventHandler(testRunner_LoadComplete);

            testRunner.Load(CenarioExecucaoTestEnum.Completo);

            // Assert the number of tests loaded
            Assert.AreEqual(2, testRunner.Tests.Count, "Incorrect number of tests parsed");

            // Assert the test attributes have been correclty loaded
            Assert.AreEqual("test1", testRunner.Tests[0].Id, "Invalid test id found.");
            Assert.AreEqual("2", testRunner.Tests[1].Id, "Invalid test id found.");

            // Assert the commands in the first test have been correctly loaded
            Assert.AreEqual(2, testRunner.Tests[0].Commands.Count, string.Format("Incorrect number of commands parsed for test with id {0}", testRunner.Tests[0].Id));

            Command command = testRunner.Tests[0].Commands[0];
            Assert.AreEqual(CommandType.GoTo, command.CommandType, "Incorrect command type found in first test");
            Assert.AreEqual("GotoHome", command.Id, "Incorrect command id found in first test");
            Assert.AreEqual("http://www.google.co.uk", command.Arguments[0], "Incorrect command arguments found in first test");
            Assert.AreEqual(CommandType.GoTo, command.CommandType, "Incorrect command type found in second test");
        }
        public void ReflectionLoadTest()
        {
            string dllpath = System.IO.Path.Combine(System.Environment.CurrentDirectory, "WaxRunnerTest.dll");
            TestRunner testRunner = new TestRunner(dllpath);
            testRunner.Load();

            // Assert the number of tests loaded
            Assert.AreEqual(2, testRunner.Tests.Count, "Incorrect number of tests parsed");

            // Assert the test attributes have been correclty loaded
            Assert.AreEqual("ReflectionTestid", testRunner.Tests[0].Id, "Invalid test id found.");

            // Assert the commands in the first test have been correctly loaded
            Assert.AreEqual(1, testRunner.Tests[0].Commands.Count, string.Format("Incorrect number of commands parsed for test with id {0}", testRunner.Tests[0].Id));

            Command command = testRunner.Tests[0].Commands[0];
            Assert.AreEqual(CommandType.GoTo, command.CommandType, "Incorrect command type found in first test");
            Assert.AreEqual("GotoTestPage", command.Id, "Incorrect command id found in first test");
            Assert.AreEqual("www.google.com.br", command.Arguments[0], "Incorrect command arguments found in first test");

            // Assert the test attributes have been correclty loaded
            Assert.AreEqual("ReflectionUnitTestClass", testRunner.Tests[1].Id, "Invalid test id found.");

            // Assert the commands in the first test have been correctly loaded
            Assert.AreEqual(1, testRunner.Tests[0].Commands.Count, string.Format("Incorrect number of commands parsed for test with id {0}", testRunner.Tests[0].Id));

            Command command2 = testRunner.Tests[1].Commands[0];
            Assert.AreEqual(CommandType.Code, command2.CommandType, "Incorrect command type found in first test");
            Assert.AreEqual("TestSept1", command2.Id, "Incorrect command id found in first test");

            Command command3 = testRunner.Tests[1].Commands[1];
            Assert.AreEqual(CommandType.Validate, command3.CommandType, "Incorrect command type found in first test");
            Assert.AreEqual("ValidateCommand1", command3.Id, "Incorrect command id found in first test");
            Assert.AreEqual("wax", command3.Arguments[0], "Incorrect command arguments found in first test");
            Assert.AreEqual("Text", command3.Arguments[1], "Incorrect command arguments found in first test");
            Assert.AreEqual("FirstName", command3.FindMethod.Arguments[0], "Incorrect command arguments found in first test");
            Assert.AreEqual(FindMethodTypes.ById, command3.FindMethod.MethodType, "Incorrect command arguments found in first test");
        }
        public void test_erro_ocurred()
        {
            TestRunner testRunner = new TestRunner(FileName);

            var receberPagamento = typeof(TestRunner).GetMethod("TestManagerTestErrorOccured", BindingFlags.NonPublic | BindingFlags.Instance);
            receberPagamento.Invoke(testRunner, new object[] { null, new TestErrorEventArgs(new TestError(new ExecutionException("execao"), new Test(), "evidencia")) });
        }
        public void ProgressTest()
        {
            TestRunner testRunner = new TestRunner(FileName);
            testRunner.Load();

            testRunner.Progress += new EventHandler<TestProgressEventArgs>(TestRunnerProgress);

            this.progressHandlerCalledCount = 0;

            testRunner.ExecutionStarted += new EventHandler(testRunner_ExecutionStarted);
            testRunner.ExecutionCompleted += new EventHandler(testRunner_ExecutionCompleted);
            testRunner.TestCompleted += new EventHandler(testRunner_TestCompleted);
            testRunner.CommandCompleted += new EventHandler<CommandCompletedEventArgs>(testRunner_CommandCompleted);

            testRunner.Execute();

            Assert.AreEqual(3, this.progressHandlerCalledCount, "The progress event was not fired the expected number of times.");
            Assert.AreEqual(1, executionStartedCount);
            Assert.AreEqual(1, executionCompletedCount);
            Assert.AreEqual(2, testCompletedCount);
            Assert.AreEqual(3, commandCompletedCount);
        }
        public void ReflectionExecutesComExecaoDeSucesso()
        {
            string dllpath = System.IO.Path.Combine(System.Environment.CurrentDirectory, "WaxRunnerTest.dll");
            TestRunner testRunner = new TestRunner(dllpath);
            testRunner.Load();
            testRunner.Progress += new EventHandler<TestProgressEventArgs>(TestRunnerProgress);

            this.progressHandlerCalledCount = 0;

            testRunner.Execute();

            Assert.AreEqual(3, this.progressHandlerCalledCount, "The progress event was not fired the expected number of times.");
        }
        public void LoadTestEmptyExcelFile()
        {
            TestRunner testRunner = new TestRunner(excelEmptyFile);
            testRunner.Load();

            // Assert the number of tests loaded
            Assert.AreEqual(0, testRunner.Tests.Count, "Incorrect number of tests parsed");
        }
        public void LoadTestExcelErrorFile()
        {
            TestRunner testRunner = new TestRunner(excelErrorFile);
            testRunner.Load();
            testRunner.TestErrorOccured += new EventHandler<TestErrorEventArgs>(testRunner_TestErrorOccured);
            testRunner.TestStarted += new EventHandler(testRunner_TestStarted);
            testRunner.Execute();

            // Assert the number of tests loaded
            Assert.AreEqual(2, testRunner.Tests.Count, "Incorrect number of tests parsed");
            Assert.AreEqual(1, testErrorOccuredCount);
            Assert.AreEqual(1, testRunner.Errors.Count);
            Assert.AreEqual(true, testRunner.ErrorsOccured);
            Assert.AreEqual(2, testStartedCount);
        }
 public void ConstructorFileNotFound()
 {
     TestRunner testRunner = new TestRunner(@"c:\notexits\fileneverexists.ever");
 }
        public void LoadTest()
        {
            TestRunner testRunner = new TestRunner(FileName);
            testRunner.LoadComplete += new EventHandler(testRunner_LoadComplete);

            testRunner.Load();

            testRunner.TestErrorOccured += new EventHandler<TestErrorEventArgs>(
                delegate(object o, TestErrorEventArgs args) { });

            testRunner.TestStarted += new EventHandler((o, args) =>
                                                           {

                                                           });

            Assert.AreEqual(1, loadCount);

            // Assert the number of tests loaded
            Assert.AreEqual(2, testRunner.Tests.Count, "Incorrect number of tests parsed");

            // Assert the test attributes have been correclty loaded
            Assert.AreEqual("test1", testRunner.Tests[0].Id, "Invalid test id found.");
            Assert.AreEqual("2", testRunner.Tests[1].Id, "Invalid test id found.");

            // Assert the commands in the first test have been correctly loaded
            Assert.AreEqual(2, testRunner.Tests[0].Commands.Count, string.Format("Incorrect number of commands parsed for test with id {0}", testRunner.Tests[0].Id));

            Command command = testRunner.Tests[0].Commands[0];
            Assert.NotNull(testRunner.Errors);
            Assert.IsFalse(testRunner.ErrorsOccured);
            Assert.AreEqual(CommandType.GoTo, command.CommandType, "Incorrect command type found in first test");
            Assert.AreEqual("GotoHome", command.Id, "Incorrect command id found in first test");
            Assert.AreEqual("http://www.google.co.uk", command.Arguments[0], "Incorrect command arguments found in first test");

            Assert.AreEqual(1, testRunner.Tests[1].Commands.Count, string.Format("Incorrect number of commands parsed for test with id {0}", testRunner.Tests[1].Id));
            command = testRunner.Tests[1].Commands[0];
            Assert.AreEqual(CommandType.GoTo, command.CommandType, "Incorrect command type found in second test");
            Assert.AreEqual("GotoHome2", command.Id, "Incorrect command id found in second test");
            Assert.AreEqual("testpage2.htm", command.Arguments[0], "Incorrect command arguments found in second test");
        }
 public void ContructorTest3()
 {
     TestRunner testRunner = new TestRunner(FileName, true);
     Assert.AreEqual(testRunner.FileName, FileName);
     Assert.IsNotNull(testRunner.AllowedFileExtensions);
 }
 public void ContructorTest()
 {
     TestRunner testRunner = new TestRunner();
     Assert.IsNull(testRunner.FileName);
     Assert.IsNotNull(testRunner.AllowedFileExtensions, "AllowedFileExtensions found to be null");
 }
 public void ConstructorInvalidFileType()
 {
     TestRunner testRunner = new TestRunner(Path.Combine(Environment.CurrentDirectory, "App.config"));
 }