Mocking

Topics: Developer Forum, User Forum
Aug 5, 2007 at 11:05 AM
Hi,

I'm looking forward to using this framework, however, before trying to figure this out, I'd like to ask. Can I mock my dependencies with Plasma? Can I use mock frameworks?

While I'm in the editor, a quick suggestion for future development. You might want to implement something that allows us to write more readable tests. For example, instead of LinkButton.Click(form, "LinkButton1"), we could write something that is closer to the original code:
Dim LinkButton1 As New LinkButtonTester(form, "LinkButton1")
(Or: Dim LinkButton1 As LinkButtonTester = form.GetControlTester(Of LinkButton)("LinkButton1"))
SecondRequest = LinkButton1.Click()

Especially, things like
FindHtmlElementById("Label1").InnerHtml
really complicate things, since I should figure out my HTML structure and know the implementation of the Label control. Could be just
Dim Label1 as LabelTester = form.GetControlTester(Of Label) ("Label1")
Assert.AreEqual("LinkButton Pushed!", Label1.Text)

Anyway, the toughest part is there, all my suggestions are sort of syntactic sugar.

On the other hand, judging from the HTML-related methods, do you just parse the HTML output for testing? If yes, it makes testing complex pages almost impossible. Just consider a GridView with template fields. Since everything is in-process, is it possible to inspect my Page object before rendering, and test all the controls' properties directly?

Thanks

ulu