01: package com.canoo.webtest.steps;
02:
03: import org.apache.commons.lang.StringUtils;
04:
05: /**
06: * Placeholder for information. This Step does nothing but as it is "executed" its parameter
07: * are written in the results and can be formatted as needed for display.
08: *
09: * @author Marc Guillemot
10: * @webtest.step category="Core"
11: * name="testInfo"
12: * description="Provides the ability to display 'static' information in report.
13: * This step does nothing. It just gets reported as it (with its attributes) in the report."
14: */
15: public class TestInfoStep extends Step {
16: private String fType;
17: private String fInfo;
18:
19: /**
20: * Sets the information.
21: *
22: * @param info the information. May be any value as it has only to make sense for user
23: * @webtest.parameter required="no"
24: * description="The information that has to be displayed in the report (ex: related bug number, ...)"
25: */
26: public void setInfo(final String info) {
27: fInfo = info;
28: }
29:
30: public String getInfo() {
31: return fInfo;
32: }
33:
34: /**
35: * Sets the type of the information. The type can be any string and has only a signification for the user.
36: * @param type the information type
37: * @webtest.parameter required="yes"
38: * description="The information type.
39: * Helps to classify info. Many information of the same type within a single WebTest are allowed."
40: */
41: public void setType(final String type) {
42: fType = type;
43: }
44:
45: public String getType() {
46: return fType;
47: }
48:
49: public void doExecute() {
50: // absolutely nothing, the single purpose of the step is to transfer typed information to the report
51: }
52:
53: /**
54: * Verifies the parameters
55: */
56: protected void verifyParameters() {
57: super .verifyParameters();
58: emptyParamCheck(getType(), "type");
59: }
60:
61: /**
62: * Called by ant to set the text contained in the tag.
63: * An alternative to value="blabla" for e.g. Large TextAreas. Usage:<br/>
64: * <setInputField>blabla<br/>
65: * blibli<br/>
66: * </setInputField>
67: *
68: * @param str the text value to add
69: * @webtest.nested.parameter
70: * required="no"
71: * description="An alternative to the attribute info for e.g. large texts."
72: */
73: public void addText(final String str) {
74: final String expanded = StringUtils.defaultString(getInfo())
75: + getProject().replaceProperties(str);
76: setInfo(expanded);
77: }
78: }
|