Skip to content

How to create and use shared component for a test

fikreselam edited this page May 8, 2019 · 4 revisions

What is Component?

Component can be a test written in excel sheet or a CSV just like other test sheet's. But what's different about it is that you can add a component as a part of other test definitions. For example, if you have two different test sheet which have similar login test steps, you can have this common test steps moved to it's own excel or csv test file as a component for the two different tests files to reference it. Component reduce test maintainability effort which means if you have 10 different test sheets with common test steps and if those common test steps has been moved to a single component, you only have to change that one component then the change can be reflects for every tests that depend on it.

How to use a component

First, create an excel or csv test file and put that file under example_usage/components folder by creating a new folder for it. eg, example_usage/components/myComponent/component.xlsx

Second, go to your main test sheet that needs to refer above component you created under myComponent of components folder. Add a step that refers to your component as shown below:

Step Action Target Input Overrides
config setup config
execute component component myComponent.sampletest

On above example, execute component step has an Action value of component which tells the framework that it needs to load a test step or a component located under Target column. The Target column tells where to find this component, which is under the components folder of /example_usage and under it there is a folder named /myComponent and there you have a test named sampletest. You can see excel_excel sheet under suites to see this in action. FYI, Codeless framework supports excel/csv component to referenced from an excel or csv test sheet files. You can also reference a component inside a component (2 level component).