-
Notifications
You must be signed in to change notification settings - Fork 31
Add constants for string literals in UI test classes #1199
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
base: main
Are you sure you want to change the base?
Add constants for string literals in UI test classes #1199
Conversation
src/main/java/io/openliberty/tools/intellij/util/Constants.java
Outdated
Show resolved
Hide resolved
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.
Change Copyright year in all files
Changed the Copyright year |
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.
@anusreelakshmi934 I see several new failures that are occurring on the Linux and Windows builds, for example:
GradleSingleModJakartaLSTest > initializationError FAILED
java.lang.RuntimeException: Unable to open file SystemResource
at io.openliberty.tools.intellij.it.UIBotTestUtils.openFile(UIBotTestUtils.java:700)
at io.openliberty.tools.intellij.it.SingleModJakartaLSTestCommon.prepareEnv(SingleModJakartaLSTestCommon.java:204)
at io.openliberty.tools.intellij.it.GradleSingleModJakartaLSTest.setup(GradleSingleModJakartaLSTest.java:40)
Caused by:
java.util.NoSuchElementException: List is empty.
at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:221)
at com.intellij.remoterobot.fixtures.Fixture.findText(Fixture.kt:46)
at io.openliberty.tools.intellij.it.UIBotTestUtils.openFile(UIBotTestUtils.java:687)
... 2 more
I suspect these might be related to recent changes in computing paths in this PR. Please verify.
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.
There are lots of places where String.join() is used. Would it be possible to pass String arrays as was done before? You can build the String arrays from your existing constants dynamically if needed. Or, in most cases, you can create new constants that combine your existing constants.
For example, you have:
CONFIG_DIR_PATH = { "src", "main", "liberty", "config" };
SERVER_XML = "server.xml";
You can create a new constant that combines the two called SERVER_XML_PATH and then use that to pass as a parameter to the necessary methods.
src/test/java/io/openliberty/tools/intellij/it/Utils/ItConstants.java
Outdated
Show resolved
Hide resolved
|
Hi @TrevCraw, Additionally, I’ve removed the WLP_MSGLOG_PATH from the TestUtils file and moved it to the ItConstants file as a slash-separated path. I felt that, instead of calling |
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.
Hi @anusreelakshmi934 , please address the review comments below. And be sure to check the build results after making your changes.
It probably was not necessary to move MESSAGES_LOG_PATH to the ItConstants file since it is only used in one file. However, the change should be OK. Please take a look at one of the comments related to this change below.
src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/SingleModLibertyLSTestCommon.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/SingleModMPLSTestCommon.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/Utils/ItConstants.java
Outdated
Show resolved
Hide resolved
src/test/java/io/openliberty/tools/intellij/it/SingleModJakartaLSTestCommon.java
Outdated
Show resolved
Hide resolved
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.
Looks good
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.
@anusreelakshmi934 ,I think it's better to define constants for string literals present in the child test class as well.
src/test/java/io/openliberty/tools/intellij/it/GradleSingleModJakartaLSTest.java
Show resolved
Hide resolved
| setBuildCategory(BuildType.GRADLE_TYPE); | ||
| setSmMpProjPort(9080); | ||
| setSmMpProjResURI("api/resource"); | ||
| setSmMPProjOutput("Hello! Welcome to Open Liberty"); |
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.
Fixes #1153