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 excel sheet or a CSV test which is like other test sheet's but what's different about it is that you can add this component as a part of other test definitions. For example, if you have two different test sheet which have similar login step, you can add this common test steps into it's on excel or csv test file as a component without repeating the same test step to two different tests files. Component reduced test maintainability effort which means if you have 10 different test sheets with common test step and if those common test step is in a single component, you only have to change that one component then 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 test.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 test and there you have a test named sampletest. You can see excel_excel sheet under suites to see this in action. There is a support in codeless framework to refer an excel or csv sheet from excel or csv test files.