Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought


Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

* | |

  Show Posts
Pages: [1]
1  PureMVC Manifold / Standard Version / Re: Unit testing with PureMVC: recreating the singletons for each test on: October 23, 2009, 10:35:52
@Tek,
I didn't realise it was so easy to switch a single core project to a multi-core one. This may well be a better solution. However the single core solution has the advantage that there can only be one MVC instance. I like the idea of applying this restriction to a project unless it must import "modules" that need their own MVCs.

@puremvc
Thanks for the tip off re Richard Szalay's work. I have contacted Richard to see whether he has already covered the type of mocks I've been working on.

I may well shelve my project on the strength of what you have both told me. If not, I'll post details of it as and when I finish it.

Thanks,
David Arno.
2  PureMVC Manifold / Standard Version / Unit testing with PureMVC: recreating the singletons for each test on: October 22, 2009, 06:59:38
I have been experimenting with unit testing with PureMVC. Two problems I encountered were:

1. Since PureMVC is singleton-based, I cannot destroy the entire PureMVC framework between tests. I have checked this website, but there doesn't seem to be a testing framework that addresses this.
2. There doesn't seem to be a mocking framework for PureMVC, so proxy, command and mediator mocks have to be written from scratch.

I looked into two possible ways of addressing the first issue:

1. Devise a way of ensuring that the MVC destroyed all references to mediators, proxies and commands between tests.
2. Create a new instance of the MVC for each test.

I decided that the first approach was too unreliable as it still left the facade and MVC classes hanging around between tests and they still might have state data that could affect future tests. I have therefore been experimenting with Flex Unit-based framework that destroys the singletons and creates new instances of them between tests, and with creating some mock classes.

Before going too far down this path though, I wanted to check whether I'd missed anything blindingly obvious. Does PureMVC already have such frameworks that I have missed? Does PureMVC already have some way of fully resetting its state between unit tests?

If not, I'd like to develop the ideas into a proper framework and publish it. Is there a way of getting approval from the PureMVC team/ community for this?

Thanks to anyone listening,
David Arno.
Pages: [1]