-
Notifications
You must be signed in to change notification settings - Fork 668
Dyn 3026 code coverage analysis folder #10989
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
Dyn 3026 code coverage analysis folder #10989
Conversation
I created several test methods for increasing the code coverage in the next classes (Analysis project). - Label - SurfaceData - AnalysisExtensions - Utils Also I removed two methods from the SurfaceData.cs file since both have cero references and both are private.
Fix for make the Analysis assembly visible to the AnalysisTests project.
|
@RobertGlobant20 did you ever get these methods to actually draw labels into the background preview? |
@mjkkirschner No, I tried to find references to the Label class (or classes that inherit of Label class) and is only used in the Label.cs and the test class that i created, then I think there is no way to used in other places, probably the labels in the background preview is using a different class. |
| var package = factory.CreateRenderPackage(); | ||
|
|
||
| //Act | ||
| labelTest.Tessellate(package, new TessellationParameters()); |
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.
What are you testing from the Tessellate call? I think the assertions below will pass even if you don't call Tessellate, wouldn't they?
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.
@aparajit-pratap
The Tessellate method is a [IsVisibleInDynamoLibrary(false)], has no code coverage and is not used (inside the Label class o in other classes, event the whole Label class is not used), I was proposing to delete the whole Label.cs file but Michael said the next "if it's public, we cannot get rid of it as it will break semantic versioning."
You are correct, the assertions are checking the results of Label.ByPointAndString method then they don't depend of calling the Tessellate method, then is it ok if I just delete the call to the Tessellate method (of course if won't have coverage)?
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.
It looks like the package properties are modified in Tessellate. You can check for those properties after the call to Tessellate.
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.
@aparajit-pratap this test method was re-written due to some comments that Michael did, please review again.
| labelTest.Tessellate(package, new TessellationParameters()); | ||
|
|
||
| //Assert | ||
| Assert.IsNotNull(labelTest); |
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.
I think this assertion should be before the call to Tessellate. Also, can you check if certain properties of Label are set in addition to checking for it to be non-null?
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.
@aparajit-pratap
This depends of the previous comment, if I delete the call to Tessellate method there is no need to do it, otherwise I will move it before the call (see commit: 0fbc203).
Also is important to mention that Label class only have private members (no public properties).
Changes asked by Aparajit.
|
Hi @RobertGlobant20 - whats odd is that https://github.com/DynamoDS/Dynamo/blob/master/src/Libraries/Analysis/Label.cs#L42 |
I re-wrote the test for the Label class since Michael asked me to use a Label inside a Code Block node, then I created 3 dyn files with one CodeBlock creating a Label, one compiling and other two with errors (on purpose) when passing parameters to the Label.ByPointAndString method. Also by Michael response I undid the changes done by Aaron in the PR #8189. Finally I applied some changes that the developer Ian Keough did like 5 years ago (HelixRenderPackage.cs -> CleanTag) but were discarded in the PR below, with the code as it is now in the Dynamo repo when creating a Label inside a Code Block it shows a strange symbol in the Background Preview. The only way to show the label text correctly was using the syntax "label:text", then Ian's discarded change was re-applied by me and now we don't need to use the weird Label syntax. #4637
I applied some changes that the developer Ian Keough did like 5 years ago (HelixRenderPackage.cs -> CleanTag) but were discarded in the PR below, with the code as it is now in the Dynamo repo when creating a Label inside a Code Block it shows a strange symbol in the Background Preview. The only way to show the label text correctly was using the syntax "label:text", then Ian's discarded change was re-applied by me and now we don't need to use the weird Label syntax. #4637
@mjkkirschner The tests for the Label class were rewritten and also I applied changes in the Label.cs and HelixRenderPackage.cs files, please review again. |
|
hmm, @RobertGlobant20 it looks like this change causes the mono.sln build to fail - thats because now the analysis tests require sharpDX and WPF references. I think we have two options.
what do you think? |
| </ProjectReference> | ||
| <ProjectReference Include="..\..\..\src\Libraries\CoreNodeModels\CoreNodeModels.csproj"> | ||
| <Project>{D8262D40-4880-41E4-91E4-AF8F480C8637}</Project> | ||
| <Name>CoreNodeModels</Name> |
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.
@RobertGlobant20 - this change is causing atleast some of the 600 failures you are getting.
Change this to <Private>False<Private> or in visual studio CopyLocal False, same thing.
This binary is being loaded twice, once from the /nodes folder, and now again from the /bin folder (in your PR). It should only be present in the /nodes folder.
To be safe, I would make all of these dependencies copy Local false, but thats probably not the problem.
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.
@mjkkirschner I removed the CoreNodeModels reference from the AnalysisTests project, then there shouldn't be any problem now.
Thanks
I moved the LabelTests to the DynamoCoreWpfTests project inside the Libraries folder. I removed several dll in the AnalysisTests project that are producing erros in the mono.sln.
@mjkkirschner I took the option 1, I moved the LabelTests.cs to the DynamoCoreWpfTests project inside a Libraries folder, then I removed the sharpDX and Wpf references from the AnalysisTests project. |
mjkkirschner
left a comment
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.
let's wait for the tests, but otherwise looks good.
|


Purpose
Increase the code coverage adding test cases for the Libraries/Analysis folder.
I created several unit tests methods using nUnit for the next classes:
Also I removed two methods from the SurfaceData.cs file since both have zero references and both are private.
The job DynamoSelfServe ran successfully in master-5.
Declarations
Check these if you believe they are true
*.resxfilesReviewers
@QilongTang
FYIs
@alfredo-pozo