【问题标题】:Allure results is going to AppData\local引诱结果将转到 AppData\local
【发布时间】:2020-07-02 19:20:05
【问题描述】:

我正在使用 NUNIT 3 并创建报告文件,我正在尝试使用 Allure(针对 C# 和 NUNIT)。

我的问题是文件夹 allure-results 将:

C:\Users\MyUser\AppData\Local>

我的 allureConfig.json 有:

{
    "allure": {
        "directory": "..\\allure-results",
        "title": "custom run title"
    }
}

请注意,我使用..\\ 可以在项目的\bin\Debug 文件夹中找到。但每次我运行测试时,该文件夹都会在 AppData\Local 中更新。

我认为有必要在 NUnit 中进行一些配置,但我不知道我需要做什么。

有人可以帮助我吗?谢谢。

【问题讨论】:

标签: c# .net visual-studio allure nunit-3.0


【解决方案1】:

在google上看了很多东西,解决这个问题的结论是:

您需要运行 nunit3-console 来运行您的 DLL 测试,在这种情况下,nunit3-console 会将文件夹 allure-results 保存在您的目录中想要。

出于某种原因(谷歌上没有人可以解释)Visual Studio 中的 NUNIT 不允许将未知文件夹保存在 \bin\debug 项目目录中。

然后做:

配置 allureConfig.json

{
    "allure": {
        "directory": "..\\..\\allure-results",
        "title": "a title that you want"
    }
}

将 allureConfig.json 配置为始终复制到输出目录 (\bin\Debug)

在你的测试类中添加 Allure

[TestFixture]
[AllureNUnit]
public class MyBeautifulTest
{
}

通过 Visual Studio + NUnit Test Runner 运行您的测试

通过 nunit3-console 运行测试

PS C:\Projetcs\MyProjectAPITest\MyProjectAPITest\bin\Debug> nunit3-console.exe MyProjectAPITest.dll

在 allure-results(项目文件夹)中查看您的测试结果并使用 allure serve 运行

PS C:\Projetos\MyProjectAPITest\MyProjectAPITest> allure serve allure-results\
Generating report to temp directory...
Report successfully generated to

开心吧,在你的管道中一切都会正常工作

:D

【讨论】:

    猜你喜欢
    • 2011-03-19
    • 2020-02-11
    • 2015-09-18
    • 2019-04-16
    • 1970-01-01
    • 2018-05-09
    • 1970-01-01
    • 2018-12-04
    • 2019-08-27
    相关资源
    最近更新 更多