General Discussion

Reporting tests run via reflection individually.

Started by stevehjohn on 2,794 views

Hi,

Long time NCrunch user/fan here. Recently came across an interesting situation. I got sucked into solving all the Advent of Code puzzles. There's ~350 of them at the moment. I have a class for each puzzle and a text file with all the correct answers. So, I have a console app I can run which uses reflection to find and execute all the classes and check the answer they return against the text file.
I created a test project to run in NCrunch which does basically the same thing.
The "issue" is that obviously this reports in the NCrunch UI as one test, when it's really ~350. It would be nice if there was a way I could report back to NCrunch within my reflection loop that it is effectively running a new test.
Does this feature exist? Is it something that is potentially possible?

Thanks,

Steve.
Hi Steve,

Thanks for posting! You probably want to look into using NUnit's TestCaseSource attribute for this one. It lets you generate tests based on user code. MSTest and xunit also have their own equivalents which work in similar ways. NCrunch does support this (it took much pain to make it work).
Hi,
Thanks for the quick response. That looks like exactly what I'm after, thanks. Sorry for the pain you went through! :D
This post has been deleted.

Post a reply

Log in to reply.