let us say i have a ruby script. This ruby script is a GUI with input
fields created with qt creator. Depending on how the fields are filled
my script has to create a new ruby file without GUI.
The ulterior motive is that I will create a Testfile with the inputs in
the GUI. I select the function that should be tested and the arguments
of the funtion etc...
Now, my questions is how would you would implement this?
I think it is not a good idea to open a File with IO library and fill
this with strings and arguments. It is not so flexible.
Any suggestions?
Instead of generating a script, generate a configuration file that a
script can use to run.
I do have to ask why you're doing this, though; are these sorts of tests
going to be repeatable without re-entering the same data over and over?
If not, I'd suggest using the GUI app to generate reusable test samples
(or perhaps features if you're using cucumber).
Full disclosure: I really hate using GUI apps when I can do it with a
command line app/script, especially if it's something that's
repetitious.
let us say i have a ruby script. This ruby script is a GUI with input
fields created with qt creator. Depending on how the fields are filled
my script has to create a new ruby file without GUI.
The ulterior motive is that I will create a Testfile with the inputs in
the GUI. I select the function that should be tested and the arguments
of the funtion etc...
Now, my questions is how would you would implement this?
I think it is not a good idea to open a File with IO library and fill
this with strings and arguments. It is not so flexible.
Any suggestions?
TEMPLATE=<<EEND
require 'rspec'
# the command...
%s
EEND
Ruiby.app :height=> 30 do
flow do
label "Your script : "
w=entry("")
button("Go") do
File.open(FILE,"w") { |f| f.puts(TEMPLATE % [w.text.strip]) }
log system("ruby",FILE)
end
end
end