qaf icon indicating copy to clipboard operation
qaf copied to clipboard

Data Trasnsform class not working in QAF\Quantum

Open Guruswamy opened this issue 4 years ago • 2 comments

QAF Version

Note: only the latest version is supported

Steps To Reproduce

1.  Using [Quantum](https://github.com/Perfecto-Quantum/Quantum-Starter-Kit) 
2.  Create Transform Class lik below:
          public class DataTransform  extends Transformer<String>{

                   //@Override
                  public String transform(String arg0) {
                
                  return arg0+"prefix";
            }

        }
3. Add StepDefinition like below:
                  @Given("^I want to write a step with name \"([^\"]*)\" and \"([^\"]*)\"$")
                  public void testMethod(@Transform(DataTransform.class)String name, String lName){
                          System.out.println("Name: "+name);
                          System.out.println("Name: "+lName);
                   }     
  1. Create Feature file like below: @testfeature Feature: Title of your feature I want to use this template for my feature file @tag1 Scenario: Title of your scenario Given I want to write a step with name "manoj" and "sahu"

Expected behavior

Wherever Data Transform class is used it should add the given prefix:

Example output : manojPrefix

Actual behavior

QAF not hitting the transform class at all. No Errors.

Example Output: manoj

Please same steps work fine with normal non-quantum\QAF project attached.

Is the issue reproducible on runner?

Test case sample

Please, share the test case (as small as possible) which shows the issue

Guruswamy avatar Jul 22 '20 08:07 Guruswamy

Use @Formatter with QAFTestStepArgumentFormatter instead of @Transform with Transformer.

Refer sample implementation and usage of @Formatter.

cjayswal avatar Aug 04 '20 20:08 cjayswal

i am unable to import QAFTestStepArgumentFormatter class. i tried to copy paste the import directly from the above given implementation. i am currently using qaf version 2.1.13. Could you let me know what causing this issue. Thanks.

manojkumarsahu21 avatar Aug 06 '20 11:08 manojkumarsahu21