Showing posts with label Automation Tests. Show all posts
Showing posts with label Automation Tests. Show all posts

Sunday, October 23, 2016

How To Add new Users, Roles and Tenants to WSO2 Automation Test Framework.

If we want to add a new user or new role or tenant we should update automation.xml accordingly.

a. How to add new Role
Add any role with a name and a key inside the <roles> tag of <userManagement>. You have to list the permissions of each role inside the <permissions> tag.
   
 <roles>  
   <role name = "AdminRole" key = "AdminRole">  
     <permissions>  
       <permission>/permission/admin</permission>  
     </permissions>  
   </role>  
   <role name = "SubscribeRole" key = "SubscribeRole">  
     <permissions>  
       <permission>/permission/admin/login</permission>  
       <permission>/permission/admin/manage/webapp/subscribe</permission>  
     </permissions>  
   </role>  
 </roles>  
   

b. How to add new users to super tenant
You can add any user with a key inside the <tenant> tag under the <superTenant> tag of
<userManagement> tag.
   
 <superTenant>  
   <tenant domain = "carbon.super" key = "superTenant">  
     <admin>  
       <user key = "superAdmin">  
         <userName>admin</userName>  
         <password>admin</password>  
       </user>  
     </admin>  
     <users>  
       <user key = "testuser1">  
         <userName>testuser1</userName>  
         <password>testuser1</password>  
       </user>  
     </users>  
   </tenant>  
 </superTenant>  
   

c. How to assign roles to users
If you want to assign  roles to the user, there are 2 ways.

1. Get Role from the automation.xml (Like we defined in step a) Then add the role key inside the user tag.
   
 <user key = "testuser1">  
   <userName>testuser1</userName>  
   <password>testuser1</password>  
   <roles>  
     <role>SubscribeRole</role>  
   </roles>  
 </user>  
   

2. You can see existing roles from management console as well. Then set role name under the <user> tag like this.
   
 <user key = "AppCreator">  
   <userName>appcreator</userName>  
   <password>appcreatorpass</password>  
   <roles>  
     <role>Internal/creator</role>  
   </roles>  
 </user>  
   

d. Add new tenants
You can add any tenant with a domain name and key inside the <tenants> tag of <userManagement> tag. Inside that tag, you can add admin user information, user information as below.
   
 <tenants>  
   <tenant domain = "wso2.com" key="wso2">  
     <admin>  
       <user key = "admin">  
         <username>admin</username>  
         <password>admin</password>  
       </user>  
     </admin>  
     <users>  
       <user key = "myuser">  
         <username>mytestuser</username>  
         <password>mytestuserpass</password>  
       </user>  
     </users>  
   </tenant>  
 </tenants>