org.easetech.easytest.annotation
Annotation Type Param
@Retention(value=RUNTIME)
@Target(value=PARAMETER)
public @interface Param
A parameter level optional annotation that converts the data for EasyTest based test methods to consume. This
Annotation gives the ability to pass input parameters to the test method. EasyTest will automatically call the test
method as many times as there are number of data sets to be run against that particular method. For example, if the
user has specified 5 data set for a single test method, EasyTest will call the method five times, each time providing
the test data that was provided by the user.
The annotation is used in conjunction with DataLoader annotation. DataLoader annotation is used to
provide test data to the test cases.
The annotation is optional. In case the name of the input parameter provided in the data file(XML, Excel, CSV or
custom) is same as the name of the input parameter type then this annotation can be omitted. For eg:
public void testWithStrongParameters(LibraryId id ,
(@)Param(name="itemid") ItemId
itemId) { .... }
In the above example we have not provided @Param annotation to the input parameter LibraryId. In this case the test
parameter name in the test file should be LibraryId. You have to take care that in scenario where the input
parameters are of the same type, the names should be different. Thus if you have two input parameters of type
LibraryId then you should provide atleast @Param annotation on one of the input parameters.
The annotation contains a single mandatory field :
name : the name of the parameter(Mandatory) as is present in the input test data file. In case the
param annotation is not specified and the Parameter type is Map, Param.DataSupplier simply provides the HashMap
instance that was created while loading the data. This HashMap represents a single set of test data for the
test method. In case the param name is specified along with the {link @Param} annotation, the framework will
look for the parameter with the specified name in the loaded test data.
Moreover, the framework supports PropertyEditors support for strongly typed objects. If you have a custom object and
its property editor in the same package, the EasyTest framework will convert the String value to your specified
custom object by calling the right property editor and pass an instance of custom object to your test case. This
provides the users facility to write test cases such as this :
- Author:
- Anuj Kumar
|
Required Element Summary |
String |
name
The name of the parameter for which value needs to be fetched from the data set |
name
public abstract String name
- The name of the parameter for which value needs to be fetched from the data set
Copyright © 2013. All Rights Reserved.