Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Locator description display in report #197

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/com/qmetry/qaf/automation/step/TestStepListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,11 @@ private String processArgs(String description, Object... actualArgs) {

private String getParam(String text) {
String result = getBundle().getSubstitutor().replace(text);
ParamType ptype = ParamType.getType(result);
String value = String.valueOf(getBundle().getObject(result));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@NightFox7, Thanks for the pull request
This possibly cause issues if

  • value may be null if property not exist! use default value to overcome that situation of possible NullPointerException
    • String value = getBundle().getString(result, result);
  • value with key exist but argument referenced is not a locator or not parameter
    • need to keep in mind that not all steps are element step, listener will be called by all steps. So possibly case where it points to string and not locator.

ParamType ptype = ParamType.getType(value);
if (ptype.equals(ParamType.MAP)) {
@SuppressWarnings("unchecked")
Map<String, Object> kv = new Gson().fromJson(result, Map.class);
Map<String, Object> kv = new Gson().fromJson(value, Map.class);
if (kv.containsKey("desc")) {
result = String.valueOf(kv.get("desc"));
} else if (kv.containsKey("description")) {
Expand Down