Я получаю сообщение об ошибке в C# для "ExtentHtmlReporter"
Я установил отчет об экстенте, но все равно получаю ошибку ниже:
Код серьезности Описание проекта Подробности состояния подавления строки файла
Ошибка (активная) CS0234 Тип или имя пространства имен «Утилита» не существует в пространстве имен «NUnitAutomationFramework» (вам не хватает ссылки на сборку?) SeleniumTest D:\MFX\OneDrive — MFXchange US, Inc\Desktop\MFX2\Workspaces\C-sharp Selenium\SeleniumTest\Base.cs 6
код:
using AventStack.ExtentReports;
using AventStack.ExtentReports.MarkupUtils;
using AventStack.ExtentReports.Reporter;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnitAutomationFramework.Utility;
using NUnitAutomationFramework.WebElements;
using OpenQA.Selenium;
using System.Configuration;
namespace NUnitAutomationFramework.Base
{
public class BaseSetup
{
public ExtentReports? extent;
public ExtentTest? test;
public ThreadLocal driver = new ThreadLocal();
public ThreadLocal extent_test = new ThreadLocal();
[OneTimeSetUp]
public void Setup()
{
string? testclassfilename = TestContext.CurrentContext.Test.ClassName;
string dir = System.Environment.CurrentDirectory;
string? projdir = Directory.GetParent(dir)?.Parent?.Parent?.FullName;
string reporpath = projdir + "\\Reports\\Report.html";
var htmlreport = new ExtentHtmlReporter(reporpath);
extent = new ExtentReports();
extent.AttachReporter(htmlreport);
extent.AddSystemInfo("Enivorment", "QA");
}
[SetUp]
public void Start_Browser()
{
test = extent.CreateTest(TestContext.CurrentContext.Test.Name);
extent_test.Value = test;
SetBrowser();
string? url = GetEnvironementData.GetEnvData();
ActionsElements.NavigateToUrl(driver.Value, url);
driver.Value.Manage().Window.Maximize();
}
public IWebDriver GetDriver()
{
return driver.Value;
}
private void SetBrowser()
{
string? RunEnivorment = ConfigurationManager.AppSettings["RunEnvironment"];
if (RunEnivorment != null && RunEnivorment.Equals("Local"))
{
driver.Value = DriverSetup.LocalBrowserSetup(driver.Value);
}
else if (RunEnivorment != null && RunEnivorment.Equals("Remote"))
{
driver.Value = DriverSetup.RemoteBrowserSetup(driver.Value);
}
else
{
TestContext.Progress.WriteLine("Please check browser name and run enivorment value in app.config file");
}
}
[TearDown]
public void SetTestResults()
{
var status = TestContext.CurrentContext.Result.Outcome.Status;
if (status == TestStatus.Failed)
{
var stackTrace = TestContext.CurrentContext.Result.StackTrace;
DateTime date = DateTime.Now;
string Filename = "Screenshot_" + date.ToString("h_mm_ss") + ".png";
extent_test?.Value?.Fail("TestCase Status : Failed", CaptureScreenShot(driver.Value, Filename));
extent_test?.Value?.Fail(stackTrace);
}
else if (status == TestStatus.Passed)
{
extent_test.Value.Log(Status.Pass, MarkupHelper.CreateLabel("TestCase Status : " + status, ExtentColor.Green));
}
extent.Flush();
driver.Value.Quit();
}
public static MediaEntityModelProvider CaptureScreenShot(IWebDriver driver, string screenShotName)
{
ITakesScreenshot scr = (ITakesScreenshot)driver;
var screenshot = scr.GetScreenshot().AsBase64EncodedString;
return MediaEntityBuilder.CreateScreenCaptureFromBase64String(screenshot, screenShotName).Build();
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... ent-report
Получение ошибки CS0234 в C# для отчета об экстенте ⇐ C#
Место общения программистов C#
-
Anonymous
1734357811
Anonymous
Я получаю сообщение об ошибке в C# для "ExtentHtmlReporter"
Я установил отчет об экстенте, но все равно получаю ошибку ниже:
Код серьезности Описание проекта Подробности состояния подавления строки файла
Ошибка (активная) CS0234 Тип или имя пространства имен «Утилита» не существует в пространстве имен «NUnitAutomationFramework» (вам не хватает ссылки на сборку?) SeleniumTest D:\MFX\OneDrive — MFXchange US, Inc\Desktop\MFX2\Workspaces\C-sharp Selenium\SeleniumTest\Base.cs 6
[b]код[/b]:
using AventStack.ExtentReports;
using AventStack.ExtentReports.MarkupUtils;
using AventStack.ExtentReports.Reporter;
using NUnit.Framework;
using NUnit.Framework.Interfaces;
using NUnitAutomationFramework.Utility;
using NUnitAutomationFramework.WebElements;
using OpenQA.Selenium;
using System.Configuration;
namespace NUnitAutomationFramework.Base
{
public class BaseSetup
{
public ExtentReports? extent;
public ExtentTest? test;
public ThreadLocal driver = new ThreadLocal();
public ThreadLocal extent_test = new ThreadLocal();
[OneTimeSetUp]
public void Setup()
{
string? testclassfilename = TestContext.CurrentContext.Test.ClassName;
string dir = System.Environment.CurrentDirectory;
string? projdir = Directory.GetParent(dir)?.Parent?.Parent?.FullName;
string reporpath = projdir + "\\Reports\\Report.html";
var htmlreport = new ExtentHtmlReporter(reporpath);
extent = new ExtentReports();
extent.AttachReporter(htmlreport);
extent.AddSystemInfo("Enivorment", "QA");
}
[SetUp]
public void Start_Browser()
{
test = extent.CreateTest(TestContext.CurrentContext.Test.Name);
extent_test.Value = test;
SetBrowser();
string? url = GetEnvironementData.GetEnvData();
ActionsElements.NavigateToUrl(driver.Value, url);
driver.Value.Manage().Window.Maximize();
}
public IWebDriver GetDriver()
{
return driver.Value;
}
private void SetBrowser()
{
string? RunEnivorment = ConfigurationManager.AppSettings["RunEnvironment"];
if (RunEnivorment != null && RunEnivorment.Equals("Local"))
{
driver.Value = DriverSetup.LocalBrowserSetup(driver.Value);
}
else if (RunEnivorment != null && RunEnivorment.Equals("Remote"))
{
driver.Value = DriverSetup.RemoteBrowserSetup(driver.Value);
}
else
{
TestContext.Progress.WriteLine("Please check browser name and run enivorment value in app.config file");
}
}
[TearDown]
public void SetTestResults()
{
var status = TestContext.CurrentContext.Result.Outcome.Status;
if (status == TestStatus.Failed)
{
var stackTrace = TestContext.CurrentContext.Result.StackTrace;
DateTime date = DateTime.Now;
string Filename = "Screenshot_" + date.ToString("h_mm_ss") + ".png";
extent_test?.Value?.Fail("TestCase Status : Failed", CaptureScreenShot(driver.Value, Filename));
extent_test?.Value?.Fail(stackTrace);
}
else if (status == TestStatus.Passed)
{
extent_test.Value.Log(Status.Pass, MarkupHelper.CreateLabel("TestCase Status : " + status, ExtentColor.Green));
}
extent.Flush();
driver.Value.Quit();
}
public static MediaEntityModelProvider CaptureScreenShot(IWebDriver driver, string screenShotName)
{
ITakesScreenshot scr = (ITakesScreenshot)driver;
var screenshot = scr.GetScreenshot().AsBase64EncodedString;
return MediaEntityBuilder.CreateScreenCaptureFromBase64String(screenshot, screenShotName).Build();
}
}
}
Подробнее здесь: [url]https://stackoverflow.com/questions/79284920/getting-error-cs0234-in-c-sharp-for-extent-report[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия