Skip to content

Commit

Permalink
Cleaned up test suite and ensured all three run and pass
Browse files Browse the repository at this point in the history
  • Loading branch information
Mrockwell2 committed Nov 25, 2024
1 parent d35d750 commit 8ea4a35
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
4 changes: 2 additions & 2 deletions trick_source/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -323,8 +323,8 @@
<configuration>
<printSummary>true</printSummary>
<excludes>
<exclude> **/SimControlApplicationTest.java </exclude>
<exclude> **/DreApplicationTest.java </exclude>
<!-- <exclude> **/SimControlApplicationTest.java </exclude> -->
<!-- <exclude> **/DreApplicationTest.java </exclude> -->
<exclude> **/TrickDPApplicationTest.java </exclude>
<exclude> **/TrickQPApplicationTest.java </exclude>
<exclude> **/MonteMonitorApplicationTest.java </exclude>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
public class DreApplicationTest extends ApplicationTest {

private DreFixture dre_fix;
private MockDreApplication dre_app;

@BeforeClass
public static void onSetUpBeforeClass() {
Expand All @@ -46,9 +47,10 @@ public static void onSetUpBeforeClass() {
protected void onSetUp() {
application(MockDreApplication.class).start();

sleep(1500);
sleep(2000);

dre_fix = new DreFixture(robot(), MockDreApplication.getInstance());
dre_app = MockDreApplication.getInstance(MockDreApplication.class);
dre_fix = new DreFixture(robot(), dre_app);
}

@Test
Expand Down Expand Up @@ -225,7 +227,6 @@ public void testToolbar() {
"drg[DR_GROUP_ID].set_cycle(" + GRP_CYCLE + ")",
"drg[DR_GROUP_ID].set_max_file_size(" + GRP_SIZE + GRP_UNIT.TAG + ")" };

MockDreApplication app = MockDreApplication.getInstance();
String[] output;
boolean setGrpName = false,
setCycle = false,
Expand All @@ -236,7 +237,7 @@ public void testToolbar() {
dre_fix.setCycle(GRP_CYCLE);
dre_fix.setMaxFileSize(GRP_SIZE, GRP_UNIT);

output = app.getSettingsOutput();
output = dre_app.getSettingsOutput();

// Assert
for(String line : output) {
Expand Down Expand Up @@ -335,7 +336,6 @@ public void testLoadDataRecordGroup() {
final Size EXP_UNIT = Size.MB;
final String[] VAR_TYPES = {"charB", "intB", "shortB", "ucharB", "uintB", "ushortB", "mixB"};

MockDreApplication app = MockDreApplication.getInstance();
int sel_opts;
String name, cycle, size;
String[] sel_vars, settings;
Expand All @@ -349,7 +349,7 @@ public void testLoadDataRecordGroup() {

sel_opts = dre_fix.getSelectedOptions();
sel_vars = dre_fix.getSelectedVars();
settings = app.getSettingsOutput();
settings = dre_app.getSettingsOutput();

//ASSERT
assumeThat(sel_vars.length).isEqualTo(VAR_TYPES.length * 4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,11 @@
import trick.common.TestUtils;

public class MockDreApplication extends DreApplication {
private static MockDreApplication the_dre = null;

public MockDreApplication() {
super();
the_dre = this;
}

public static final MockDreApplication getInstance() { return the_dre; }

public String[] getSettingsOutput() {
StringWriter strWrt = new StringWriter();
try{ writeGroupSettings(strWrt); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public void testEditTable() {
// CLEANUP
for(int i = 0; i < inital_values.length; i++) {
tv_fix.editVariableTable(i, 1, inital_values[i]);
sleep(250);
sleep(500);
}
}

Expand Down Expand Up @@ -299,7 +299,6 @@ public void testLoadVariables_SetValues() {

// ACT
tv_fix.openSetMenuItem(SAVED_FILE);

sleep(500);

res_vars = tv_fix.getSelectedVars();
Expand All @@ -309,6 +308,7 @@ public void testLoadVariables_SetValues() {

// CLEANUP
tv_fix.openSetMenuItem(ORIGINAL_VALS_FILE);
sleep(500);
}

@Test
Expand All @@ -331,7 +331,6 @@ public void testSetValues() {

// ACT
tv_fix.setValMenuItem(SAVED_FILE);

sleep(500);

res_vars1 = tv_fix.getSelectedVars();
Expand All @@ -351,7 +350,8 @@ public void testSetValues() {
assertThat2DArraysAreEqual(res_vars2, SEL_VARS);

// CLEANUP
tv_fix.openSetMenuItem(ORIGINAL_VALS_FILE);
tv_fix.setValMenuItem(ORIGINAL_VALS_FILE);
sleep(500);
}

@Test
Expand Down

0 comments on commit 8ea4a35

Please sign in to comment.