PDA

View Full Version : [Mondrian] JUnit test cross-talk



Richard Emberson
03-13-2007, 11:10 AM
The junit tests testAllMemberCaption and
testAllLevelName in the file BasicQueryTest.java
create Dimensions in the Sales cube, Gender3 and
Gender4 respectfully. For all subsequent
JUnit tests these dimensions are a part of the
the Sales cube definition.
This is junit test cross-talk.
Is there a way for these two tests to create
temporary dimensions, run their tests, and
the remove the dimensions after their tests
complete?

I assume that junit tests with side-effects are
not a good thing.

Richard

--
Quis custodiet ipsos custodes:
This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all
copies of the original message.
_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian

Julian Hyde
03-15-2007, 10:10 PM
> Is there a way for these two tests to create
> temporary dimensions, run their tests, and
> the remove the dimensions after their tests
> complete?

Yes! Use a sub-class of TestContext which reads a modified version of
FoodMart as it creates its connection.

Use the TestContext.create() and TestContext.createSubstitutingCube()
methods. See SchemaTest for examples.

I've been intending to clean up tests which use createCube and
createDimension - and also to remove mutant definitions in Foodmart.xml,
such as "Sales 2" and "Sales Ragged" - but I never got round to it.

Julian


> -----Original Message-----
> From: mondrian-bounces (AT) pentaho (DOT) org
> [mailto:mondrian-bounces (AT) pentaho (DOT) org] On Behalf Of Richard Emberson
> Sent: Tuesday, March 13, 2007 8:11 AM
> To: Mondrian developer mailing list
> Subject: [Mondrian] JUnit test cross-talk
>
> The junit tests testAllMemberCaption and
> testAllLevelName in the file BasicQueryTest.java
> create Dimensions in the Sales cube, Gender3 and
> Gender4 respectfully. For all subsequent
> JUnit tests these dimensions are a part of the
> the Sales cube definition.
> This is junit test cross-talk.
>
> I assume that junit tests with side-effects are
> not a good thing.
>
> Richard
>
> --
> Quis custodiet ipsos custodes:
> This email message is for the sole use of the intended
> recipient(s) and
> may contain confidential information. Any unauthorized review, use,
> disclosure or distribution is prohibited. If you are not the intended
> recipient, please contact the sender by reply email and destroy all
> copies of the original message.
> _______________________________________________
> Mondrian mailing list
> Mondrian (AT) pentaho (DOT) org
> http://lists.pentaho.org/mailman/listinfo/mondrian
>

_______________________________________________
Mondrian mailing list
Mondrian (AT) pentaho (DOT) org
http://lists.pentaho.org/mailman/listinfo/mondrian