Monday, September 11, 2006

YATSY: Yet Another Test Server - Yaws compatible

Yatsy is a simple test framework for testing your Erlang code. It makes it possible to execute test suites according to a defined structure and format, presenting the result either dynamically (via Yaws) or by generated HTML files.

A testcase is implemented by a function that you write. You collect a number of such testcases in an Erlang module which ends in: _SUITE.erl. You may have any number of such test suite modules which you compile to beam files located in your ebin directories.

You start your system, add the code paths to Yatsy and Yaws and start Yatsy. Yatsy will now automatically find all test suite modules that exist as beam files in you code path. Next you order Yatsy to run your test cases, which it will do suite by suite. The result will be accessible by pointing a Web browser to: http://localhost:8888/yatsy.yaws .

Yatsy is under development, but it is already possible to run test cases locally or on a remote Erlang node, to have HTML pages to be generated on disk or simply ask Yaws to provide them.

The intelligent reader may now spot the similarities with the Erlang/OTP Test Server, and indeed Yatsy has taken the main ideas from it. The main difference is the close connection to Yaws but more importantly: Yatsy lives on http://code.google.com/p/yatsy and can therfore be managed in a common Open Source model.

More news about Yatsy will be posted here in the future.

Thursday, September 07, 2006

A new Yaws appmod: ymnesia

I have added a (IMHO) very useful appmod to the Yaws CVS.

ymnesia.erl makes it easy to browse and search in your
Mnesia tables.

To set it up, add it as an appmod:

appmods = [{"showdb", ymnesia}],


Then point your browser to:

http://<host>/showdb/


You will see a table with all your Mnesia tables
and their fields. You can now perform searches
and view only certain fields if you so whish.

Wednesday, September 06, 2006

Starting Yaws in embedded mode

I have comitted some new functions to make it really
easy to start Yaws in embedded mode from your own
system. This way, it is not necessary to specify any
-yaws switch to the Erlang start script or to include
the yaws.hrl file to access the sconf/gconf records of Yaws.


The minimal information you need to specify is the 'DocRoot',
i.e the location where your .html and .yaws files lives.
All other configuration parameters will get the same default
values as defined in yaws.hrl.


It is also possible to override any of the parameter in the
sconf/gconf records if you so wish. See examples of the three
ways of invoking the new functions yaws:start_embedded/1,2,3 below:


DocRoot = "/home/tobbe/docroot",
GL=[{trace,false},{tmpdir,local_path(["priv", "tmp"]),
{flags,[{auth_log,false},{copy_errlog,false}]}],
SL=[{port,Port},{appmods,AppMods},
{flags,[{access_log,false}]}],

yaws:start_embedded(DocRoot). % alternative 1.

yaws:start_embedded{DocRoot, SL). % alternative 2.

yaws:start_embedded{DocRoot, SL, GL). % alternative 3.