-
Notifications
You must be signed in to change notification settings - Fork 7
Add Simple Test for compare plan #2079
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
8 commits
Select commit
Hold shift + click to select a range
991a85e
Add Simple Test for compare plan
TruongQuangSB 0b89e3c
formatting
TruongQuangSB 9a4448a
fix formatting
TruongQuangSB 6b3add0
Rename directory
TruongQuangSB 0e2d310
Export current validation information
TruongQuangSB a3a0fc8
Update export validation inforamtion csv
TruongQuangSB 370e2dc
Update table reference
eclipse-set-bot 0694128
Improve after review
TruongQuangSB 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
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
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
2 changes: 2 additions & 0 deletions
2
java/bundles/org.eclipse.set.swtbot/.settings/org.eclipse.jdt.ui.prefs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| eclipse.preferences.version=1 | ||
| formatter_settings_version=23 |
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
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
65 changes: 65 additions & 0 deletions
65
...rg.eclipse.set.swtbot/src/org/eclipse/set/swtbot/plancomapre/AbstractPlanCompareTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| /** | ||
| * Copyright (c) 2025 DB InfraGO AG and others | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v2.0 which is available at | ||
| * https://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| */ | ||
| package org.eclipse.set.swtbot.plancomapre; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Optional; | ||
|
|
||
| import org.eclipse.set.swtbot.utils.AbstractPPHNTest; | ||
| import org.eclipse.set.swtbot.utils.SWTBotTestFile; | ||
| import org.eclipse.set.swtbot.utils.SWTBotUtils; | ||
| import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| /** | ||
| * Abstract class for test compare plan | ||
| * | ||
| * @author truong | ||
| */ | ||
| public abstract class AbstractPlanCompareTest extends AbstractPPHNTest { | ||
| private final Logger LOGGER = LoggerFactory | ||
| .getLogger(AbstractPlanCompareTest.class); | ||
|
|
||
| protected void openSecondPlan() throws Exception { | ||
| LOGGER.info(getFilePath(getComparePlan().getFullName()).toString()); | ||
| getDialogService().openFileDialogHandler = filters -> Optional | ||
| .of(getFilePath(getComparePlan().getFullName())); | ||
|
|
||
| bot.waitUntil(SWTBotUtils.botWaitUntil(bot, () -> { | ||
| final var shell = bot.activeShell(); | ||
| return Boolean.valueOf(shell.getText() | ||
| .endsWith(SWTBotTestFile.PPHN_1_10_0_3.getFullName())); | ||
| })); | ||
|
|
||
| SWTBotMenu dateiMenu = bot.menu("Datei"); | ||
| SWTBotMenu comparePlanMenu = dateiMenu.menu("Vergleichsplanung laden"); | ||
| comparePlanMenu.menu("Andere Planung laden...").click(); | ||
| bot.waitUntil(SWTBotUtils.botWaitUntil(bot, () -> { | ||
| final var shell = List.of(bot.shells()); | ||
| return Boolean.valueOf(shell.stream() | ||
| .filter(c -> "Statusinformationen".equals(c.getText())) | ||
| .findAny() | ||
| .isEmpty()); | ||
| }), 5l * 60 * 1000); | ||
| bot.sleep(500); | ||
| } | ||
|
|
||
| @Override | ||
| public String getReferenceDir() { | ||
| return TEST_RESOURCE_DIR + "table_reference/" | ||
| + getTestFile().getShortName() + "/"; | ||
| } | ||
|
|
||
| protected SWTBotTestFile getComparePlan() { | ||
| return SWTBotTestFile.PPHN_1_10_0_1; | ||
| } | ||
| } |
72 changes: 72 additions & 0 deletions
72
...s/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/plancomapre/PlanCompareTableTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| /** | ||
| * Copyright (c) 2025 DB InfraGO AG and others | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v2.0 which is available at | ||
| * https://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| */ | ||
| package org.eclipse.set.swtbot.plancomapre; | ||
|
|
||
| import static org.junit.jupiter.api.Assertions.assertNotNull; | ||
|
|
||
| import java.util.stream.Stream; | ||
|
|
||
| import org.eclipse.set.swtbot.table.PtTable; | ||
| import org.eclipse.set.swtbot.utils.SWTBotUtils; | ||
| import org.eclipse.swtbot.nebula.nattable.finder.widgets.SWTBotNatTable; | ||
| import org.junit.jupiter.api.BeforeAll; | ||
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.TestInstance; | ||
| import org.junit.jupiter.api.TestInstance.Lifecycle; | ||
| import org.junit.jupiter.params.ParameterizedTest; | ||
| import org.junit.jupiter.params.provider.Arguments; | ||
| import org.junit.jupiter.params.provider.MethodSource; | ||
|
|
||
| /** | ||
| * Test table by compare plan | ||
| * | ||
| * @author truong | ||
| */ | ||
| @TestInstance(Lifecycle.PER_CLASS) | ||
| public class PlanCompareTableTest extends AbstractPlanCompareTest { | ||
| protected static Stream<Arguments> providesPtTable() { | ||
| return PtTable.tablesToTest.stream().map(table -> Arguments.of(table)); | ||
| } | ||
|
|
||
| SWTBotNatTable nattableBot; | ||
|
|
||
| @BeforeEach | ||
| @Override | ||
| public void beforeEach() throws Exception { | ||
| // do nothing | ||
| } | ||
|
|
||
| protected void givenNattableBot(final String tableName) { | ||
| bot.button(tableName).click(); | ||
| nattableBot = SWTBotUtils.waitForNattable(bot, 30000); | ||
| } | ||
|
|
||
| /** | ||
| * Test Open Table | ||
| * | ||
| * @param table | ||
| */ | ||
| @ParameterizedTest | ||
| @MethodSource("providesPtTable") | ||
| protected void testOpenTable(final PtTable table) { | ||
| givenNattableBot(table.tableName()); | ||
| assertNotNull(nattableBot); | ||
|
|
||
| } | ||
|
|
||
| // The test file should only open one times by this test | ||
| @BeforeAll | ||
| void beforeAll() throws Exception { | ||
| super.beforeEach(); | ||
| openSecondPlan(); | ||
| SWTBotUtils.expandTableMenu(bot); | ||
| } | ||
| } |
61 changes: 61 additions & 0 deletions
61
...undles/org.eclipse.set.swtbot/src/org/eclipse/set/swtbot/plancomapre/PlanCompareTest.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| /** | ||
| * Copyright (c) 2025 DB InfraGO AG and others | ||
| * | ||
| * This program and the accompanying materials are made available under the | ||
| * terms of the Eclipse Public License v2.0 which is available at | ||
| * https://www.eclipse.org/legal/epl-2.0. | ||
| * | ||
| * SPDX-License-Identifier: EPL-2.0 | ||
| * | ||
| */ | ||
| package org.eclipse.set.swtbot.plancomapre; | ||
|
|
||
| import static org.junit.Assert.assertTrue; | ||
| import static org.junit.jupiter.api.Assertions.assertDoesNotThrow; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.eclipse.set.basis.constants.ToolboxConstants; | ||
| import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| /** | ||
| * Test open and close compare plan | ||
| * | ||
| * @author truong | ||
| */ | ||
| public class PlanCompareTest extends AbstractPlanCompareTest { | ||
| @Test | ||
| void testOpenComparePlan() { | ||
| assertDoesNotThrow(this::openSecondPlan); | ||
| expectApplicationTitleAfterOpenComparePlanEquals(); | ||
| } | ||
|
|
||
| @Test | ||
| void testOpenCloseComparePlan() { | ||
| assertDoesNotThrow(this::openSecondPlan); | ||
| expectApplicationTitleAfterOpenComparePlanEquals(); | ||
| assertDoesNotThrow(this::whenCloseComparePlan); | ||
| expectApplicationTitleAfterCloseComparePlanEquals(); | ||
| } | ||
|
|
||
| void whenCloseComparePlan() { | ||
| getDialogService().openFileDialogHandler = filter -> Optional.empty(); | ||
| SWTBotMenu dateiMenu = bot.menu("Datei"); | ||
| SWTBotMenu comparePlanMenu = dateiMenu.menu("Vergleichsplanung laden"); | ||
| comparePlanMenu.menu("Andere Planung laden...").click(); | ||
| bot.sleep(500); | ||
| } | ||
|
|
||
| protected void expectApplicationTitleAfterOpenComparePlanEquals() { | ||
| String applicationTitle = bot.activeShell().getText(); | ||
| assertTrue(applicationTitle.endsWith(getTestFile().getFullName() | ||
| + ToolboxConstants.TITLE_FILE_NAME_SEPARATOR | ||
| + getComparePlan().getFullName())); | ||
| } | ||
|
|
||
| protected void expectApplicationTitleAfterCloseComparePlanEquals() { | ||
| String applicationTitle = bot.activeShell().getText(); | ||
| assertTrue(applicationTitle.endsWith(getTestFile().getFullName())); | ||
| } | ||
| } |
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.