public void CreateNewCurrent() { GameObject current = Instantiate(currentPrefab, new Vector3(0, 0, 0), Quaternion.identity); CurrentScript = current.GetComponent <CurrentScript>(); lineRenderScript = current.GetComponent <CurrentTest>(); }
public static void AddTestOutcomeToReport(TestContext testContext) { var result = testContext.Result.Outcome.Status; var fullTestName = testContext.Test.FullName; switch (result) { case TestStatus.Failed: CurrentTest.Fail($"{testContext.Result.Message} {testContext.Result.StackTrace}") .AddScreenCaptureFromPath(ScreenshotHelper.ScreenshotFilePath); break; case TestStatus.Inconclusive: break; case TestStatus.Passed: CurrentTest.Pass($"Test Passed: {fullTestName}"); break; case TestStatus.Skipped: CurrentTest.Skip($"Test Skipped: {fullTestName}"); break; default: break; } }
private void AddQuestion() { if (tboxQuestion.Text.Trim().Equals("")) { MessageBox.Show("Pytanie musi mieć treść", "Nie można dodać pytania", MessageBoxButton.OK, MessageBoxImage.Information); return; } List <string> answers = new List <string>(); answers.Add(tboxAnswerA.Text.Trim()); answers.Add(tboxAnswerB.Text.Trim()); answers.Add(tboxAnswerC.Text.Trim()); answers.Add(tboxAnswerD.Text.Trim()); if (answers[0].Equals("") || answers[1].Equals("") || answers[2].Equals("") || answers[3].Equals("")) { MessageBox.Show("Wszystkie odpowiedzi muszą być wypełnione", "Nie można dodać pytania", MessageBoxButton.OK, MessageBoxImage.Information); return; } if (CurrentTest.QuestionExists(tboxQuestion.Text)) { MessageBox.Show("Takie pytanie już istnieje", "Nie można dodać pytania", MessageBoxButton.OK, MessageBoxImage.Information); return; } //change item - backend int correctAnswer = GetCorrectAnswer(); CurrentTest.Questions.Add(new Question(tboxQuestion.Text, answers, correctAnswer)); //change item - frontend UpdateQuestions(); }
public void Log(Exception ex, string message) { var details = CurrentTest.AddScreenCapture(GetScreenshot()); CurrentTest.Log(LogStatus.Fail, "Exception occured!", details); CurrentTest.Log(LogStatus.Fail, message, ex); HasError = true; }
public bool Log(bool success, string msg, string details = "") { if (!success) { details += CurrentTest.AddScreenCapture(GetScreenshot()); HasError = true; } CurrentTest.Log(success ? LogStatus.Pass : LogStatus.Fail, msg, details); return(success); }
public static void AddTestMethodMetadataToReport(TestContext testContext) { CurrentTest = Extent.CreateTest(testContext.Test.Name); if (testContext.Test.Properties.ContainsKey("Category")) { var categories = testContext.Test.Properties["Category"]; foreach (var category in categories) { CurrentTest.AssignCategory(category.ToString()); } } }
public void Log(ReportLogStatus status, string message, string details = "") { var logStatus = GetLogStatus(status); if (logStatus == LogStatus.Fail || logStatus == LogStatus.Error) { var sc = GetScreenshot(); details += CurrentTest.AddScreenCapture(sc); HasError = true; } CurrentTest.Log(logStatus, message, details); }
public StepsBeforeAndAfterTest(CurrentTest currenttest, FeatureContext featurecontext, ScenarioContext scenariocontext) : base(currenttest) { try { featureContext = featurecontext; scenarioContext = scenariocontext; } catch (Exception exception) { Console.WriteLine(exception.ToString()); } }
private void EditQuestion() { if (SelectedQuestionIndex < 0) { MessageBox.Show("Nie wybrano żadnego pytania", "Nie można wykonać akcji", MessageBoxButton.OK, MessageBoxImage.Information); return; } //change item - backend int correctAnswer = GetCorrectAnswer(); CurrentTest.EditQuestion(SelectedQuestionIndex, new Question(tboxQuestion.Text, tboxAnswerA.Text, tboxAnswerB.Text, tboxAnswerC.Text, tboxAnswerD.Text, correctAnswer)); //change item - frontend UpdateQuestions(); }
private void ConfirmTest_Click(object sender, EventArgs e) { RadioButton checkedButton = testGroupBox.Controls.OfType <RadioButton>() .FirstOrDefault(r => r.Checked); if (checkedButton != null) { int buttonIndex = Convert.ToInt32(Regex.Match(checkedButton.Name, "[0-9]+").Value); CurrentTest.MarkAsDone(buttonIndex); checkedButton.Checked = false; } else { CurrentTest.MarkAsDone(-1); } UpdateTest(CurrentTest.CurrentTask + 1); }
public static void AssignTest(int courseId, int testId) { using (var db = new HwProj_DBContext()) { var relatedTest = db.Test.First(task => task.Id == testId); var relatedCourse = db.OngoingCourse.First(course => course.Id == courseId); var curDate = DateTime.Today; var toAdd = new CurrentTest() { CourseId = courseId, TestId = testId, Date = curDate, Course = relatedCourse, Test = relatedTest }; db.CurrentTest.Add(toAdd); db.SaveChanges(); } }
private void UpdateQuestions() { questionsList.ItemsSource = null; questionsList.ItemsSource = CurrentTest.QuestionsNamesList(); }
public LoginPage(CurrentTest currenttest) : base(currenttest) { }
public void AddScreenShot(string msg) { CurrentTest.Log(LogStatus.Info, msg, CurrentTest.AddScreenCapture(GetScreenshot())); Thread.Sleep(50); }
public LoginSteps(CurrentTest currenttest) : base(currenttest) { }
public Base(CurrentTest currenttest) { CTest = currenttest; }
public static void AddErrorLogToReport(Exception e) { CurrentTest.Fail(e); }
public static void LogTestStepInfo(string message) { CurrentTest.Info(message); }
public ndnBaseStep(CurrentTest currenttest) : base(currenttest) { }
/// <summary> /// Runs the validation tests. /// </summary> // Revision History // MM/DD/YY Who Version Issue# Description // -------- --- ------- ------ ------------------------------------------- // 08/28/09 RCG 2.30.00 Created // 04/09/13 jrf 3.50.69 458134 Adding handler for the ValidationTest's FatalErrorEvent. public void RunValidationTests() { TestResults CurrentResults = new TestResults(); TestRun CurrentTestRun = new TestRun(); List <ValidationTest> SelectedTests = null; TestStepResult PreviousStepResult = TestStepResult.None; string[] SplitMeterID; string strTitle = ""; string strMeterID = ""; m_bCancelled = false; OnShowProgressEvent(new ShowProgressEventArgs(1, StepCount, m_strName, Resources.StatusRetrievingDeviceInfo)); try { // Open the communications port for the duration of the test. m_Comm.OpenPort(m_strPort); // Get the basic device information from the meter. CurrentTestRun = GetDeviceInfo(); SelectedTests = GetSelectedTests(); // Since we are using the ESN for meter ID we need to trim it down to a // reasonable identifier for use in the status and file name SplitMeterID = CurrentTestRun.MeterID.Split('.'); if (SplitMeterID.Length > 0) { strMeterID = SplitMeterID[SplitMeterID.Length - 1]; } strTitle = m_strName + " - " + strMeterID; m_strResultFile = m_strResultDir + strMeterID + " " + CurrentTestRun.TestDate.ToString("MMddyyyyhhmmss", CultureInfo.CurrentCulture) + ".xml"; // Run each of the tests foreach (ValidationTest CurrentTest in SelectedTests) { Test TestResult = null; OnStepProgressEvent(new TestStepEventArgs(Resources.StatusRunningTest + CurrentTest.TestName + "...", strTitle, PreviousStepResult)); if (m_bCancelled == false) { m_RunningTest = CurrentTest; m_RunningTest.FatalErrorEvent += new FatalErrorEventHandler(HandleFatalError); try { TestResult = CurrentTest.RunTest(); } catch (Exception e) { TestResult = new Test(); TestResult.Name = CurrentTest.TestName; TestResult.Reason = Resources.ReasonExceptionOccurred + e.Message; TestResult.Result = Resources.Failed; } m_RunningTest = null; } else { TestResult = new Test(); TestResult.Name = CurrentTest.TestName; TestResult.Result = Resources.Skipped; TestResult.Reason = Resources.Cancelled; } PreviousStepResult = GetStepResult(TestResult); CurrentTestRun.Tests.Add(TestResult); } m_Comm.ClosePort(); OnStepProgressEvent(new TestStepEventArgs(Resources.StatusSavingResults, strTitle, PreviousStepResult)); // Save the results CurrentResults.TestRuns.Add(CurrentTestRun); CurrentResults.SaveAs(m_strResultFile); if (m_bCancelled == false) { OnHideProgressEvent(new TestCompleteEventArgs(Resources.StatusComplete, m_strResultFile)); } else { OnHideProgressEvent(new TestCompleteEventArgs(Resources.Cancelled, m_strResultFile)); } } catch (ThreadAbortException) { // The thread was killed no need to display an error if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } } catch (PSEMException e) { // An error occurred while running the tests so we should notify the user. if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } ErrorForm.DisplayError(m_strName + " - " + "A protocol error occurred: " + e.PSEMResponse.ToDescription(), e); OnHideProgressEvent(new TestCompleteEventArgs(Resources.FailedExceptionOccurred, null)); } catch (Exception e) { // An error occurred while running the tests so we should notify the user. if (m_Comm != null && m_Comm.IsOpen) { m_Comm.ClosePort(); } ErrorForm.DisplayError(m_strName + " - " + e.Message, e); OnHideProgressEvent(new TestCompleteEventArgs(Resources.FailedExceptionOccurred, null)); } }
private void NextTest() { this.stopWatch = System.Diagnostics.Stopwatch.StartNew(); this.BoardControl.Clear(); if (!this.testItems.MoveNext()) { EEG.SendCommand(EEGCommand.STOP); this.result.ElapsedAnswer = (long)(DateTime.Now - this.result.StartDate).TotalMilliseconds; EEG.SendCommand(EEGCommand.DISABLE); this.Finish(this.result); recorder.Finish(); } else { this.currentTest = null; DateTime now = DateTime.Now; this.BoardControl.ShowMessage((int.Parse(this.testItems.Current.Id) + 1) + ": " + this.testItems.Current.Question, () => StartTest(this.currentTest, now, this.result.StartDate)); recorder.NextQuestion(); } }
public ndnBasePage(CurrentTest currenttest) : base(currenttest) { }
private void StartTest(CurrentTest currentTest, DateTime startDate, DateTime testStart) { recorder.StartTestItem(this.testItems.Current.FEN); this.currentTest = new CurrentTest(this.testItems.Current, this.BoardControl, DateTime.Now, startDate, testStart); }
public CurrentTestViewModel() { unitOfWork = new UnitOfWork(); questions = new ObservableCollection <Question>(unitOfWork.QuestionRepository.GetQuestionsByTestId(CurrentTest.GetTestId())); }