Obit Unit Testing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Obit Unit Testing

Ryan Pusztai
Hi,

I am wondering if anyone has any experience using Orbit [1] and developing tests for the created web application? I am looking for some general strategy and hoping that it can be done easily. Thanks.
--
Regards,
Ryan

Reply | Threaded
Open this post in threaded view
|

Re: Obit Unit Testing

steve donovan
On Wed, Aug 3, 2011 at 8:37 PM, Ryan Pusztai <[hidden email]> wrote:
> I am wondering if anyone has any experience using Orbit [1] and developing
> tests for the created web application? I am looking for some
> general strategy and hoping that it can be done easily. Thanks.

One thing I did with Orbiter was to have a 'test' mode where the app
would spit out the generated HTML, rather than serve it up.

The equivalent for Orbit would be to use wget to grab Orbit pages as
HTML and check that. Would certainly work as a regression test - i.e.
that a page continues to generate exactly the same code as before.

Orbit's htmlification mode is powerful but will output any tags,
spelled correctly or not. E.g. if you typed tabl {...} in a hurry you
would get <tabl ...> tags.  So some kind of HTML verifier would be
useful.

steve d.

Reply | Threaded
Open this post in threaded view
|

Re: Obit Unit Testing

Dirk Feytons
In reply to this post by Ryan Pusztai
On Wed, Aug 3, 2011 at 20:37, Ryan Pusztai <[hidden email]> wrote:
> Hi,
> I am wondering if anyone has any experience using Orbit [1] and developing
> tests for the created web application? I am looking for some
> general strategy and hoping that it can be done easily. Thanks.
> --
> Regards,
> Ryan
> [1] http://keplerproject.github.com/orbit/

Perhaps Selenium? http://seleniumhq.org/
I've been using it successfully with our web framework in combination
with a custom Lua code coverage tool to measure the completeness of
the tests. All this is controlled and reported via a Jenkins CI setup.


Dirk

Reply | Threaded
Open this post in threaded view
|

Re: Obit Unit Testing

Ryan Pusztai
In reply to this post by steve donovan
Steve,

On Thu, Aug 4, 2011 at 2:26 AM, steve donovan <[hidden email]> wrote:
On Wed, Aug 3, 2011 at 8:37 PM, Ryan Pusztai <[hidden email]> wrote:
> I am wondering if anyone has any experience using Orbit [1] and developing
> tests for the created web application? I am looking for some
> general strategy and hoping that it can be done easily. Thanks.

One thing I did with Orbiter was to have a 'test' mode where the app
would spit out the generated HTML, rather than serve it up.

The equivalent for Orbit would be to use wget to grab Orbit pages as
HTML and check that. Would certainly work as a regression test - i.e.
that a page continues to generate exactly the same code as before.

Orbit's htmlification mode is powerful but will output any tags,
spelled correctly or not. E.g. if you typed tabl {...} in a hurry you
would get <tabl ...> tags.  So some kind of HTML verifier would be
useful.

This is a wonderful idea and I really want/need this to work. Can you give me ideas on how to write an Orbit and Orbiter app in the same code. This would allow for local testing using Orbiter, then I use Orbit on the production server to host the released application.

I have tried using Orbiter in Orbit. I found this in the documentation:

Since such widgets could be useful for Orbit programmers as well, I've introduced some bridging code so that Orbit applications can also use Orbiter widgets. Look at the dropdown-orbit.lua example - the key statement is:


module("dropdown_test", package.seeall, orbit.new, html.new)

That is, html.new is another function that gets passed the new module object. Please note that the actual widgets must be loaded after the modulestatement, since they may want to setup some static dispatches. This is somewhat clumsy, and likely to change in later versions: but the point is that the non-core parts of Orbiter can be used by Orbit.

but it did not work at all. I did get your simple example to work, but my complex app did not port at all. Any ideas?
--
Regards,
Ryan

Reply | Threaded
Open this post in threaded view
|

Re: Obit Unit Testing

Fabio Mascarenhas
In reply to this post by Ryan Pusztai
Hi, Ryan,

It is not specific to Orbit, but Norman Clarke has contributed code to
WSAPI that lets you mock WSAPI requests, so you can "require" an Orbit
application and test it without a webserver present.

https://github.com/keplerproject/wsapi/blob/master/tests/mock_test.lua

--
Fabio Mascarenhas



On Wed, Aug 3, 2011 at 3:37 PM, Ryan Pusztai <[hidden email]> wrote:
> Hi,
> I am wondering if anyone has any experience using Orbit [1] and developing
> tests for the created web application? I am looking for some
> general strategy and hoping that it can be done easily. Thanks.
> --
> Regards,
> Ryan
> [1] http://keplerproject.github.com/orbit/