I agree that testing landscape can be improved for WebSharper, but can
we discuss/brainstorm for more specific features you'd like to see?
As Dmitri points out, two parts of the puzzle are simple: F#-side code
including RPC methods can be tested as F# code, JavaScript-side
library code should be tested on the client if possible.
Client-side formlets are perhaps the most difficult to test, maybe
Joel will have more ideas on that.
Testing sitelets seams quite feasible. Can we narrow this down a bit,
do you have a specific example of what you would want to verify? You
can write it here and I can try turn it into actual working code.
Thanks!
As for testing translator correctness, at the current state of
WebSharper you'll do well to test it. As we get better with it, more
and more problems (ideally all in the end) with the translation will
be detected at compile time - to either work as expected or fail with
a message. In general I also hope testing as a software engineering
practice should gradually give way to proving. Maybe I will still live
to see a Coq-formalized JS semantics, coupled with some F# or CoreML
semantics, and a certified compiler :)
Anton
--
Kind Regards,
Anton Tayanovskyy
WebSharper™ - type-safe JavaScript in F#
http://intellifactory.com
There is also a tool for integration testing that we played with
internally that we might release one day: basically it is a crawler
running PhantomJS. The idea is simple: during a test build you fire up
a development server, run the app, and start crawling from the root
page everything you can find. PhantomJS is a command-line app that
includes a WebKit browser, so it is aware of JS errors on any of the
pages and it can report them.
Anton
But surely there are, really only two states - the initial F# state, and the final JS state. In this case, you can test the F# logic in its 'compiled' form using FsUnit or similar, whereas for the JS site you would use something like QUnit. I can see where you're going with this, in terms of being able to write F# tests using some sort of binding to QUnit, so that ALL tests exist as F#. That could actually make sense
I actually disagree with your idea of not having to validate WebSharper, because I think that you have to ensure that the translation has 100% fidelity. There's no escaping it, whatever transcompilation technology you choose.