Skip to content

Commit 01bba94

Browse files
fix: optimize tests execution logic
1 parent ed7867a commit 01bba94

File tree

1 file changed

+10
-13
lines changed

1 file changed

+10
-13
lines changed

tests/com.espressif.idf.ui.test/src/com/espressif/idf/ui/test/executable/cases/project/IDFProjectLaunchTargetEditorFunctionalityTest.java

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
1313
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
1414
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
15-
import org.junit.After;
15+
import org.junit.AfterClass;
1616
import org.junit.BeforeClass;
1717
import org.junit.FixMethodOrder;
1818
import org.junit.Test;
@@ -40,10 +40,13 @@ public class IDFProjectLaunchTargetEditorFunctionalityTest {
4040
public static void beforeTestClass() throws Exception
4141
{
4242
Fixture.loadEnv();
43+
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
44+
Fixture.givenProjectNameIs("LaunchTargetEditorTest");
45+
Fixture.whenNewProjectIsSelected();
4346
}
4447

45-
@After
46-
public void afterEachTest()
48+
@AfterClass
49+
public static void afterEachTest()
4750
{
4851
try
4952
{
@@ -58,10 +61,7 @@ public void afterEachTest()
5861
@Test
5962
public void givenANewProjectCreatedBuiltWhenSelectNewTargetWhenPopUpAppearsThenBuildFolderDeletedSuccessfully()
6063
throws Exception
61-
{
62-
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
63-
Fixture.givenProjectNameIs("NewProjectLaunchTargetTest");
64-
Fixture.whenNewProjectIsSelected();
64+
{
6565
Fixture.whenProjectIsBuiltUsingContextMenu();
6666
Fixture.whenChangeLaunchTarget();
6767
Fixture.whenRefreshProject();
@@ -72,9 +72,6 @@ public void givenANewProjectCreatedBuiltWhenSelectNewTargetWhenPopUpAppearsThenB
7272
public void givenBNewProjectCreatedWhenCreateNewLaunchTargetThenProjectBuiltSuccessfully()
7373
throws Exception
7474
{
75-
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
76-
Fixture.givenProjectNameIs("NewProjectLaunchTargetTest2");
77-
Fixture.whenNewProjectIsSelected();
7875
Fixture.whenCreateNewLaunchTarget();
7976
Fixture.whenProjectIsBuiltUsingContextMenu();
8077
}
@@ -83,9 +80,6 @@ public void givenBNewProjectCreatedWhenCreateNewLaunchTargetThenProjectBuiltSucc
8380
public void givenCNewProjectCreatedWhenDeleteSelectedLaunchTargetThenDeletedSuccessfully()
8481
throws Exception
8582
{
86-
Fixture.givenNewEspressifIDFProjectIsSelected("EspressIf", "Espressif IDF Project");
87-
Fixture.givenProjectNameIs("NewProjectLaunchTargetTest3");
88-
Fixture.whenNewProjectIsSelected();
8983
Fixture.whenDeleteSelectedLaunchTarget();
9084
Fixture.thenLaunchTargetDeletedSuccessfully();
9185
}
@@ -153,6 +147,9 @@ private static void whenDeleteLaunchTarget() throws Exception
153147
SWTBotShell shell = bot.shell("New ESP Target");
154148
shell.setFocus();
155149
bot.button("Delete").click();
150+
TestWidgetWaitUtility.waitForDialogToAppear(bot, "IDF Launch Target Changed", 5000);
151+
bot.button("Yes").click();
152+
bot.sleep(500);
156153
}
157154

158155
private static void whenDeleteSelectedLaunchTarget() throws Exception

0 commit comments

Comments
 (0)