Skip to content

WAR-1348 : Modularise runmode across Warrior. As a user, I want same tags for runmode wherever I use runmode functions such as RMT, RUP & RUF#98

Closed
brettleehari wants to merge 21 commits into
developfrom
bugfix/WAR-1348
Closed

WAR-1348 : Modularise runmode across Warrior. As a user, I want same tags for runmode wherever I use runmode functions such as RMT, RUP & RUF#98
brettleehari wants to merge 21 commits into
developfrom
bugfix/WAR-1348

Conversation

@brettleehari

Copy link
Copy Markdown
Contributor

When user uses RMT in suite level, the option is ATTEMPTS.
But when users do not use the tag MAX_ATTEMPTS which is used for RUP&RUF SUITES fail to run.
REmoved the logic based on MAX_ATTEMPTS and simplified the code.

Added a test with SUITE level RMT.

Comment thread warrior/WarriorCore/testsuite_driver.py Outdated
else:
execution_value = Max_Attempts

execution_value = Utils.xml_Utils.getChildAttributebyParentTag(testsuite_filepath, 'Details', 'type', 'Number_Attempts')

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

please add a check here to see if execution value is a valid integer otherwise throw a warning and default it to 1 so that the test runs only once

@brettleehari brettleehari Jul 30, 2017

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @satyakrish,
I agree to the above improvement comment that we have to evaluate whether user has provided numeric value to handle user error. It is an improvement from our current behavior where we trust that user provide whole numbers.
I feel above suggestion is not a clean solution, currently there is bug and this ticket just fixes that bug to unblock the user.
While working on the issue found few anomalies Kindly consider below points and if you still feel you want me to check value for RMT is integer i shall do it:

  1. Just as you suggested change for RMT in SUITE global level, RUP & RUF requires changes too.
  2. We support Runmode in SUITE step level and we would require similar changes here too.
  3. We support Runmode in TESTCASE GLOBAL and STEP level and requires same changes.
  4. Although we support RMT, RUP, RUF at 4 different levels(as mentioned above) their functionalities are the same but we use maxattempts, Number_attempts xml tags in SUITE, value tag in Testcases.

Given the above 4 points, I propose two changes and be handled as an improvement item:

  1. RUNMODE functionalities shall carry the same tag across Warrior since the functionalities are exactly same. Slowly we can deprecate older tags or have both.
  2. Instead of handling user error such as validating whether a value is a whole number. How about using Django form fields to restrict users to only fill numeric else throw error. Because as a user I do not want to find out my user errors while executing but while developing.

@satyakrish satyakrish Jul 31, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@brettleehari

  • initial commit #1: we should go with both for backward comatibility, i dont think we can get rid of one at this moment.

  • Add documentations for Actions and Framework Utils #2: Agree that the error handling should be applied for all the cases like rup, ruf, rmt.
    Where should we do it? data validation should be done at the front end for sure.. but we should not totally ignore error handling at warrior level. Because even today there are lot of users who use warrior directly without using the UI.
    I would suggest to raise a ticket for error handling at UI, and handle errors in warrior using this ticket.
    If we encounter an un supported value then we should raise a warning that prints out what was expected and what was received and that default value will be used instead with the default value printed.

@satyakrish satyakrish left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

refer to comments

@brettleehari

brettleehari commented Aug 10, 2017

Copy link
Copy Markdown
Contributor Author

Hello reviewers,
Work in progress, Please do not review for now. I shall let you know.

8/30 Ka
@brettleehari Looks like there are new commits pushed, is this ready to review now?

