cake-contrib / Cake.Recipe

:page_with_curl: A set of convention based Cake scripts
https://cake-contrib.github.io/Cake.Recipe
MIT License
70 stars 53 forks source link

AppVeyor UploadTestResults #807

Open anorisoft opened 3 years ago

anorisoft commented 3 years ago

Test results are not uploaded to AppVeyor.

https://stackoverflow.com/questions/46370959/cake-build-and-nunit3-generating-empty-results-file

gep13 commented 3 years ago

You are correct, Cake.Recipe does not currently have functionality for including this.

If this is something that you are interested in adding to the project, then a PR to add this in would be appreciated, and we can begin a review process.

anorisoft commented 3 years ago

How are the test results currently published? Is Appveyor still supported by Cake Recipe?

gep13 commented 3 years ago

Yes, using AppVeyor is still very much supported in Cake.Recipe. Currently, Cake.Recipe takes the approach of generating a report for the unit tests, rather than reporting it to the CI system it is running on. You could add a custom task that does this work within your project.

anorisoft commented 3 years ago

How can I use the report for the unit tests. With NUnit the console output is written but nothing in the directory. If I find time I will make a PR. What strategy do you recommend? Should I better make my own fork where I customize the scripts or can I just add my own scrips?

gep13 commented 3 years ago

If you are looking to modify the functionality that is offered within Cake.Recipe, then you can do that by changing/overridding the built in tasks. This is documented here:

https://cake-contrib.github.io/Cake.Recipe/docs/extending/modify-built-in-tasks

If what you are changing is something that you think would be useful to other people, then a PR to add this functionality into Cake.Recipe itself would be the correct way to go.

anorisoft commented 3 years ago

That's a good way to go. This way I can try out my idea. If it works, I'll do a PR.

anorisoft commented 3 years ago

I have tried but something does not work. I delete all test tasks and overwrite them with the example. The result does not change.

BuildParameters.SetParameters(
    context: Context,
    buildSystem: BuildSystem,
    sourceDirectoryPath: "./Source",
    testDirectoryPath: "./Tests",
    title: "Anori.Extensions",
    repositoryOwner: "anorisoft",
    repositoryName: "Anori.Extensions",
    appVeyorAccountName: "anorisoft",
    shouldGenerateDocumentation: true,
    shouldRunDupFinder: false,
    shouldRunCodecov: true,
    shouldRunCoveralls: true,
    shouldRunDotNetCorePack: true);

Information("Clear NUnit3Test");
Information("NUnit3Test {0}", ((CakeTask)BuildParameters.Tasks.TestNUnitTask.Task).Actions.Count);
((CakeTask)BuildParameters.Tasks.TestNUnitTask.Task).Actions.Clear();
Information("NUnit3Test {0}", ((CakeTask)BuildParameters.Tasks.TestNUnitTask.Task).Actions.Count);
((CakeTask)BuildParameters.Tasks.TestMSTestTask.Task).Actions.Clear();
((CakeTask)BuildParameters.Tasks.TestVSTestTask.Task).Actions.Clear();

Information("Add Extended NUnit3Test");
BuildParameters.Tasks.TestNUnitTask
    .Does(() => {
        Information("Do something...");
    })
    .Does(() => {
        Information("Do something else...");
    });

BuildParameters.Tasks.TestMSTestTask 
    .Does(() => {
        Information("Do something...");
    })
    .Does(() => {
        Information("Do something else...");
    });

 BuildParameters.Tasks.TestVSTestTask 
    .Does(() => {
        Information("Do something...");
    })
    .Does(() => {
        Information("Do something else...");
    });
anorisoft commented 3 years ago

Oh. It was the wrong Task.

BuildParameters.Tasks.DotNetCoreTestTask

anorisoft commented 3 years ago

Does DotNetCoreTester have a result file that you could send to appveyor?

anorisoft commented 3 years ago

Hi. What is the normal way with cake recipe to display issue reports. How should I bring the report.html file to gitHub. Is there a description of the workflow?