in reply to Passing data between modules using Test::Class

I tried the obvious, i.e. define a foo() accessor in the base Service class, and then use set/get in Service_A/Service_B respectively, but this does not work.

The reason being that Service_A and Service_B tests would be run on different objects that don't share state.

I was wondering if any of you have come across this problem, and found a way out, preferably using Test::Class and if not, what is the best way to solve this.

Without more information on the relationship between the service objects it's hard to tell. Can you show what/why Service_B needs Service_A's test results?

  • Comment on Re: Passing data between modules using Test::Class

Replies are listed 'Best First'.
Re^2: Passing data between modules using Test::Class
by arc_of_descent (Hermit) on Dec 13, 2006 at 07:31 UTC

    Hey Adrian,

    As I mentioned in my updated post, I'm now passing data by use of a class variable common to both Service_A and Service_B

    Without more information on the relationship between the service objects it's hard to tell. Can you show what/why Service_B needs Service_A's test results?

    I don't think that should matter. This test suite is for the Google::Adwords module. When I run the sandbox tests for, say the CampaignService test module, I then require the campaign ids for use in the AdGroupService test module. These are only for the sandbox tests, and I can test the various service modules independently otherwise.


    --
    Rohan

      I don't think that should matter. This test suite is for the Google::Adwords module. When I run the sandbox tests for, say the CampaignService test module, I then require the campaign ids for use in the AdGroupService test module. These are only for the sandbox tests, and I can test the various service modules independently otherwise.

      Fair enough. If it were me I'd probably factor out the common code into a separate module that both test classes used, enabling me to run each class independently. But that's just me ;-)