Mailinglist Archive: yast-devel (66 mails)

< Previous Next >
[yast-devel] Easy SCR Mocking in Testsuites
  • From: Lukas Ocilka <lukas.ocilka@xxxxxxxx>
  • Date: Mon, 24 Jun 2013 16:08:36 +0200
  • Message-id: <51C852E4.40405@suse.com>
Hi,

As already announced last week, I've created a pure Ruby module as a replacement for YaST Runlevel called YaST Services Manager. For a pure Ruby module, I wanted to use a pure Ruby testing.

See the example here https://github.com/kobliha/yast-services-manager/blob/master/test/unit/system_target.rb

Now we don't need to define a full SCR hash but we can simply mock the the returning values on-the-fly. Any function or method can be mocked and they can return different object/values in different states (1st call, 2nd call, 3rd call...).

What we can mock with mocha can be found here:
http://jamesmead.org/blog/2006-09-01-mocha-quickstart
Of course, you can do even more. If you are interested, fork the yast-services-manager project and try to create your own testsuite (then make a pull request). For instance, you can test Starting and Enabling services. It's easy, it's fun! :)

Thanks and Bye
Lukas

--

Lukas Ocilka, Cloud & Systems Management Department
SUSE LINUX s.r.o., Praha
--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: yast-devel+owner@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages