Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Reporting tests run via reflection individually.
stevehjohn
#1 Posted : Saturday, February 26, 2022 12:41:45 PM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
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.
Remco
#2 Posted : Saturday, February 26, 2022 11:17:10 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 7,161

Thanks: 964 times
Was thanked: 1296 time(s) in 1202 post(s)
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).
1 user thanked Remco for this useful post.
stevehjohn on 2/27/2022(UTC)
stevehjohn
#3 Posted : Sunday, February 27, 2022 10:34:56 AM(UTC)
Rank: Member

Groups: Registered
Joined: 5/30/2018(UTC)
Posts: 17
Location: United Kingdom

Thanks: 4 times
Was thanked: 1 time(s) in 1 post(s)
Hi,
Thanks for the quick response. That looks like exactly what I'm after, thanks. Sorry for the pain you went through! :D
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.
Trial NCrunch
Take NCrunch for a spin
Do your fingers a favour and supercharge your testing workflow
Free Download