RedHatQE / polarize

GNU General Public License v3.0
2 stars 2 forks source link

REQ: If a method's number of args changes, make sure that mapping.json is updated, and a new TestCase import is made #57

Closed rarebreed closed 7 years ago

rarebreed commented 7 years ago

I believe this is already handled if the annotation for the method has update=true, but I need to check. This requirement came to light when a test was run, and the xunit report failed to get generated. This is because the XUnitReporter.getPropertiesFromMethod() compares the number of arguments from the mapping.json file for a particular method, and the number of arguments from the IResult.getParameters() method call. If the size is different, it throws an error. This can be caused when a method is refactored and the number of parameters that the method takes changes.

For one, this kind of error could be detected at compile time, rather than fail at runtime. When the annotation processor is running, have it look at the number of arguments via reflection for that method, and compare to how many are in the mapping.json file.

Secondly, the current code doesn't tell you what method had an incorrect number of arguments. So change the debugging log info to get the name of the method that is failing.

Third, test the scenario where a method's number of arguments changes. Make sure during compilation that the mapping.json gets the updated parameters, and also that an Import Request should be made. The Import Request is required, because the way that iterations in Polarion works is that the number of elements of:

<property name="polarion-parameter-arg0" value="   stage_auto_testuser1"/>

Under at must match how many are in the TestStep of the TestCase (which in the XML file is the number of elements) eg:

<test-step-column id="step">
    <parameter name="bugzilla" scope="local"/>
    <parameter name="bashCommand" scope="local"/>
    <parameter name="expectedCompletions" scope="local"/>
</test-step-column>

In this case, the XML has 3 parameter elements, so in Polarion, the TestSteps will have 3 args. When the xunit is generated, the mapping.json file must also contain 3 elements:

"RedHatEnterpriseLinux7" : {
      "id" : "RHEL7-68140",
      "parameters" : [ "bugzilla", "bashCommand", "expectedCompletions" ]
    }
rarebreed commented 7 years ago

So, it looks like if the update field is set to true, it will regenerate the XML, but not the mapping file. So I need to correct this

rarebreed commented 7 years ago

Polarize will now do a couple of things:

rarebreed commented 7 years ago

Implemented in e733c07