Hi Malintha, Thank you very much for above information. Those will be very much useful for me.
Regards, Erandi Erandi Ganepola Software Engineering Intern +94710695692 +94754191524 On Wed, Feb 3, 2016 at 12:18 PM, Malintha Adikari <[email protected]> wrote: > Hi Erandi, > > We use AutomationContext object to store all test environment related > information. If we want to run a test case using tenant user, we have to > create AutomationContext object providing that tenant user information. So > we are creating AutomationContext object before we start executing test > case (we create this object under @BeforeClass annotation). > > When we create AutomationContext object we are getting user related data > through TestUserMode object. Incase, we need to execute same test case for > both super tenant and tenant user, we create data provider with all those > users and provide that data provider to the test case. Then test case will > be executed sequentially for all users mentioned in the data provider (for > each test run , separate AutomationContext object will be created for the > current user). > > Each test case inherits from base test class where we create > AutomationContext object in it's init() method. In APIMIntergrationBaseTest > class there are two overloading methods > > 1. init() - AutomationContext is created using super tenant > 2. init(TestUserMode userMode) - Automation context is created using the > provided TenantUserMode object. > > We can use following logic to differentiate test cases which are running > in super tenant + tenant mode or only in super tenant mode. > > - If a test case has a data provider and AutomationContext has been > created using TestUserMode object provided by that data provider, that test > case will be executed for all users > > ex: > [2] > > @Factory(dataProvider = "userModeDataProvider") public ESBJAVA3380TestCase > (TestUserMode userMode) { > this.userMode = userMode; > } > @DataProvider(name = "userModeDataProvider") > public static Object[][] userModeDataProvider() { > return new Object[][]{ > new Object[]{TestUserMode.SUPER_TENANT_ADMIN}, > new Object[]{TestUserMode.TENANT_ADMIN}, > }; > } > @BeforeClass(alwaysRun = true) > public void setEnvironment() throws Exception { > ......... > super.init(userMode); > Here we run test case using both super tenant and tenant > > > - If a test case has no data provider and it is using super class > inti() method, that test case is executed only for super tenant. > > > [3] > > public void initialize() throws APIManagerIntegrationTestException, > XPathExpressionException, > MalformedURLException { > super.init(); > > > [1] > https://github.com/wso2/product-apim/blob/master/modules/integration/tests-common/integration-test-utils/src/main/java/org/wso2/am/integration/test/utils/base/APIMIntegrationBaseTest.java > [2] > https://github.com/wso2/product-apim/blob/master/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/json/ESBJAVA3380TestCase.java > [3]. > https://github.com/wso2/product-apim/blob/master/modules/integration/tests-integration/tests-backend/src/test/java/org/wso2/am/integration/tests/api/lifecycle/APIAccessibilityOfPublishedOldAPIAndPublishedCopyAPITestCase.java > > Regards, > Malintha > > > On Wed, Feb 3, 2016 at 11:28 AM, Erandi Ganepola <[email protected]> wrote: > >> Hi All, >> >> I'm going to run Api manager integration test cases through Heartbeat >> system in cloud. >> >> So I need to clarify the tests which have been written in "tenant mood" >> because only those will be tested in Heartbeat (test cases written in >> "super tenant mood" won't be checked). >> >> Please mention the test cases which have been written in "tenant mood". >> >> Thanks and Regards, >> Erandi. >> >> Erandi Ganepola >> Software Engineering Intern >> +94710695692 >> +94754191524 >> >> >> _______________________________________________ >> Dev mailing list >> [email protected] >> http://wso2.org/cgi-bin/mailman/listinfo/dev >> >> > > > -- > *Malintha Adikari* > Software Engineer > WSO2 Inc.; http://wso2.com > lean.enterprise.middleware > > Mobile: +94 71 2312958 > Blog: http://malinthas.blogspot.com > Page: http://about.me/malintha >
_______________________________________________ Dev mailing list [email protected] http://wso2.org/cgi-bin/mailman/listinfo/dev
