Noksa / Allure.NUnit

C# NUnit Allure with improvements and SpecFlow3 adapter
MIT License
18 stars 6 forks source link

Error using Allure.NUnit #36

Closed phiripatrick663 closed 5 years ago

phiripatrick663 commented 5 years ago

I have installed the NUnit package through Nuget and have: Allure.NUnit NUnit.SpecFlow3 Allure.SteInjector in the project. My allureConfig.jon is as shown in the example, but running test is giving an error: image

I'm not sure how else to configure. Please advise on correct steps. My environment is .NetFramework 4.6.2, NUnit 3.0, SpecFlow 3.0.2 Thanks.

Noksa commented 5 years ago

@phiripatrick663, could you upload to github an example project where this error is reproduced?

phiripatrick663 commented 5 years ago

Yes, creating new repo. Thanks.

phiripatrick663 commented 5 years ago

I was able to upload my project, may contain other branches that I could not remove. https://github.com/phiripatrick663/EPMTest.git You can look for a branch feature:/AllureReporting, which has the configuartion that produces error. Hope that helps. Thanks in advance for looking into this.

Noksa commented 5 years ago

@phiripatrick663 In the specified branch, none of the projects uses any of my packages. Therefore, I cannot reproduce this error at the moment. Maybe you forgot to push the latest changes to the branch?

phiripatrick663 commented 5 years ago

Let me check and re-upload. Thanks.

phiripatrick663 commented 5 years ago

Sorry for that, I had not made new commit. Packages are showing now and just checked, still getting the error. I have packages added to the SpecFlow project and you can test the "User can login" simple test to see error.

Noksa commented 5 years ago

@phiripatrick663 Steps to resolve this error: 1) Delete package Allure.Commons. 2). Add specflow.json file to the project with next content:

{
  "stepAssemblies": [
    {
      "assembly": "Allure.SpecFlowPlugin"
    }
  ]
}

Set Copy to Output Directory value "Copy if newer" to specflow.json file.

PS: This is my simplification that I did not create a page with a description of what needs to be done after installing the package if this file was not automatically added.

phiripatrick663 commented 5 years ago

Thanks. I will make changes and give update after testing.

phiripatrick663 commented 5 years ago

Success! Test ran with no error and for the first time I can see report! Thank you very much! image Another question now is how can I attach screen shots to report with my current configuration?

Noksa commented 5 years ago

@phiripatrick663 You need to remove all the code that is responsible for taking the screenshot and paste something like this:

1) If overall status is not passed - take a screenshot at the end of the test: image

2) If an error occurs at some step or the verification fails, you can set any actions. As an example - taking a screenshot. image

phiripatrick663 commented 5 years ago

Thank you. Will make suggested changes. Appreciate the help.

Noksa commented 5 years ago

@phiripatrick663 found a couple of errors due to which the behavior mentioned above may not work. Update the package as soon as it appears.

phiripatrick663 commented 5 years ago

Update. The screenshot attachment is working great. Thanks for the suggestion!! image

If you don't mind, you could update your readme to help more C# users who will find your plugin very useful. I struggled for a few days before asking, and thank you for taking time to look at my specific situation. Much appreciated.

phiripatrick663 commented 5 years ago

I downloaded update, even though I didn't see error you mentioned. One thing I have noticed is that the History is not recording number of runs. Is that an allureConfig.json issue?

I also experienced a warning with Jenkins which I am trouble shooting. image

Although all tests passed, result was a failure. I now can also see Allure report in Jenkins, was not happening before.

phiripatrick663 commented 5 years ago

seems like my last post is from a build error from MSBuild, tyrying a solution.

phiripatrick663 commented 5 years ago

Update: The previous Jenkins warning is my local installation, but when I go to remote Jenkins sever I get an compilation error on solution 1 above: error CS1738: caused by line: AllureLifecycle.Instance.AddAttachment(name: "Screenshot", type: AllureLifecycle.AttachFormat.ImagePng, arr); Looking at possible solutions.

Noksa commented 5 years ago

@phiripatrick663 About EXEC warning, just turn off discovering steps: https://github.com/Noksa/Allure.NUnit/wiki/AllureStep-Attribute

Noksa commented 5 years ago

I downloaded update, even though I didn't see error you mentioned. One thing I have noticed is that the History is not recording number of runs. Is that an allureConfig.json issue?

If you are talking about local runs, then the history is not stored there. The CI/CD server is responsible for storing history.

Noksa commented 5 years ago

Update: The previous Jenkins warning is my local installation, but when I go to remote Jenkins sever I get an compilation error on solution 1 above: error CS1738: caused by line: AllureLifecycle.Instance.AddAttachment(name: "Screenshot", type: AllureLifecycle.AttachFormat.ImagePng, arr); Looking at possible solutions.

I’m unlikely to help with this. Here the problem is in the build stage on the server. Perhaps some version of the framework is missing. Provide more information about the error, maybe then it will be clear.

phiripatrick663 commented 5 years ago

Thanks for the insight. I turned off step discovery, that error is gone. You are correct of the server missing some framework components, I am working through our support team to get environment updated. Thanks for all your input, this was just my update. You can close this issue. It's resovled.