Mailinglist Archive: yast-devel (144 mails)

< Previous Next >
Re: [yast-devel] unit tests for yast modules written in ruby
On Mon, 12 Aug 2013 15:52:39 +0200
Vladimir Moravec <vmoravec@xxxxxxxx> wrote:

Dne 12.8.2013 14:47, Ladislav Slezak napsal(a):
...
I do not have any strong preference, I only know the test-unit +
mocha which we already use in Webyast and SLMS. (SLMS in addition
to this uses factory_girl, but Yast does not need any DB mocking so
it's irrelevant here...)

but before we dive into a massive flamewar re: which one is the
best,

I don't think there will be a flamewar as Yast developers do not
know any of them, and the legacy Yast testing framework (expects +
dejagnu) works completely differently (and looks weird from Ruby
perspective)...

there's another topic to chew on: do we need to standardize this
at all?

Having a common standard in all Yast packages should be preferred.
Yast maintainers change quite often, some modules are moved or
changed between maintainers etc..

This is the for me the strongest argument to use a single test
framework.



More frameworks also mean more maintenance effort
(to package them to RPMS).

Yep, and do not forget the dependencies and support accross several
sles and opensuse releases.

Well, it is not needed if we do unit testing only in jenkins and not
during runtime, then you don't need to support it. It allows us to have
more freedom when we choose testing framework.


I would prefer to use the potential of ruby standard library and vote
for test/unit but it lacks support for mocking and stubbing which
brings additional dependency on another library, e.g. [1].

On the other hand there are rspec and minitest that have built-in
mocking support and a nice testing DSL; and both libs have good
maintainers and tons of extensions (if needed). The advantage of using
minitest is that it provides the test/unit style of writing unit
tests.

I personally like how rspec write its test description as it allows
nice orientation in tests, especially when it starting grown. But even
simple test/unit style is fine for me.


Mayge we might have to make the effort to try them out on some
translated yast code before we make the final decision and rewrite the
tests afterwards when the experience proves unsatisfactory.

well, I think it more depends on taste of developer and we already have
bunch of code where we can check how it looks. E.g. SLMS and webyast
for test/unit style e.g. [1] and y2r for rspec style e.g. [2]. Ruby
bindings use also test unit [3]

[1]
https://github.com/webyast/webyast/blob/master/webyast/test/unit/basesystem_test.rb
[2]
https://github.com/yast/y2r/blob/master/spec/y2r/parser_spec.rb
[3]
https://github.com/yast/yast-ruby-bindings/blob/master/tests/ruby/builtins_test.rb

Josef


vlado

[1] https://github.com/freerange/mocha



--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
Follow Ups