SquareBracketAssociates / BuildingApplicationWithSpec2

A book to build user interfaces using the Spec 2.0 framework.
21 stars 12 forks source link

Finish chapter "Testing Spec applications" #75

Closed koendehondt closed 4 months ago

koendehondt commented 5 months ago
koendehondt commented 5 months ago

The status reads:

Looking for some source of already written tests - may be the launcher so that people can have a look

@Ducasse Shouldn't we simply use the example that is in the chapter already, instead of using other code?

The test code is in the chapter, but the presenter class is not. The code is in Chapters/TestingInSpec/Spec2-Testing.st.

Ducasse commented 5 months ago

I do not remember :) I probably thought that we do not have enough examples. For the presenter class I have no idea where I put it. And worse I have no idea what is this ClassVisualizerPresenter. I do not think that I wrote it. I do not understand its purpose (can you check the author using some VS magic?).

koendehondt commented 5 months ago

After re-reading the chapter "Testing Spec applications", I think the example with ClassVisualizerPresenter is strange. It has two functionalities:

  1. When a class is selected, the definition string is shown.
  2. When a button is selected, a morph with the class name changes color.

These two functionalities have no relation. Very strange. Very confusing.

I wonder whether it wouldn't be better to remove all the test code and move the section "Testing your application UI" from the chapter "Most of Spec in on example" to this chapter.

koendehondt commented 5 months ago

I do not remember :) I probably thought that we do not have enough examples. For the presenter class I have no idea where I put it. And worse I have no idea what is this ClassVisualizerPresenter. I do not think that I wrote it. I do not understand its purpose (can you check the author using some VS magic?).

You added it 😁. See https://github.com/SquareBracketAssociates/BuildingApplicationWithSpec2/commit/f1d5ec12406399bde2e9ae085a10ec00e852901f. The code was added by Christophe in https://github.com/SquareBracketAssociates/BuildingApplicationWithSpec2/commit/4ff405af847fff2cbc9000e18b3c0ef64efd7dfb.

Ducasse commented 5 months ago

To me this example is a non sense. I do not understand why I would color a class. I would keep the test in the Most... because people should write tests. Now we could just design a little example that is better than this one :)

koendehondt commented 4 months ago

@Ducasse I have written another little example that has a list and some buttons. You find the code in https://github.com/SquareBracketAssociates/CodeOfSpec20Book/blob/master/src/CodeOfSpec20Book/ColorChooser.class.st Here is a screenshot:

ExampleApplication

I am adapting the text. I expect to finish tomorrow. I will assign you as reviewer when I am done.