dimanche 22 février 2015

How to retrieve and test fields in the main window using UISpec4J

I have a step sequencer application that I wrote in Swing using a model-view-controller pattern. I'm currently trying to test it using UISpec4J. From what I can tell, UISpec creates a container once you get the main window, and this container holds the main window's instance variables as well as various attributes.


My question is, how can I retrieve the components instantiated in the main window so I can test their methods and variables? For example, my first simple test is to see if the correct number of notes and chords are displayed. I'm trying to retrieve the controller so I can get the model, which contains the note square grid, number of beats etc. I can't find the right method to use, I've tried using a matcher and also using getComponent(), getUIComponents() etc. I'm afraid my understanding ends there and I've been sifting through the documentation for hours trying to figure out how to approach this.


In my screenshots you can see the controller instantiated in the main window. I would simply like to access that, as that will allow me to access everything else and test whatever I like. Does anyone know how I might retrieve it? Thanks!


test code: http://ift.tt/1D1RQYk


workspace: http://ift.tt/1ElELNL


Aucun commentaire:

Enregistrer un commentaire