Skip to content
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

When we change a method name in the code, it should be possible to replace the new method in all existing test pages. #1402

Open
suratdas opened this issue Dec 8, 2022 · 2 comments

Comments

@suratdas
Copy link
Contributor

suratdas commented Dec 8, 2022

After a number of tests already written, if we change a method name in the automaton code, it should be possible to easily modify existing tests with the new methods. It should also retain the existing parameters in the tests.

There is a replace feature already available in FitNesse, we can enhance it to replace method like below.

image

@fhoeben
Copy link
Collaborator

fhoeben commented Dec 8, 2022

This would be a very cool feature, but I believe it will be quite hard to implement. The same method may be present in multiple classes, if the test system is 'slim' the same method could be called from scripts and decision tables and scenarios might be defined with the same name as the original method.

The IntelliJ plugin tries to support something like this, but I believe it is horribly broken and I would not recommend its usage on a project of any complexity/size.

I believe using a text editor on the source files of you wiki pages and doing a regular expression based search replace, followed by careful review of all changes made is the best approach (and actually quite a good one) to deal with this situation. This is one of the reasons I like having my tests in version management and being able to run a full test suite based on a branch of my tests before I share it with the rest of the team.

Getting this to work right via the wiki, and good enough to be safe enough on a shared wiki server seems very hard to me.

Someone who want to attempt to implement this can maybe take some inspiration from the 'slim coverage' test system I developed some time ago (in https://github.com/fhoeben/hsac-fitnesse-plugin, slim coverage source). That does a 'dry run' of a test suite to determine which scenarios are used where. I believe that could be extended to find out which methods are called where, which would be valuable input to determine which places require renaming and which do not, even though that still would not tell you on which classes the methods are called.

@suratdas
Copy link
Contributor Author

Agreed. I raised a pull request with those comments. I think it may still be useful compared to just doing a regex replace as I gave a few examples in the screenshot in the pull request.

fhoeben added a commit that referenced this issue Dec 26, 2022
…o names with new name. (#1403)

* Addresses issue #1402 - Possible to search and replace method/scenario names with new name.

* Changed UI based on review comments.

* Review comment suggestion.

Co-authored-by: Fried Hoeben <github@hsac.nl>

* Review comment suggestion.

Co-authored-by: Fried Hoeben <github@hsac.nl>

* Review comment suggestion.

Co-authored-by: Fried Hoeben <github@hsac.nl>

* Review comment suggestion.

Co-authored-by: Fried Hoeben <github@hsac.nl>

Co-authored-by: Fried Hoeben <github@hsac.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants