Hi All,

I could create the four artifacts when building the integration module
using maven-antrun-plugin and maven-dependency-plugin at
the process-test-resources phase as below.

   1. Used the travelocity sample war as a dependency and unpack the war
   using maven-dependency-plugin.
   2. Introduced an ant script with four targets, where each will replace
   the property file for that combination and execute ant war task to package
   a new war.
   3. Each target in the script is invoked using maven-antrun-plugin to
   build the war artifact at process-test-resources phase

I hope this solution is acceptable. Would like to know your thoughts on
this.

Thanks,
Malithi.


On Mon, Oct 27, 2014 at 7:08 AM, Krishantha Samaraweera <krishan...@wso2.com
> wrote:

> Hi Malithi,
>
> We normally recommend to keep all test artefacts under integration module
> and build them before all test modules. In this case, if you
> copy travelocity sample code to integration module then it will introduce
> code duplication. So the best approach would be to modify the war file at
> test run time and create four war files with different names. You might be
> able to use war as a dependency and use unpack and find-and-replace plugins
> to create create combination of test artefacts. Then you can host those war
> files on tomcat server before executing any tests.
>
> You can use TestNG @BeforeTest annotation to start tomcat server before
> any tests in your test package. We have followed the same approach in ESB
> JMS tests where ActiveMQ serve is started before running any tests in the
> package [1] (you need to introduce new test block in testng.xml)
>
> Thanks,
>
> Krishantha.
>
> [1]
> https://github.com/wso2-dev/product-esb/blob/master/modules/integration/tests-integration/tests-transport/src/test/java/org/wso2/carbon/esb/jms/transport/test/JMSBrokerStartupTestCase.java
>
> On Sun, Oct 26, 2014 at 10:03 PM, Malithi Edirisinghe <malit...@wso2.com>
> wrote:
>
>> Hi All,
>>
>> I have used travelocity sample application to automate tests for the Open
>> Id, for following parameter combinations.
>>
>> User - (Admin/Login User/Tenant User)
>> User Consent - (Approve/Approve Always/Skip)
>> Association Type - (DB Store/Replication Store/Crypto Store)
>> OpenId Attribute Exchange - (With/Without)
>> Consumer Type - (Smart Mode/Dumb Mode)
>>
>> Test is being written using @factory annotation along with a TestNG data
>> provider to initiate tests for each parameter combination.
>>
>> In order to specify the consumer type and to specify whether attribute
>> exchange is requested or not I introduced two new properties to the sample
>> app as below.
>>
>> #Specify whether the consumer requests user attributes from the provider
>> OpenId.EnableAttributeExchange=true
>>
>> #Specify whether the consumer runs in dumb mode
>> OpenId.EnableDumbMode=false
>>
>> So for these two properties there are four combinations that I have to
>> test, and I see below two approaches to get this done.
>>
>>    1. Build four artifacts of the sample app for each combination of the
>>    two properties.
>>    2. Use the same artifact for testing changing the property file for
>>    each combination.
>>
>> I have tried on (1) using maven-war-plugin by adding four executions and
>> labelling each artifact with a classifer. But this approach packages four
>> additional artifacts though we need them only for testing. I'm not sure how
>> can we have those artifacts be packaged only at the test phase.
>> Further there are several ways of using the tomcat instance with the
>> deployed app.
>>
>>    1. Start tomcat before each test and deploy the relevant artifact.
>>    Then stop the instance after the test.
>>    2. Start the tomcat instance before executing a test group and deploy
>>    all artifacts needed before running tests. Then stop the instance after
>>    running all tests in that group.
>>
>> I found that existing IS tests were written using the first approach. But
>> when considering this case considerable amount of tests would be initiated
>> for combinations of above parameters. So seems 2nd approach would be better.
>>
>> I would like to know the best approach to be followed here.
>> Kindly expect your thoughts on this.
>>
>> Thanks,
>> Malithi.
>>
>> --
>>
>> *Malithi Edirisinghe*
>> Senior Software Engineer
>> WSO2 Inc.
>>
>> Mobile : +94 (0) 718176807
>> malit...@wso2.com
>>
>
>
>
> --
> Krishantha Samaraweera
> Senior Technical Lead - Test Automation
> Mobile: +94 77 7759918
> WSO2, Inc.; http://wso2.com/
> lean . enterprise . middlewear.
>



-- 

*Malithi Edirisinghe*
Senior Software Engineer
WSO2 Inc.

Mobile : +94 (0) 718176807
malit...@wso2.com
_______________________________________________
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to