qaf icon indicating copy to clipboard operation
qaf copied to clipboard

After upgrading from QAF 2.1.14-RC1 to 2.1.15, BDD steps passes null values to method params

Open raviguptasmarsh opened this issue 5 years ago • 4 comments

Multiple variables if used in the value of a single key in a property cannot be used in the BDD file. e.g: in the property file, cannot use: active.client.name = ${prefix}active_client${suffix}

But below 3 works fine: active.client.name = active_client${suffix} active.client.name = ${prefix}active_client active.client.name = ${prefix}${suffix}active_client

QAF Version

Upgraded from QAF 2.1.14-RC1 to 2.1.15

Steps To Reproduce

1.Create a bdd file with this step:
   Given '${client.status.active.new}' client id available as 'clientId'

   In the property file add the property:

  Case 1: 
  client.status.active.new = ${target.env1}active => This passes the value fine from bdd step to method.

 Case 2:
 client.status.active.new = active${target.env2} => This passes the value fine from bdd step to method.

 Case 3:(Failing)
 client.status.active.new = ${target.env1}active${target.env2} => This passes null to the java method and is breaking most of our test cases as we had been using more than one ${variable} for a single property in our propertis files

This was working fine in QAF 2.1.14-RC1

Is the issue reproducible on runner?

  • [x] Maven
  • [x] Eclipse

raviguptasmarsh avatar Feb 20 '20 10:02 raviguptasmarsh

It looks something wrong with your configuration. If not, will you please provide testcase/code to reproduce the behavior. I tired below and found working fine with latest qaf:

public static void main(String[] args) {
	ConfigurationManager.getBundle().setProperty("step.provider.pkg", "com.qmetry.qaf.example");

	ConfigurationManager.getBundle().setProperty("target.env1", "env1");
	ConfigurationManager.getBundle().setProperty("target.env2", "env2");
	ConfigurationManager.getBundle().setProperty("client.status.active.new", "${target.env1}active${target.env2}");
	System.out.println(ConfigurationManager.getBundle().getString("client.status.active.new"));
	StringTestStep.execute("'${client.status.active.new}' client id available as 'clientId'");
}
	
@QAFTestStep(description="{s} client id available as {s1}")
public static void step1(String s, String s1){
	System.out.printf("\ns: %s s1:%s\n", s, s1);
}

Output:

env1activeenv2 s: env1activeenv2 s1:clientId

cjayswal avatar Feb 23 '20 18:02 cjayswal

@cjayswal This does not work for 2.1.15 but works fine for 3.0.0-RC-3: s: null s1:clientId

This is the QAF dependency we are using in our project.

		<groupId>com.qmetry</groupId>
		<artifactId>qaf</artifactId>
		<version>2.1.15</version>
	</dependency>
	<dependency>
		<groupId>com.qmetry</groupId>
		<artifactId>qaf-support-ws</artifactId>
		<version>2.1.15</version>
		<exclusions>
			<exclusion>
				<groupId>ch.qos.logback</groupId>
				<artifactId>logback-classic</artifactId>
			</exclusion>
		</exclusions>
	</dependency>
	<dependency>
		<groupId>com.qmetry</groupId>
		<artifactId>qaf-support</artifactId>
		<version>2.1.15</version>
	</dependency>
	<dependency>
		<groupId>org.jdom</groupId>
		<artifactId>jdom</artifactId>
		<version>2.0.0</version>
	</dependency>

raviguptasmarsh avatar May 13 '20 08:05 raviguptasmarsh

But same thing works with 3.0.0-RC3 version.

raviguptasmarsh avatar May 13 '20 10:05 raviguptasmarsh

is this duplicate of #315?

cjayswal avatar May 25 '20 01:05 cjayswal