예제 #1
0
        private void AddToTestRunTable(TestRunObject run)
        {
            //running the command
            SqlCommand command = new SqlCommand();

            try {
                connection.Open();
                command.CommandTimeout = 60;
                command.Connection     = connection;
                command.CommandType    = CommandType.StoredProcedure;
                command.CommandText    = "spAddTestRunData";

                //adding the values to the parameter
                command.Parameters.Add("testerName", SqlDbType.NVarChar, 50).Value         = run.CreatedBy;
                command.Parameters.Add("applicationName", SqlDbType.NVarChar, 50).Value    = run.ApplicationName;
                command.Parameters.Add("applicationVersion", SqlDbType.NVarChar, 50).Value = run.ApplicationVersion;
                command.Parameters.Add("testsFailed", SqlDbType.SmallInt).Value            = run.TestsFailed;
                command.Parameters.Add("testsPassed", SqlDbType.SmallInt).Value            = run.TestsPassed;
                command.Parameters.Add("createdDate", SqlDbType.DateTime).Value            = run.CreatedDate;
                command.Parameters.Add("createdBy", SqlDbType.NVarChar, 50).Value          = run.CreatedBy;

                run.TestRunId = int.Parse(command.ExecuteScalar().ToString());
                connection.Close();
            }catch (SqlException e) {
                Print(e.StackTrace, "AddToTestRunTable");
            }catch (InvalidOperationException e) {
                Print(e.StackTrace, "AddToTestRunTable");
            }
        }
예제 #2
0
        /// <summary>
        /// Exports all data about testing to sql when it finishes.
        /// </summary>
        public void HandleDataExport(TestRunObject run)
        {
            AddToTestRunTable(run);

            foreach (var tcase in run.TestCases)
            {
                tcase.TestRunId = run.TestRunId;
                AddToTestCaseTable(tcase);

                foreach (var doc in tcase.Documents)
                {
                    doc.TestCaseId = tcase.TestCaseId;
                    AddToTestDocTable(doc);
                }
            }
        }