Parameterizing Test cases

Get help with testing, discuss unit testing strategies etc.
Post Reply
User avatar
chembali
Posts: 16
Joined: Thu Feb 22, 2018 1:51 pm

Parameterizing Test cases

Post by chembali » Thu May 10, 2018 9:01 am

I am looking for some help in making my test suite more modular/reusable along with the ability to execute in parallel.

For e.g. In the following test case, there are a few texts that are hard coded. Can I parameterize those? The below test would be run as it is for testing the Data Store creation feature. It could be included in other test cases that depend on the existence of Data sources for the success of the tests. I want all these testes ( Data source creation and other tests that include Data source creation ) to be run in parallel without failure. I hope I have communicated my challenge clearly.

Code: Select all

describe('Setting up for the Data store creation', function(t) {
 
 
    t.it('Creating Datastore - Details tab',function(t){

    t.chain(
	   { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=generalFieldSet] [itemId=detailDisplayName] => .x-form-text", offset : [191, 11] },
       { action : "type", text : "[BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE][BACKSPACE]salesorderdetail" },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=generalFieldSet] [itemId=storeRepositoryType] => .x-form-text", offset : [288, 11] },
       { click : "[itemId=storeRepositoryType].getPicker() => .x-boundlist-item:contains(S3)", offset : [136, 24] },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=channelConfigPanel] igx-s3channel [itemId=s3ChannelConfig] [itemId=bucketName] => .x-form-text", offset : [110, 10] },
       { action : "type", text : "cafecustomerdata.cafe.infogix.com" },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=channelConfigPanel] igx-s3channel [itemId=s3ChannelConfig] [itemId=folder] => .x-form-text", offset : [151, 12] },
       { action : "type", text : "AdventureGroup/salesorderdetail" },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] => .x-form-layout-wrap", offset : [802, 462] },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=channelConfigPanel] igx-s3channel igx-delimitedlayoutpanel fieldset[title=Delimited Layout] [itemId=hasHeaderRowDelimited] => .x-form-checkbox", offset : [9, 10] },
       { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=editDetailForm] [itemId=channelConfigPanel] igx-s3channel igx-delimitedlayoutpanel fieldset[title=Delimited Layout] panel [itemId=determineDelimitersBtn] => .x-btn-button", offset : [80, 10] },
       { waitFor: 5000}
	      )
     }
    )

    t.it('Creating Datastore - Fields tab',function(t){

       t.chain(
	
		{ click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] tabbar tab[text=Fields] => .x-tab-inner", offset : [20, 6] },
        { click : "#contentRegion igx-editdatastoreview panel igx-editdatastore [itemId=dataStoreTabPanel] [itemId=fieldsPanel] [itemId=fieldsToolbar] [itemId=generateBtn] => .x-btn-button", offset : [37, 13] },
		{ waitFor: 3000}, 
        { click : "#contentRegion igx-editdatastoreview panel igx-savebutton[text=Save] => .x-btn-button", offset : [26, 9] },
    	{ waitFor: 5000}
      )
     }
    )
  }
)
Please share your ideas. We have a huge number of tests and creating Test classes/utility methods for every reusable test may not scale up. Currently we have a huge automation script that runs the feature tests in a sequential manner and it is taking a long time to complete the tests. We are going to have to restart the script when one of them fails which is not ideal. I am trying to revamp the whole automation test process.

User avatar
nickolay
Core Developer
Core Developer
Posts: 3405
Joined: Mon May 16, 2011 10:48 am

Re: Parameterizing Test cases

Post by nickolay » Thu May 10, 2018 10:05 am

Please check this guide: https://www.bryntum.com/docs/siesta/#!/ ... test_class

You can move repeating code to the methods of the test class. One need however carefully track the asynchronous behavior (those methods should accept callbacks).
We offer training in both Ext JS and our products, read more here.
Read the API documentation

Post Reply