Hi all
I’ve been working on a small package, FloatingTableView.jl, which adds easy support for using TableView.jl from the terminal.
I often find “grid”-based IDEs limiting because you can’t rearrange windows within your application as easy as you would if they were just normal winows. I also prefer Sublime text for editing. As a consequence I wrote this small package to make using TableView easier.
All it does is enact the screenshot in the readme for TableView.jl,
function browse(df, kwargs...)
w = Blink.Window()
body!(w, showtable(df; kwargs...))
end
I would like to work on getting this registered. My question is, how should I design tests for this package? Currently I just call the function browse
a few times, so the runtests.jl
script really just tests to make sure there are no errors.
Any ideas on how to write tests for this? It doesnt have to be too complicated.
Thanks,
Peter
4 Likes
The most realistic low-effort solution is to just do
@test browse(args...) isa WebIO.Scope
which really doesn’t test anything except that your function doesn’t error.
Often for interactive/GUI stuff you can narrow the actual interactive/GUI stuff into a small UI API (which may be internal),
and then the logic of how to do that stuff seperately.
Then you test how the logic interacts with the UI API.
And you take a pass on automatic tests for the UI parts.
This can be done via Mocking.
https://github.com/invenia/Mocking.jl
or
https://github.com/christopher-dG/SimpleMock.jl
handle replacing function calls with mocked out version of them.
On top of those (or other dependency injection) you could use something like
https://github.com/oxinabox/ExpectationStubs.jl
which helps simplify writing arrange-act-assert type tests
4 Likes
Thanks, I may go with this option since mock
ing seems a bit overkill for this package, which is really just a glue package where I implement very few things myself.
To clarify, it would be a very big deal if Blink
stopped being able to display WebIO.Scope
objects, right? There is a community making sure it works?
As in, I can be sure that the Blink
will always be able to display the output of showtable
as long as showtable
is a WebIO.Scope
?
Probably. Blink isn’t particularly well maintained at the moment and the same is somewhat true for WebIO itself.
Thanks for the feedback. I will do the WebIO.Scope
idea and then submit this for registration.
I think I’ve asked you this before, but if you could help me try and get this into a browser window, I’d really appreciate it. I can’t seem to navigate Mux
and WebIO
well enough.
WebIO is kinda buggy in that regard. I’m kinda short on time right now, but I’d love to see the browser integration (via HTTP.jl) directly in TableViews.jl.
1 Like