mirror of
https://github.com/nasa/trick.git
synced 2024-12-20 05:37:55 +00:00
Adding testing documentation
This commit is contained in:
parent
8ea4a35125
commit
9faa5f95a4
@ -53,6 +53,15 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
dre_fix = new DreFixture(robot(), dre_app);
|
dre_fix = new DreFixture(robot(), dre_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test changing the selected format
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select ASCII and save the selected options within ascii_sel
|
||||||
|
* 2) Select HDF5 and save the selected options within hdf5_sel
|
||||||
|
* 3) Select Binary and save the selected options within binary_sel
|
||||||
|
* 4) Verify that each of the saved selected options equals the
|
||||||
|
* expected benchmarks (BINARY_EXP, ASCII_EXP, HDF5_EXP)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFormatOptions() {
|
public void testFormatOptions() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -82,6 +91,15 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(hdf5_sel).isEqualTo(HDF5_EXP);
|
assertThat(hdf5_sel).isEqualTo(HDF5_EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test changing the selected frequency
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select Changes and save the selected options within changes_sel
|
||||||
|
* 2) Select Step and save the selected options within step_sel
|
||||||
|
* 3) Select Always and save the selected options within always_sel
|
||||||
|
* 4) Verify that each of the saved selected options equals the
|
||||||
|
* expected benchmarks (ALWAYS_EXP, CHANGES_EXP, STEP_EXP)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFrequencyOptions() {
|
public void testFrequencyOptions() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -111,6 +129,15 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(step_sel).isEqualTo(STEP_EXP);
|
assertThat(step_sel).isEqualTo(STEP_EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test changing the selected buffer type
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select No Buffer and save the selected options within no_buff_sel
|
||||||
|
* 2) Select Ring Buffer and save the selected options within ring_sel
|
||||||
|
* 3) Select Buffer and save the selected options within buffer_sel
|
||||||
|
* 4) Verify that each of the saved selected options equals the
|
||||||
|
* expected benchmarks (BUFFER_EXP, NO_BUFF_EXP, RING_EXP)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBufferOptions() {
|
public void testBufferOptions() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -140,6 +167,14 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(ring_sel).isEqualTo(RING_EXP);
|
assertThat(ring_sel).isEqualTo(RING_EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test toggling single precision on/off
|
||||||
|
* Procedures:
|
||||||
|
* 1) Toggle single precision on and save the selected options within sp_on_sel
|
||||||
|
* 2) Toggle single precision off and save the selected options within sp_off_sel
|
||||||
|
* 3) Verify that each of the saved selected options equals the
|
||||||
|
* expected benchmarks (SP_OFF_EXP, SP_ON_EXP)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSinglePrecOptions() {
|
public void testSinglePrecOptions() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -164,6 +199,13 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(sp_on_sel).isEqualTo(SP_ON_EXP);
|
assertThat(sp_on_sel).isEqualTo(SP_ON_EXP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Select variables and verify that the Selected Variable
|
||||||
|
* Panel shows the expected output
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select each contents of the Selected Variables panel to the
|
||||||
|
* SEL_VARS array
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSelectVars() {
|
public void testSelectVars() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -191,6 +233,12 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(res_vars[i]).isEqualTo(SEL_VARS[i]);
|
assertThat(res_vars[i]).isEqualTo(SEL_VARS[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Do a basic test of the search panel to verify that it is enabled
|
||||||
|
* Procedure:
|
||||||
|
* 1) Use the search panel to find any variables that have 'var1' in their name.
|
||||||
|
* 2) Compare the search results with the benchmark SEARCH_VARS
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchVars() {
|
public void testSearchVars() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -216,6 +264,14 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
assertThat(found_vars[i]).isEqualTo(SEARCH_VARS[i]);
|
assertThat(found_vars[i]).isEqualTo(SEARCH_VARS[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test inputing information into the toolbar
|
||||||
|
* Procedures:
|
||||||
|
* 1) Enter a group name
|
||||||
|
* 2) Enter a cycle
|
||||||
|
* 3) Set the maximum file size and the unit of measurement
|
||||||
|
* 4) Parse the settings output to verify the correct information was processed
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testToolbar() {
|
public void testToolbar() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -267,6 +323,23 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the save functionality
|
||||||
|
* Procedures:
|
||||||
|
* 1) Enter a group name
|
||||||
|
* 2) Enter a cycle
|
||||||
|
* 3) Set the maximum file size and the unit of measurement
|
||||||
|
* 4) Set the the format as ASCII, the frequency as Changes,
|
||||||
|
* the buffer as No Buffer, and Single Precision on
|
||||||
|
* 5) Select the various different variable types (drx.drt.charB,
|
||||||
|
* drx.drt.intB, drx.drt.shortB, drx.drt.ucharB, drx.drt.uintB,
|
||||||
|
* drx.drt.ushortB, drx.drt.mixB)
|
||||||
|
* 6) Make sure there isn't any remaining test result file from
|
||||||
|
* previous test runs
|
||||||
|
* 7) Click the Save menu item
|
||||||
|
* 8) Save the .dr file to test_result.dr
|
||||||
|
* 9) Compare test_result.dr to the presaved benchmark dre_test_ascii.dr
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSaveDataRecordGroup() {
|
public void testSaveDataRecordGroup() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -323,6 +396,20 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test opening .dr files
|
||||||
|
* Procedures:
|
||||||
|
* 1) Click the Open menu item
|
||||||
|
* 2) Get the selected options and variables and store them in
|
||||||
|
* sel_opts and sel_vars, respectively
|
||||||
|
* 3) Get the settings output and store it in the settings array
|
||||||
|
* 4) Verify that the expected options are selected by comparing
|
||||||
|
* sel_opts with the benchmark EXP_OPTIONS
|
||||||
|
* 5) Parse the settings array and ensure that name, cycle, and
|
||||||
|
* max file size are as expected.
|
||||||
|
* 6) Verify that the selected variables within sel_vars is equal
|
||||||
|
* to the expected within SEL_VARS
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoadDataRecordGroup() {
|
public void testLoadDataRecordGroup() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -337,12 +424,7 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
final String[] VAR_TYPES = {"charB", "intB", "shortB", "ucharB", "uintB", "ushortB", "mixB"};
|
final String[] VAR_TYPES = {"charB", "intB", "shortB", "ucharB", "uintB", "ushortB", "mixB"};
|
||||||
|
|
||||||
int sel_opts;
|
int sel_opts;
|
||||||
String name, cycle, size;
|
|
||||||
String[] sel_vars, settings;
|
String[] sel_vars, settings;
|
||||||
Size unit;
|
|
||||||
boolean setGrpName = false,
|
|
||||||
setCycle = false,
|
|
||||||
setSize = false;
|
|
||||||
|
|
||||||
//ACT
|
//ACT
|
||||||
dre_fix.openMenuItem(TEST_DR.getAbsolutePath());
|
dre_fix.openMenuItem(TEST_DR.getAbsolutePath());
|
||||||
@ -360,13 +442,10 @@ public class DreApplicationTest extends ApplicationTest {
|
|||||||
|
|
||||||
for(String line : settings) {
|
for(String line : settings) {
|
||||||
if (line.contains("drg.append")) {
|
if (line.contains("drg.append")) {
|
||||||
setGrpName = true;
|
|
||||||
assertThat(line).contains(EXP_NAME);
|
assertThat(line).contains(EXP_NAME);
|
||||||
} else if (line.contains("set_cycle")) {
|
} else if (line.contains("set_cycle")) {
|
||||||
setCycle = true;
|
|
||||||
assertThat(line).contains(EXP_CYCLE);
|
assertThat(line).contains(EXP_CYCLE);
|
||||||
} else if(line.contains("set_max_file_size")) {
|
} else if(line.contains("set_max_file_size")) {
|
||||||
setSize = true;
|
|
||||||
assertThat(line).contains(EXP_SIZE)
|
assertThat(line).contains(EXP_SIZE)
|
||||||
.contains(EXP_UNIT.TAG);
|
.contains(EXP_UNIT.TAG);
|
||||||
}
|
}
|
||||||
|
@ -101,31 +101,61 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// JButton Tests
|
// JButton Tests
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testConnectButton() {
|
public void testConnectButton() {
|
||||||
testJButton("Connect", ActionID.CONNECT);
|
testJButton("Connect", ActionID.CONNECT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartButton() {
|
public void testStartButton() {
|
||||||
testJButton("Start", ActionID.START);
|
testJButton("Start", ActionID.START);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFreezeButton() {
|
public void testFreezeButton() {
|
||||||
testJButton("Freeze", ActionID.FREEZE);
|
testJButton("Freeze", ActionID.FREEZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStepButton() {
|
public void testStepButton() {
|
||||||
testJButton("Step", ActionID.STEP);
|
testJButton("Step", ActionID.STEP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testShutdownButton() {
|
public void testShutdownButton() {
|
||||||
testJButton("Shutdown", ActionID.SHUTDOWN);
|
testJButton("Shutdown", ActionID.SHUTDOWN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testExitButton() {
|
public void testExitButton() {
|
||||||
testJButton("Exit", ActionID.EXIT);
|
testJButton("Exit", ActionID.EXIT);
|
||||||
@ -135,16 +165,31 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// JToggleButton Tests
|
// JToggleButton Tests
|
||||||
//-----------------------
|
//-----------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDumpChkpntButton() {
|
public void testDumpChkpntButton() {
|
||||||
testButtonToggleTwice("Dump Chkpnt", ActionID.DUMP_CHKPNT);
|
testButtonToggleTwice("Dump Chkpnt", ActionID.DUMP_CHKPNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoadChkpntButton() {
|
public void testLoadChkpntButton() {
|
||||||
testButtonToggleTwice("Load Chkpnt", ActionID.LOAD_CHKPNT);
|
testButtonToggleTwice("Load Chkpnt", ActionID.LOAD_CHKPNT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLiteToggle() {
|
public void testLiteToggle() {
|
||||||
Frame frame = mainFrame.target();
|
Frame frame = mainFrame.target();
|
||||||
@ -159,11 +204,21 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(toggle2).isEqualTo(SimControlApplication.FULL_SIZE);
|
assertThat(toggle2).isEqualTo(SimControlApplication.FULL_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDataRecToggle() {
|
public void testDataRecToggle() {
|
||||||
testButtonToggleTwice("Data Rec On", "Data Rec Off", ActionID.RECORDING);
|
testButtonToggleTwice("Data Rec On", "Data Rec Off", ActionID.RECORDING);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRealtimeToggle() {
|
public void testRealtimeToggle() {
|
||||||
testButtonToggleTwice("RealTime On", ActionID.REALTIME);
|
testButtonToggleTwice("RealTime On", ActionID.REALTIME);
|
||||||
@ -173,6 +228,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// Status Message Pane Tests
|
// Status Message Pane Tests
|
||||||
//-----------------------------
|
//-----------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStatusMsgPane() {
|
public void testStatusMsgPane() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -188,6 +248,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(editorFixture.target().getText());
|
assertThat(editorFixture.target().getText());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFindPanelButtons() {
|
public void testFindPanelButtons() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -255,6 +320,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// File Menu Tests
|
// File Menu Tests
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFontChange() {
|
public void testFontChange() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -299,6 +369,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(actualFont).isEqualTo(expFont);
|
assertThat(actualFont).isEqualTo(expFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSaveStatusMessage() {
|
public void testSaveStatusMessage() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -315,6 +390,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(action).isEqualTo(ActionID.SAVE_STATUS);
|
assertThat(action).isEqualTo(ActionID.SAVE_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testClearStatusMessage() {
|
public void testClearStatusMessage() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -334,8 +414,13 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(editorFixture.text()).isEqualTo("");
|
assertThat(editorFixture.text()).isEqualTo("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
/* Not sure if I should test each of the LookAndFeel buttons */
|
/* Not sure if I should test each of the LookAndFeel buttons */
|
||||||
|
@Test
|
||||||
public void testLookAndFeel() {
|
public void testLookAndFeel() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
JMenuItemFixture lafItem = mainFrame.menuItem("lookAndFeelMenuItem");
|
JMenuItemFixture lafItem = mainFrame.menuItem("lookAndFeelMenuItem");
|
||||||
@ -367,6 +452,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// Action Menu Tests
|
// Action Menu Tests
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartTrickViewMenuItem() {
|
public void testStartTrickViewMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -383,6 +473,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(loggedAction).isEqualTo(TV_ACTION);
|
assertThat(loggedAction).isEqualTo(TV_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartMalfunctionTrickViewMenuItem() {
|
public void testStartMalfunctionTrickViewMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -399,6 +494,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(loggedAction).isEqualTo(MTV_ACTION);
|
assertThat(loggedAction).isEqualTo(MTV_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFreezeAtMenuItem() {
|
public void testFreezeAtMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -415,6 +515,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(loggedAction).isEqualTo(FREEZE_AT_ACTION);
|
assertThat(loggedAction).isEqualTo(FREEZE_AT_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testFreezeInMenuItem() {
|
public void testFreezeInMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -432,6 +537,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCheckpointMenuItem() {
|
public void testCheckpointMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -448,6 +558,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
assertThat(loggedAction).isEqualTo(CHKPNT_OBJ_ACTION);
|
assertThat(loggedAction).isEqualTo(CHKPNT_OBJ_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testThrottleMenuItem() {
|
public void testThrottleMenuItem() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -468,6 +583,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
// Toolbar Tests
|
// Toolbar Tests
|
||||||
//--------------------
|
//--------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartTrickViewButton() {
|
public void testStartTrickViewButton() {
|
||||||
final JButtonFixture TV_BUTTON = toolBarFixture.button("startTVButton");
|
final JButtonFixture TV_BUTTON = toolBarFixture.button("startTVButton");
|
||||||
@ -476,6 +596,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
testConnectedAction(TV_BUTTON, TV_ACTION);
|
testConnectedAction(TV_BUTTON, TV_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testStartMalfunctionTrickViewButton() {
|
public void testStartMalfunctionTrickViewButton() {
|
||||||
final JButtonFixture MTV_BUTTON = toolBarFixture.button("startMTVButton");
|
final JButtonFixture MTV_BUTTON = toolBarFixture.button("startMTVButton");
|
||||||
@ -484,6 +609,11 @@ public class SimControlApplicationTest extends ApplicationTest {
|
|||||||
testConnectedAction(MTV_BUTTON, MTV_ACTION);
|
testConnectedAction(MTV_BUTTON, MTV_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose:
|
||||||
|
* Procedures:
|
||||||
|
* 1)
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testThrottleButton() {
|
public void testThrottleButton() {
|
||||||
final JButtonFixture THROTTLE_BUTTON = toolBarFixture.button("throttleButton");
|
final JButtonFixture THROTTLE_BUTTON = toolBarFixture.button("throttleButton");
|
||||||
|
@ -18,9 +18,6 @@ import org.junit.Test;
|
|||||||
import trick.common.ApplicationTest;
|
import trick.common.ApplicationTest;
|
||||||
import trick.common.TestUtils;
|
import trick.common.TestUtils;
|
||||||
import trick.tv.fixtures.TVFixture;
|
import trick.tv.fixtures.TVFixture;
|
||||||
import static trick.tv.fixtures.TVFixture.CASE_SENSITIVE_ON;
|
|
||||||
import static trick.tv.fixtures.TVFixture.GREEDY_SEARCH_ON;
|
|
||||||
import static trick.tv.fixtures.TVFixture.REG_EXPRESSION_ON;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -40,6 +37,12 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
private TVFixture tv_fix;
|
private TVFixture tv_fix;
|
||||||
private MockTVApplication tv_app;
|
private MockTVApplication tv_app;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Before Running the Test Suite, prior to the constructor being called:
|
||||||
|
* Compiles and runs SIM_test_dr in the trick/test/ directory.
|
||||||
|
* - Change String SIM_NAME to compile & run another simulation in the
|
||||||
|
* trick/test/ folder
|
||||||
|
*/
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void onSetUpBeforeClass() {
|
public static void onSetUpBeforeClass() {
|
||||||
assumeThat(TestUtils.compileTestSim(SIM_NAME))
|
assumeThat(TestUtils.compileTestSim(SIM_NAME))
|
||||||
@ -52,6 +55,10 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
.isNotNull();
|
.isNotNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* After Running the Test Suite
|
||||||
|
* Kill the running simulation
|
||||||
|
*/
|
||||||
@AfterClass
|
@AfterClass
|
||||||
public static void onCleanUpAfterClass() {
|
public static void onCleanUpAfterClass() {
|
||||||
if(sim_process != null && sim_process.isAlive()) {
|
if(sim_process != null && sim_process.isAlive()) {
|
||||||
@ -59,6 +66,12 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set Up Before Each Test
|
||||||
|
* Start the application using the arguments to provide a host name and port number.
|
||||||
|
* Save the application instance in a variable
|
||||||
|
* Create a test fixture using the instance
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void onSetUp() {
|
protected void onSetUp() {
|
||||||
application(MockTVApplication.class)
|
application(MockTVApplication.class)
|
||||||
@ -72,33 +85,12 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
tv_fix = new TVFixture(robot(), tv_app);
|
tv_fix = new TVFixture(robot(), tv_app);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
/**
|
||||||
public void testGeneric() {
|
* Purpose: Select variables and verify that the expected values are in the table
|
||||||
tv_fix.selectVar("drx.drt.uintB.var1");
|
* Procedures:
|
||||||
tv_fix.setSearchOptions(CASE_SENSITIVE_ON | REG_EXPRESSION_ON | GREEDY_SEARCH_ON);
|
* 1) Select each of the mentioned variables
|
||||||
tv_fix.enterQuery("var1\n");
|
* 2) Compare the table values to the benchmark matrix SEL_VARS
|
||||||
sleep(500);
|
*/
|
||||||
|
|
||||||
System.out.println("SEARCH RESULTS");;
|
|
||||||
String[] results = tv_fix.getSearchResults();
|
|
||||||
for (String string : results) {
|
|
||||||
System.out.println(string);
|
|
||||||
tv_fix.selectVar(string);
|
|
||||||
sleep(250);
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println("\nSEL VARS");
|
|
||||||
String[][] table = tv_fix.getSelectedVars();
|
|
||||||
for (String[] strings : table) {
|
|
||||||
for (String string : strings) {
|
|
||||||
System.out.print(string + "\t");
|
|
||||||
}
|
|
||||||
System.out.println();
|
|
||||||
}
|
|
||||||
|
|
||||||
sleep(5000);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSelectVars() {
|
public void testSelectVars() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -139,6 +131,12 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Do a basic test of the search panel to verify that it is enabled
|
||||||
|
* Procedure:
|
||||||
|
* 1) Use the search panel to find any variables that have 'var1' in their name.
|
||||||
|
* 2) Compare the search results with the benchmark SEARCH_VARS
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSearchVars() {
|
public void testSearchVars() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -164,6 +162,14 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
assertThat(found_vars[i]).isEqualTo(SEARCH_VARS[i]);
|
assertThat(found_vars[i]).isEqualTo(SEARCH_VARS[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Validate that variable values can be changed by editing the table
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select each of the variables within SEL_VARS
|
||||||
|
* 2) Change the values of each of the selected variables
|
||||||
|
* 3) Verify that the table contains the expected values
|
||||||
|
* 4) Return the variables back to their original values
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testEditTable() {
|
public void testEditTable() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -205,6 +211,15 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the save functionality. Specifically that tied to the menu item.
|
||||||
|
* Procedures:
|
||||||
|
* 1) Select the list of variables
|
||||||
|
* 2) Click the Save menu item within the File menu
|
||||||
|
* 3) Enter the path where the new file will be saved to (see File SAVED_OUTPUT)
|
||||||
|
* 4) Compare the contents of the saved file to the benchmark file (see File EXPECTED_OUTPUT)
|
||||||
|
* - If the contents aren't the same, copy the saved file to the FAILED_TEST file for debugging
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSave() {
|
public void testSave() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -251,6 +266,13 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
.isTrue();
|
.isTrue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the Open functionality. It should just add in the variables without overwriting the values
|
||||||
|
* Procedures:
|
||||||
|
* 1) Click the Open menu item
|
||||||
|
* 2) Enter the path where the file will be loaded from (see File SAVED_FILE)
|
||||||
|
* 3) Compare the table after loading to the expected in SEL_VARS.
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoadVariables() {
|
public void testLoadVariables() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -279,6 +301,15 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
assertThat2DArraysAreEqual(res_vars, SEL_VARS);
|
assertThat2DArraysAreEqual(res_vars, SEL_VARS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the Open & Set menu item. It should update the selected variables and their values
|
||||||
|
* Procedures:
|
||||||
|
* 1) Click the Open & Set menu item
|
||||||
|
* 2) Open the file specified by SAVED_FILE
|
||||||
|
* 3) Compare the table after loading to the expected in SEL_VARS.
|
||||||
|
* - The variable values will be different from the default simulation values
|
||||||
|
* 4) Use the Open & Set menu item to reload the orignal values using the ORIGINAL_VALS_FILE variable
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoadVariables_SetValues() {
|
public void testLoadVariables_SetValues() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -311,6 +342,16 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
sleep(500);
|
sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the Set menu item. It should set variable values without changing the selected variables
|
||||||
|
* Procedures:
|
||||||
|
* 1) Click the Set menu item
|
||||||
|
* 2) Use SAVED_FILE to load the values
|
||||||
|
* 3) Record the state of the variable table immediately after loading the file (res_vars1)
|
||||||
|
* 4) Select the variables within SEL_VARS
|
||||||
|
* 5) Verify that res_vars1 is empty
|
||||||
|
* 6) Verify that the variable values have changed to the expected
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testSetValues() {
|
public void testSetValues() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -354,6 +395,16 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
sleep(500);
|
sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Purpose: Test the toggle for turning monitoring on and off
|
||||||
|
* Procedures:
|
||||||
|
* 1) Toggle monitoring off
|
||||||
|
* 2) Select variable "drx.drt.a"
|
||||||
|
* 3) Save the variable entry in the array var_no_monitor
|
||||||
|
* 4) Toggle monitoring back on
|
||||||
|
* 5) Save the updated entry in the array var_monitor
|
||||||
|
* 6) compare both arrays to their expected benchmarks
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testMonitorToggle() {
|
public void testMonitorToggle() {
|
||||||
// ARRANGE
|
// ARRANGE
|
||||||
@ -383,6 +434,10 @@ public class TVApplicationTest extends ApplicationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find a free port, write the number to a file called port.info
|
||||||
|
* within the RUN_gui_test directory. Return the chosen port
|
||||||
|
*/
|
||||||
public static int getOpenPort() {
|
public static int getOpenPort() {
|
||||||
String port = "39595";
|
String port = "39595";
|
||||||
File port_info;
|
File port_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user