Class ProgrammaticPageSaveTest

java.lang.Object
com.studentgui.tools.ProgrammaticPageSaveTest

public class ProgrammaticPageSaveTest extends Object
Automated integration test for programmatic page manipulation and database submission.

Simulates user interaction with the Braille assessment page by:

  1. Programmatically instantiating a Braille page with synthetic student/date
  2. Using reflection to access and populate internal PhaseScoreField components
  3. Locating the "Submit Braille Data" button via accessible name
  4. Programmatically triggering the submit action via AbstractButton.doClick()

Purpose:

  • Validates end-to-end page submission workflow without GUI interaction
  • Tests database insert, JSON export, and PNG chart generation in automated context
  • Verifies reflection-based access to page internals for testing purposes
  • Provides reference for programmatic testing of other assessment pages

Usage:


 java -cp StudentDataGUI.jar com.studentgui.tools.ProgrammaticPageSaveTest
 

Expected Side Effects:

  • New Braille progress session inserted into database for student "Smoke Test"
  • JSON export written to StudentDataFiles/Smoke_Test/Sessions/Braille/
  • Phase-grouped PNG plots written to StudentDataFiles/Smoke_Test/plots/
  • Markdown and HTML reports generated in StudentDataFiles/Smoke_Test/reports/

Reflection Usage: Accesses private skillFields array in Braille to set all 64 Braille skills to a score of 3. This demonstrates how to programmatically manipulate page state for testing when public setters are not available.

Validation: After execution, inspect:

  • Database: sqlite3 app_home/StudentDatabase/students.db "SELECT * FROM ProgressSession ORDER BY id DESC LIMIT 1;"
  • JSON exports: ls -lt app_home/StudentDataFiles/Smoke_Test/Sessions/Braille/
  • Generated plots: ls -lt app_home/StudentDataFiles/Smoke_Test/plots/

Note: This test modifies the live database. Run in a test environment or use a separate APP_HOME directory to avoid polluting production data.

See Also:
  • Method Details

    • main

      public static void main(String[] args) throws Exception
      Program entry to run the programmatic page save test.
      Parameters:
      args - ignored
      Throws:
      Exception - on reflection or DB errors