Skip to content

Conversation

@torbacz
Copy link
Contributor

@torbacz torbacz commented May 27, 2022

Description

  • Add implementation for DataRow attribute allowing to have test cases in test methods using attributes.

Motivation and Context

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

@nfbot nfbot changed the title Providing inline data into test method. Providing inline data into test method May 27, 2022
@dnfadmin
Copy link

dnfadmin commented May 27, 2022

CLA assistant check
All CLA requirements met.

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done! Clean and effective. 💯

Just some fixes related with the project code style and we're good to merge.

Copy link
Member

@josesimoes josesimoes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@josesimoes josesimoes requested a review from Ellerbach May 27, 2022 16:08
@josesimoes
Copy link
Member

Let's just wait for another pair of eyes over this. 😉

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few comments and nice addition!
Also, can you please add an example in the poc folder? So it's the test of test and can be tested properly as well

@josesimoes
Copy link
Member

Allright!! Almost there for merge! 😉

@torbacz
Copy link
Contributor Author

torbacz commented Jun 2, 2022

Allright!! Almost there for merge! 😉

Yep, Still working on comments and POC project. Should be done today/tomorrow.

@torbacz
Copy link
Contributor Author

torbacz commented Jun 2, 2022

Few comments and nice addition! Also, can you please add an example in the poc folder? So it's the test of test and can be tested properly as well

I've ran into problem with PoC - it is unable to find tests. From VS log:
No tests found to run. Using automatically detected runsettings file(s). To learn more visit https://aka.ms/vs-runsettings. ========== Starting test discovery ========== Microsoft.VisualStudio.TestPlatform.ObjectModel.TestPlatformException: No suitable test runtime provider found for this run. at Microsoft.VisualStudio.TestPlatform.Client.TestPlatform.ThrowExceptionIfTestHostManagerIsNull(ITestRuntimeProvider testHostManager, String settingsXml) at Microsoft.VisualStudio.TestPlatform.Client.TestPlatform.CreateDiscoveryRequest(IRequestData requestData, DiscoveryCriteria discoveryCriteria, TestPlatformOptions options) at Microsoft.VisualStudio.TestPlatform.CommandLine.TestPlatformHelpers.TestRequestManager.DiscoverTests(DiscoveryRequestPayload discoveryPayload, ITestDiscoveryEventsRegistrar discoveryEventsRegistrar, ProtocolConfig protocolConfig) at Microsoft.VisualStudio.TestPlatform.Client.DesignMode.DesignModeClient.<>c__DisplayClass24_0.<StartDiscovery>b__0() Test run detected DLL(s) which were built for different framework and platform versions. Following DLL(s) do not match current settings, which are .NETFramework,Version=v4.0 framework and X86 platform. NFUnitTest.dll is built for Framework .NETnanoFramework,Version=v1.0 and Platform AnyCPU. Go to https://aka.ms/tp/vstest/multitargetingdoc?view=vs-2019 for more details on managing these settings. No test is available in D:\Cshark\Sources\nanoFramework.TestFramework.torbacz\poc\TestOfTestFrameworkByReference\bin\Debug\NFUnitTest.dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again. ========== Test discovery finished: 0 Tests found in 570,7 ms ==========

Any ideas?

@josesimoes
Copy link
Member

@torbacz usually a VS restart should do the trick. If that's not enough, manually delete bin, obj and .vs folders. Then rebuild.

@torbacz
Copy link
Contributor Author

torbacz commented Jun 2, 2022

@josesimoes
Didn't help, I'll try again tomorrow.
It is interesting that I can't run only tests from this project (maybe it's related to referencing directly test project instead of nuget package?). I've tested current version of DataRow by replacing nuget package in other project and it worked.

@josesimoes
Copy link
Member

@josesimoes Didn't help, I'll try again tomorrow. It is interesting that I can't run only tests from this project (maybe it's related to referencing directly test project instead of nuget package?). I've tested current version of DataRow by replacing nuget package in other project and it worked.

This is an "inception like" issue... 🤪
Make sure you have all the refs updated and using latest. And that you have the Test framework build before referencing it from the other projects. And it requires a build on it's own solution, otherwise it wont' get it right.

@torbacz
Copy link
Contributor Author

torbacz commented Jun 3, 2022

@josesimoes Didn't help, I'll try again tomorrow. It is interesting that I can't run only tests from this project (maybe it's related to referencing directly test project instead of nuget package?). I've tested current version of DataRow by replacing nuget package in other project and it worked.

This is an "inception like" issue... 🤪 Make sure you have all the refs updated and using latest. And that you have the Test framework build before referencing it from the other projects. And it requires a build on it's own solution, otherwise it wont' get it right.

@josesimoes
New day and it's working :)
I've switched to other computer and ran it in hardware mode using ESP32 and in normal mode. Few screen shoots from test run.
NanoEmulator
NanoEsp32

Now we wait for @Ellerbach and we should be ready to merge and test it in real use case :)

@josesimoes
Copy link
Member

@torbacz brilliant! Looks pretty neat. 😃

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Very little remarks. Thanks for moving this forward!

@torbacz
Copy link
Contributor Author

torbacz commented Jun 3, 2022

@Ellerbach
New changes.

@josesimoes josesimoes changed the title Providing inline data into test method Add DataRow attribute allowing to have test cases in test methods using attributes Jun 3, 2022
@josesimoes josesimoes enabled auto-merge (squash) June 3, 2022 12:14
@torbacz
Copy link
Contributor Author

torbacz commented Jun 3, 2022

@Ellerbach
Last comment, it's resolved just waiting for you to mark as done.

@josesimoes josesimoes disabled auto-merge June 3, 2022 12:24
@josesimoes josesimoes merged commit 51299d5 into nanoframework:main Jun 3, 2022
@nfbot
Copy link
Member

nfbot commented Jun 3, 2022

@torbacz thank you again for your contribution! 🙏😄

.NET nanoFramework it's all about community involvement and no contribution is too small.
We would like to invite you to join the project Contributors list.

Please edit it and add an entry with your GitHub user in the appropriate location (names sorted alphabetically):

  <tr>
    <td><img src="https://github.com/torbacz.png?size=50&" height="50" width="50" ></td>
    <td><a href="https://github.com/torbacz">Marcin Torba</a></td>
  </tr>

(feel free to adjust your name, if it's not correct)

@torbacz torbacz deleted the dataRowSupport branch June 3, 2022 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TestFramework - providing inline data to test method

5 participants