Automatic unit tests
-
Which unit testing framework for C# can create unit tests automatically?
-
Which unit testing framework for C# can create unit tests automatically?
What do you mean by creating unit tests automatically? Are you referring to tests like PEX and MOLES or Intellitest?
This space for rent
-
Which unit testing framework for C# can create unit tests automatically?
-
Which unit testing framework for C# can create unit tests automatically?
You could try some Property-Based Testing[^]. Frameworks like FsCheck automaticaly generate random values to verify your properties. But you have to come up with properties that you need to verify yourself. Such approach is more reliable then unit-testing against magic-numbers and is helpful to spot bugs but can only be used in the limited cases Also again I'm not 100% sure whether this is what you're looking for
-
What do you mean by creating unit tests automatically? Are you referring to tests like PEX and MOLES or Intellitest?
This space for rent
I mean that I have a code that contains some methods... I'm looking for a tool that would go over my code and create unit tests for the methods automatically... Does a tool like that exist in the market?
-
Is it possible to test several cases of the method under test?
-
Is it possible to test several cases of the method under test?
-
I mean that I have a code that contains some methods... I'm looking for a tool that would go over my code and create unit tests for the methods automatically... Does a tool like that exist in the market?
To a certain extent, yes it does (see the links in my original post to PEX and Moles from Microsoft research). The real question is, how much value do these tools provide? For instance, it's simple enough to automatically check whether or not a value is null but what about range checks? Would a tool know that your code expected a value between 0 and 5? Don't fall into the trap of just blindly adding tests, which is the problem with this idea. Your tests should really be there to exercise the expected logic of your code; for instance, if you changed the acceptable range from 0 to 6 and passed 6 into the code expecting the test to follow the fail path, it would suddenly follow a different path through your code so you would know that your test needs to change.
This space for rent