-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Added a tip about hardcoding URLs in functional tests #3592
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
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 am not sure it is very clear. I think you can just also adjust a base url as a parameter and that should take care of things no?
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.
No, this is about the following scenario:
Your app has a "foo" route with the "/foo" path.
Your test generates the route using the "foo" route name, not the path.
Everything works and your users are very happy with you :)
2 months later, the new company intern changes the "foo" route and the new path is "/foooooooo"
The functional tests keep working, because routes are generated with the "foo" route name.
But the website is completely broken for the end users, because the "/foo" path no longer works
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.
but this is not the solution, the idea with route names relating to path is intended. Instead I think what we can be proposing is to lock a route to path test for functional, that locks this definition, if there is a change in any of the route map then it should fire up a warning to update the path on the functional test. no?
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.
@cordoval I'm afraid that I don't fully understand your alternative solution.
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 is simple, you mentioned that you may have a test
instead you would have an extra test:
just trying to think on your problem and how it could have been avoided.
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 that only makes things much more difficult, @cordoval
Functional tests (acceptance tests actually) are created to test if the website works for the end user. Creating yet another Unit test to test if it works for the end user is a no go imo
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.
exactly we make things difficult for this newbie, and tests should flag red when she does something that she is not supposed to without updating the route properly. That is exactly the task for a good test. Notice for us that we know we can just generate this type of test automatically so it is totally easy to maintain such test.
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 don't think we follow eachother, @cordoval. It's easier for someone new to testing and Sf2 to use a hardcoded URL than to use the router to create a route.