venkat1077
venkat1077 previously approved these changes Aug 23, 2017
root = Utils.xml_Utils.getRoot(filepath)
steps = root.find(step_tag)
if steps is None:
print_warning("The file: '{}' has no steps "

@kaheichan kaheichan Aug 31, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

can replace the word steps with value of step_tag

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

@kaheichan kaheichan Sep 22, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops...What I mean is...step_tag is an xml element
and in the element there is a value specifying whether it is a step/testcase/testsuite
so the warning message can correctly say
The file X has no step/testcase/testsuite to be executed

@kaheichan Done!

else:
for i in range(0, value):
copy_step = copy.deepcopy(step)
copy_step.find("runmode").set("attempt", i + 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think I wrote this more than 1 year ago...but even if this is the 1st step, it will need to set the value to next also

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didnt get your point.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For step_list length > 1
there is a line
copy_step.find("runmode").set("value", go_next)
but it doesn't exist when step_list is empty

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

for i in range(0, retry_value):
copy_step = copy.deepcopy(step)
copy_step.find("retry").set("attempt", i + 1)
step_list_with_rmt_retry.append(copy_step)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

line 48-81 contain 4 blocks of similar code
Since we are reworking the functionality
we should also wrap them in a common function/code block and reuse

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done

str(test_suite_status).upper() == "ERROR":
break

#The below ELIF is to preserve backward compatibility. The new logic is available/

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If the value of execution_type hasn't changed, why would the runmode logic not handled by the original code?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Runmode is under execution type in the current design. So, I am not changing anything to the current logic to preserve backward compatibility. To bring uniformity across runmodes, I have introduced a tag similar to the tags available for runmode in suite_step, Project_step & Testcase_step in the Suite Global tags. Going forward users would see the new tags through Katana (This would be similar to all runmode options across Warrior).
If this explanation doesn't help, I shall call you tomorrow to discuss.

@kaheichan kaheichan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The code looks good
Just need to address several format/logical comment

9/16-Hari
@kaheichan Done with all your recommendation.

root = Utils.xml_Utils.getRoot(filepath)
steps = root.find(step_tag)
if steps is None:
print_warning("The file: '{}' has no steps "

@kaheichan kaheichan Sep 22, 2017

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Oops...What I mean is...step_tag is an xml element
and in the element there is a value specifying whether it is a step/testcase/testsuite
so the warning message can correctly say
The file X has no step/testcase/testsuite to be executed

@kaheichan Done!

runmode, value = get_runmode_from_xmlfile(step)
retry_type, _, _, retry_value, _ = get_retry_from_xmlfile(step)
if runmode is not None and value > 0:
if len(step_list) > 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like L70-79 are duplicated, any reason to keep both?

value, go_next, mode="runmode",
tag="value")
if retry_type is not None and value > 0:
if len(step_list) > 1:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same here

@kaheichan

kaheichan commented Oct 4, 2017

Copy link
Copy Markdown
Contributor

@brettleehari Looks like there is a merge conflict

@kaheichan Resolved the Merge conflicts, think it will be more prevalent as we are merging many tickets. Kindly review.

@satyakrish
satyakrish dismissed their stale review October 6, 2017 15:08

transferred review to ka

@kaheichan

Copy link
Copy Markdown
Contributor

Ran the test and verified it work

@bjrr

bjrr commented Oct 13, 2017

Copy link
Copy Markdown
Member

@kaheichan Is there a Katana change needed for this ticket?

@kaheichan kaheichan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Upon going through the design again, has some questions come up, need sometimes to formalize the questions, please don't merge this now

@bjrr bjrr changed the title Bugfix/war 1348: RMT expects the tag MAX_ATTEMPTS and fails. WAR-1348: RMT expects the tag MAX_ATTEMPTS and fails. Oct 24, 2017
@brettleehari

Copy link
Copy Markdown
Contributor Author

@kaheichan Can you please share your reasons for rejecting the PR you approved. It would help me to resolve it at the earliest.

@brettleehari

Copy link
Copy Markdown
Contributor Author

Dear @kaheichan,
Gentle reminder-2. This ticket is part of 3.5.0. Humbly Request to share comments so that I can work on this and deliver this item for the team.

@kaheichan

Copy link
Copy Markdown
Contributor

Hi @brettleehari
A detailed comment has been made in the Jira ticket, please go ahead and check it out there

To summarize, please deliver bug fix and code improvements in 2 separate PR
Also if you decide to use this PR as the bugfix PR, please update the description of this PR as it is outdated

@sanikakulkarni
sanikakulkarni removed the request for review from Annam16 November 30, 2017 00:36
@satyakrish
satyakrish requested review from satyakrish and removed request for satyakrish November 30, 2017 15:55
@satyakrish

Copy link
Copy Markdown
Contributor

transferred review to Ka on oct-6 hence removing myself.

@sanikakulkarni

Copy link
Copy Markdown
Contributor

Pull Request has been approved by @venkat1077 which was later dismissed on account of new commits.

@kaheichan
kaheichan requested review from kaheichan and removed request for kaheichan April 13, 2018 12:22
@kaheichan

Copy link
Copy Markdown
Contributor

Github is preventing me from clearing the requested change...

@ReshmaManohar ReshmaManohar changed the title WAR-1348: RMT expects the tag MAX_ATTEMPTS and fails. WAR-1348 : Modularise runmode across Warrior. As a user, I want same tags for runmode wherever I use runmode functions such as RMT, RUP & RUF May 3, 2018
@ReshmaManohar

Copy link
Copy Markdown
Contributor

Closing this PR. Will open a new PR for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants