Project

General

Profile

Testing plugins

Added by Giovanni Junior almost 15 years ago

What is the recommended way to test Redmine plugins? I'm trying to put #443's code in a plugin, but I am having lots of trouble testing it (with Rails' builtin libraries). I believe that some of the problems come from the fact that I'm overriding/adding functionality to Redmine's models.

Regards,

Giovanni


Replies (8)

RE: Testing plugins - Added by Michael Hamson almost 15 years ago

As time permits, I will be writing and/or participating in the development of a TCM plugin for Redmine. If there are others who want to be a part of this please let me know. Being that I am only now moving into ruby/rails this might take a wee bit of time for me alone. :(

-Michael

RE: Testing plugins - Added by Eric Davis almost 15 years ago

Giovanni Junior wrote:

What is the recommended way to test Redmine plugins? I'm trying to put #443's code in a plugin, but I am having lots of trouble testing it (with Rails' builtin libraries). I believe that some of the problems come from the fact that I'm overriding/adding functionality to Redmine's models.

I use RSpec and cucumber myself but that's just because I'm very comfortable with them. I'd recommend you use the basic Test::Unit, that way the plugin can be merged into the core at a later point. Is there a specific error you're getting?

Michael Hamson wrote:

As time permits, I will be writing and/or participating in the development of a TCM plugin for Redmine.

What's TCM? I saw Turner Classic Movies in Google and I don't think that's the same thing.

Eric

RE: Testing plugins - Added by Giovanni Junior almost 15 years ago

Hello Eric

I asked this question mainly because, besides the difficulty I was having, I saw that you didn't use Test::Unit in some of your plugins.

Well, in fact I already managed to work around the problem I vaguely mentioned in my first post. I was just waiting for some enlightning response (like yours) before posting what I found out.

Yes, the problem was related to the fact that I'm overriding core classes. More precisely, I was having problems when trying to add some (issue and version) fixtures to Redmine's default ones.

Initially, I tried to put the fixture files in my plugin. However, reading the documentation in Engines::Testing, I found out that it wouldn't work, because my files would be overwritten with Redmine's ones before the tests were executed.

So I replaced Redmine's fixture files directly with my ones, but again (and oddly) it didn't work.

After some investigation, I found that the files containing fixtures (copied by Engines::Testing to a temporary directory) weren't being overwritten at each execution, even if their contents (and length) had changed between those executions (I'm using Windows).

To make Test::Unit find the updated files, I had to comment out the following line in my plugin's automatically generated test_helper:

 Engines::Testing.set_fixture_path

All this makes me believe that Engines, perhaps intentionally, doesn't support modifications (or additions, in my case) in Redmine's default fixtures, right?

Giovanni

RE: Testing plugins - Added by maximiliano mannise almost 15 years ago

I think TCM mean Test Case Management ... if so, it will be an interesting plugin for redmine ... you can manage the test cycle in the project, integrated with: issues, task, req and so on.

I have no experience into ruby/rails but I can participate with the requirement for the TCM plugin.

regards
Max

RE: Testing plugins - Added by Jens Goldhammer almost 15 years ago

Please look at http://www.redmine.org/boards/3/topics/6275#message-6480 and add your requirements if you want.

Thanks,
Jens

RE: Testing plugins - Added by Eric Davis almost 15 years ago

Giovanni Junior wrote:

I asked this question mainly because, besides the difficulty I was having, I saw that you didn't use Test::Unit in some of your plugins.

I'm going to try out Test::Unit with shoulda and a few other gems on my next plugin. If I get it working, I'll see about writing about it to my blog.

Initially, I tried to put the fixture files in my plugin. However, reading the documentation in Engines::Testing, I found out that it wouldn't work, because my files would be overwritten with Redmine's ones before the tests were executed.

Frankly, I'm wanting to get rid of fixtures from Redmine completely. They are very brittle and make it hard to test all the different cases. I've got Machinest working with Redmine's data model in a plugin. I think the tests will be a little slower but they should be a lot more maintainable and also catch more edge cases.

Eric

RE: Testing plugins - Added by Juan Alvarez over 13 years ago

Hi guys.

I'm new to Redmine, and I made a simple plugin that overrides the base.rhtml view and modify the menu items. So when I launch the redmine tests, I'm having failures related with that.

Is there any way to pass the tests, without any failure or error, and without editing the Redmine code but using the plugin I made? I would like to find out a solution to overwrite the Redmine test, in order my customized Redmine can pass all tests.

Thank you

Juan

RE: Testing plugins - Added by Denis Savitskiy about 12 years ago

Eric Davis wrote:

I use RSpec and cucumber myself but that's just because I'm very comfortable with them. I'd recommend you use the basic Test::Unit, that way the plugin can be merged into the core at a later point. Is there a specific error you're getting?

Can you, please, provide a tutorial implement this into plugins and start testing? I'm in a great need..

    (1-8/8)