-
-
Notifications
You must be signed in to change notification settings - Fork 207
[EXPERIMENTAL] Autogenerated unittests - evaluating usability #863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
[EXPERIMENTAL] Autogenerated unittests - evaluating usability #863
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quick pass to capture some obvious misses
/// <summary> | ||
/// Minimal stub implementation of Task for unit testing. | ||
/// </summary> | ||
public class Task |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless, as it doesn't extend/inherit tested code. It actually yields the tests incompilable
// // build.EvaluationFolder = evalFolder; | ||
// // | ||
// // // Act & Assert | ||
// // var exception = Record.Exception(() => new Microsoft.Build.Logging.StructuredLogger.ProjectReferenceGraph(build)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Record here conflicted between Xunit
and Microsoft.Build.Logging
namespaces (later got the precedence)
But this would be hard to catch
/// <summary> | ||
/// Tests that the parameterized constructor correctly assigns properties and that the Message property returns the formatted string when LoadingInitiator is provided. | ||
/// </summary> | ||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and above should have been a data driven tests
/// Tests that calling ReadRecords with a non-existent file path throws an exception. | ||
/// </summary> | ||
[Fact] | ||
public void ReadRecords_String_NonExistentFile_ThrowsException() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a duplicate of ReadBuild_String_NonExistentFile_ThrowsFileNotFoundException
with less specific exception - so it's superfluous
/// <summary> | ||
/// A fake Progress implementation to capture progress reports during tests. | ||
/// </summary> | ||
public class FakeProgress : Progress<ProgressUpdate>, Progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again - 'hand-mocking' went wrong - it mixes System.Progress StructuredLogger.Progress
/// This test sets all properties using sample values, including edge cases like empty and null strings. | ||
/// </summary> | ||
[Fact] | ||
public void Properties_SetterAndGetter_ShouldWorkCorrectly() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels as a very low value test.
We might want to skip autoprops etc.
@JanKrivanek How did you generate these tests? |
@Janek91 - Research project :-) |
Context
Generated with very early preview of unit tests generation tool. Trying to evaluate if there is any hope of that being useful and what would need to be worked on to achieve usefulness.
Technical data
Baseline (main):
Target (generated):
More comments