|Pliant talk forum
Feature request: Testing UI
Discussion on implementing tests.
|Message posted by maybe Boris Reitman on 2007/12/02 17:21:43
|Hubert, if you can give me some outline of where I can modify
the code to give ids to all widgets, and plus, where to modify the code
to create a command to press or fill a widget given an id, it would
be very helpful.
|Message posted by maybe Hubert Tonneau on 2007/12/02 17:51:44
|It's not a simple task.
Let's assume the following code:
section "foo" dynamic
each r table
Assuming that table is a database table.
How do I satisfy both conditions:
. the id for each button is unique.
. the id of the button associated with each record is stable when the section
The only solution I see at the moment would be the heavy one:
section "foo" dynamic
each r table
button "edit" id "table "+keyof:r
|Message posted by maybe Boris Reitman on 2007/12/02 20:15:05
|I don't see any problem with that. User should pick the ids explicitely.
Default id values are not needed. User will label the ids in a most comfortable
way to script a test.
The http_proxy should probably add a prefix like "widget_"
to all ids in order not to clash with some other content in the html template.
The ids for http_proxy output are only need for binding custom js events.
All testing of the ui is done without any visible gui, just by driving
the ui server.
So the server should keep a dictionary mapping ids to widgets, and the test engine
should be a ui client stripped out of the gui, sending events to the
server by a script, identifying widgets by the ids.
The only other note is that I'd like the test and the ui server to work with
the same database, so that the test can prepopulate the database, then
look at ui output, then do more operations with db, the look at ui output again.
This is not gonna be an issue if I always run the test and server in the same
process, which is reasonable.
|Message posted by maybe Boris Reitman on 2007/12/24 07:44:30
|The following code to set a text field seems to work in that it modifies
the value of the variable. However, I don't see any changes in the
graphical ui client. What do I need to call to send updates to the client ?
constant from_index (the_function '. from string' Universal Str Str CBool Int Int -> Status):generic_index
function from_string data string options may_skip skiped offset function -> status
arg Universal data ; arg Str string options ; arg CBool may_skip ; arg_w Int skiped offset ; arg Function function ; arg Status status
method c set sid vid value
arg_rw UIServerContext c ; arg Str sid vid value
var Link:UIServerSection section :> (c:server_env first "section "+sid) map UIServerSection
if not exists:section and (entry_type addressof:section)=UIServerSection
console "ERROR: section "+sid+" does not exist" eol
var Link:UIServerVariable va :> (section:env first vid) map UIServerVariable
if exists:va and (entry_type addressof:va)=UIServerVariable
var Pointer:Function fun :> (entry_type va:variable) get_generic_method from_index
if exists:fun and fun<>(the_function '. from string' Universal Str Str CBool Int Int -> Status)
console "I AM HERE, calling from_string" eol
from_string (va:variable map Universal) value "db" true (var Int skiped) (var Int offset) fun
(va:database omap Database_) get_root (var Data_ root)
var Data_ data := root search_path va:data_path false
var Status status := data:interface set data addressof:value Str
ovar Str x := "hello"
input "x: " x id "x_input"
button "do it"
set "test" "x_input" "it works"
console "Got x = " x eol
I AM HERE, calling from_string
Got x = it works
|Message posted by maybe Boris Reitman on 2008/03/01 15:59:03
|This actually works, I forgot to put it into a dynamic
section and do a section replay. It can be seen to work in live demo at,
http://demo.hypervolume.com/pliant.html ("gui testing" link)
Question: In testing mode I'd like to not have to replay sections to see
updates to the fields. Without seeing the updates with your eyes, its
hard to develop a test. However, I don't want to create dynamic sections and clobber the
code in order to facilitate writing tests.
So, i'd like to have a "section replay" ability on any
individual fields / widgets. Since these fields are already identified by id,
how can I make them behave as dynamic sections so that I can replay them ?
If this feature takes memory, I can only have it enabled in test mode.
Can you direct me at how I can do this ?