mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-18 12:06:08 +00:00
templates: Add parameter example to UiAutomator template.
Add additional information to the UiAutomator template for retrieving parameters.
This commit is contained in:
parent
d3cb350461
commit
df076c68da
@ -288,13 +288,16 @@ the actual code of the automation and will look something like:
|
||||
public class UiAutomation extends BaseUiAutomation {
|
||||
|
||||
protected Bundle parameters;
|
||||
protected int example_parameter;
|
||||
|
||||
public static String TAG = "google_docs";
|
||||
|
||||
@Before
|
||||
public void initilize() throws Exception {
|
||||
parameters = getParams();
|
||||
// Perform any parameter initialization here
|
||||
parameters = getParams(); // Required to decode passed parameters.
|
||||
packageID = getPackageID(parameters);
|
||||
example_parameter = parameters.getInt("example_parameter");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -319,6 +322,20 @@ the actual code of the automation and will look something like:
|
||||
}
|
||||
}
|
||||
|
||||
A few items to note from the template:
|
||||
- Each of the stages of execution for example ``setup``, ``runWorkload`` etc
|
||||
are decorated with the ``@Test`` decorator, this is important to allow
|
||||
these methods to be called at the appropriate time however any additional
|
||||
methods you may add do not require this decorator.
|
||||
- The ``initialize`` method has the ``@Before`` decorator, this is there to
|
||||
ensure that this method is called before executing any of the workload
|
||||
stages and therefore is used to decode and initialize any parameters that
|
||||
are passed in.
|
||||
- The code currently retrieves the ``example_parameter`` that was
|
||||
provided to the python workload as an Integer, there are similar calls to
|
||||
retrieve parameters of different types e.g. ``getString``, ``getBoolean``,
|
||||
``getDouble`` etc.
|
||||
|
||||
Once you have implemented your java workload you can use the file
|
||||
``uiauto/build.sh`` to compile your automation into an apk file to perform the
|
||||
automation. The generated apk will be generated with the package name
|
||||
|
@ -25,13 +25,17 @@ import com.arm.wa.uiauto.BaseUiAutomation;
|
||||
public class UiAutomation extends BaseUiAutomation {
|
||||
|
||||
protected Bundle parameters;
|
||||
protected String packageID;
|
||||
protected int example_parameter;
|
||||
|
||||
public static String TAG = "${name}";
|
||||
|
||||
@Before
|
||||
public void initialize() throws Exception {
|
||||
parameters = getParams();
|
||||
// Perform any parameter initialization here
|
||||
parameters = getParams();
|
||||
packageID = getPackageID(parameters);
|
||||
example_parameter = parameters.getInt("example_parameter");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
x
Reference in New Issue
Block a user