Skip to content

MQE-2229: Deprecation Error When Deprecated ActionGroup References De… #775

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

Merged
merged 7 commits into from
Aug 10, 2020

Conversation

soumyau
Copy link
Contributor

@soumyau soumyau commented Jul 29, 2020

…precated Element

Description

Fixed Issues (if relevant)

  1. magento/magento2-functional-testing-framework#<issue_number>: Issue title
  2. ...

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/verification tests (if applicable)
  • All automated tests passed successfully (all builds on Travis CI are green)
  • Changes to Framework doesn't have backward incompatible changes for tests or have related Pull Request with fixes to tests

@coveralls
Copy link

coveralls commented Jul 29, 2020

Coverage Status

Coverage increased (+5.1%) to 61.318% when pulling 55bab02 on MQE-2229 into da3465c on develop.

Copy link
Contributor

@jilu1 jilu1 left a comment

Choose a reason for hiding this comment

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

  • We should add this fix to data and metadata.
    Good catch, fixed.
  • There is no unit test before and I remember i ask if unit test is required, i think we decided to add it. Let us know if you have concern.
    Not sure how to write a unit test for a static-check by mocking file system, InputInterface etc. It may not even be possible to write granular unit tests for this command.

@soumyau
Copy link
Contributor Author

soumyau commented Aug 4, 2020

  • We should add this fix to data and metadata.
    Good catch, fixed.
  • There is no unit test before and I remember i ask if unit test is required, i think we decided to add it. Let us know if you have concern.
    Not sure how to write a unit test for a static-check by mocking file system, InputInterface etc. It may not even be possible to write granular unit tests for this command.

@soumyau
Copy link
Contributor Author

soumyau commented Aug 4, 2020

  • We should add this fix to data and metadata.
    Good catch, fixed.
  • There is no unit test before and I remember i ask if unit test is required, i think we decided to add it. Let us know if you have concern.
    Not sure how to write a unit test for a static-check by mocking file system, InputInterface etc. It may not even be possible to write granular unit tests for this command.
    @KevinBKozan : https://jira.corp.magento.com/browse/MQE-2229 states to add unit tests. Let us know if if you agree with the above.

@KevinBKozan
Copy link
Contributor

KevinBKozan commented Aug 4, 2020

@soumyau yeah unit testing this is a little involved. You'd need to:

  • Mock call to $this->scriptUtil->printErrorsToFile() (easy)
  • Mock loadAllXmlFiles() to populate all of the $this->xml variables (easy)

Then in the actual function we're testing we have to:

Personally I think we should add Unit tests, if only because we're not in a time crunch. Also the first class to get unit tests in an area of the framework is always the most arduous, I think it's a solid opportunity to add a lot of coverage to an area of the framework that is pretty barren right now.

If you want to meet in the middle: timebox writing unit tests to 1 day. If it ends up being much trickier than the above we can make stories to add coverage to this part of the FW. Does that sound fair?

@soumyau
Copy link
Contributor Author

soumyau commented Aug 4, 2020

@soumyau yeah unit testing this is a little involved. You'd need to:

  • Mock call to $this->scriptUtil->printErrorsToFile() (easy)
  • Mock loadAllXmlFiles() to populate all of the $this->xml variables (easy)

Then in the actual function we're testing we have to:

Personally I think we should add Unit tests, if only because we're not in a time crunch. Also the first class to get unit tests in an area of the framework is always the most arduous, I think it's a solid opportunity to add a lot of coverage to an area of the framework that is pretty barren right now.

If you want to meet in the middle: timebox writing unit tests to 1 day. If it ends up being much trickier than the above we can make stories to add coverage to this part of the FW. Does that sound fair?

@KevinBKozan sure thing. Thanks for the direction. I'll give this a (timeboxed) shot, if the effort is larger, I'll create follow up tickets.

Copy link
Contributor

@KevinBKozan KevinBKozan left a comment

Choose a reason for hiding this comment

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

Small comment on singleton usage; overall works looks solid, just need minor touchup.

@KevinBKozan
Copy link
Contributor

To test loadAllXmlFiles we have two approaches we can take:

  • Mock scriptUtil to death
  • Introduce a fake module under unit/Resources/DeprecatedUsageModules/ with folder unit/Resources/DeprecatedUsageModules/TestLoadXML/Test/ unit/Resources/DeprecatedUsageModules/TestLoadXML/Suite unit/Resources/DeprecatedUsageModules/TestLoadXML/ActionGroup, etc for each function.

Option two is honestly more of an integration test, but it makes far more sense from a value standpoint than endlessly mocking scriptUtil. A huge part of the value of writing the test is knowing that xml files are actually loaded for use in other functions. So what I think:

  • under verification/Tests, introduce DeprecationCheckTest to cover this specific usecase
  • create a new TestModule copy like DeprecationCheckModule or DeprecationCheckModules/<specificUseCaseModule>/ with all the correct subfolders to support the testcase so that the test is actually reading real files and testing that functionality.

…precated Element

Added ObjectHandlerUtil for mocking Handlers
@soumyau soumyau force-pushed the MQE-2229 branch 2 times, most recently from 649c458 to 7c61149 Compare August 7, 2020 17:59
Copy link
Contributor

@jilu1 jilu1 left a comment

Choose a reason for hiding this comment

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

Very nice work on the verification test and refactory!

@soumyau
Copy link
Contributor Author

soumyau commented Aug 10, 2020

Small comment on singleton usage; overall works looks solid, just need minor touchup.

Fixed 👍

@soumyau soumyau requested a review from KevinBKozan August 10, 2020 13:57
@soumyau
Copy link
Contributor Author

soumyau commented Aug 10, 2020

Small comment on singleton usage; overall works looks solid, just need minor touchup.

Done.

@soumyau soumyau merged commit 20af7fd into develop Aug 10, 2020
@tomreece tomreece deleted the MQE-2229 branch August 19, 2020 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants