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

Implementing Excel Test Factory #189

Closed
BChitrakannan opened this issue May 29, 2018 · 9 comments
Closed

Implementing Excel Test Factory #189

BChitrakannan opened this issue May 29, 2018 · 9 comments

Comments

@BChitrakannan
Copy link

QAF Version

Note: only the latest version is supported

Steps To Reproduce

1. Create a xls file under scenario
2.In the config file use the ExcelTestFactory class
3.Execute

Expected behavior

It should be executed successfully

Actual behavior

jxl.read.biff.BiffException: Unable to recognize OLE stream
at jxl.read.biff.CompoundFile.(CompoundFile.java:116)
at jxl.read.biff.File.(File.java:127)
at jxl.Workbook.getWorkbook(Workbook.java:221)
at jxl.Workbook.getWorkbook(Workbook.java:198)
at com.qmetry.qaf.automation.step.client.excel.ExcelScenarioFileParser.parseFile(ExcelScenarioFileParser.java:46)
at com.qmetry.qaf.automation.step.client.excel.ExcelScenarioFileParser.parse(ExcelScenarioFileParser.java:60)
at com.qmetry.qaf.automation.step.client.ScenarioFactory.process(ScenarioFactory.java:110)
at com.qmetry.qaf.automation.step.client.ScenarioFactory.getTestsFromFile(ScenarioFactory.java:82)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.FactoryMethod.invoke(FactoryMethod.java:90)
at org.testng.internal.TestNGClassFinder.(TestNGClassFinder.java:150)
at org.testng.TestRunner.initMethods(TestRunner.java:451)
at org.testng.TestRunner.init(TestRunner.java:270)
at org.testng.TestRunner.init(TestRunner.java:240)
at org.testng.TestRunner.(TestRunner.java:192)
at org.testng.remote.support.RemoteTestNG6_9_10$1.newTestRunner(RemoteTestNG6_9_10.java:29)
at org.testng.remote.support.RemoteTestNG6_9_10$DelegatingTestRunnerFactory.newTestRunner(RemoteTestNG6_9_10.java:65)
at org.testng.SuiteRunner$ProxyTestRunnerFactory.newTestRunner(SuiteRunner.java:594)
at org.testng.SuiteRunner.init(SuiteRunner.java:168)
at org.testng.SuiteRunner.(SuiteRunner.java:117)
at org.testng.TestNG.createSuiteRunner(TestNG.java:1319)
at org.testng.TestNG.createSuiteRunners(TestNG.java:1306)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1160)
at org.testng.TestNG.run(TestNG.java:1064)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:114)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:251)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:77)

Is the issue reproducible on runner?

  • [x ] Eclipse

Test case sample

Config File:



</classes>
@amitbhoraniya
Copy link
Collaborator

Can you please update config file code and provide excel file which you are using?

@BChitrakannan
Copy link
Author

BChitrakannan commented May 29, 2018

Config file:

<test name="Test" enabled="true">
<parameter name="scenario.file.loc" value="./scenarios/Platform_Automation/test.xls"></parameter>
	<classes>
		<class name="com.qmetry.qaf.automation.step.client.excel.ExcelTestFactory" />
		
		
		
	</classes>
</test>

Excel Sheet:

I am not able to attach the excel sheet. But below is the content of the excel sheet and the sheet name is test.xls.

SCENARIO: batchprocessor            
META-DATA: {"description":"Verify ","groups":[SMOKE","Regression"], "author":"Arun"}
             
  Given run '${unix.command.ondot-status}' on 'virtual.machine'    
  Then ondot-status for Active Validation          
END            

@amitbhoraniya
Copy link
Collaborator

amitbhoraniya commented May 29, 2018

The format you have defined for excel is a wrong format.
Below is working test and excel file.

<test name="Test" enabled="true">
	<parameter name="scenario.file.loc" value="./scenarios/test.xls"></parameter>
	<classes>
		<class name="com.qmetry.qaf.automation.step.client.excel.ExcelTestFactory" />
	</classes>
</test>
SCENARIO SearchProduct {"description":"verify user is able to search product using search textbox","groups":["SMOKE"]}
launchApp    
searchForProduct ["Shirt"]  
END  

Here 1st column should be stepname(not description), and 2nd column is list of arguments.
And step implementation is

@QAFTestStep(description = "I search for product {0}")
public void searchForProduct(String product) {
	//to-do
}

@BChitrakannan
Copy link
Author

I changed the excel format but still I am getting the same error. Do we have a sample project for this?

Scenario Test {"description":"verify user is able to search product using search textbox","groups":["SMOKE"]}
run ["Hello"]  
END    

Also, What should I do if I want to pass multiple inputs :)

Thanks in advance :)

@amitbhoraniya
Copy link
Collaborator

Looks like your excel is not in proper xls format.

@BChitrakannan
Copy link
Author

BChitrakannan commented May 29, 2018

Thanks Amit :) That was correct. I was using corrupted file :) Thanks much.

Also, I use one input in the excel file and my method takes one parameter. But the input which I am giving in the sheet is not getting passed.

Could you please share the step definition for the above excel sheet you shared ? :)

@amitbhoraniya
Copy link
Collaborator

I have updated step implementation in above comment. You can refer that.

@BChitrakannan
Copy link
Author

Thank you :) It worked :) I actually copy pasted the bdd scenario into the excel sheet :) and it read the data from xml and property file:)

Happy :) Thanks for the help Amit :)

@cjayswal cjayswal closed this as completed Jun 1, 2018
@BChitrakannan
Copy link
Author

BChitrakannan commented Jul 6, 2018

Hi Amit,

I have this scenario. I need to pass JSONArray or JsonObject as an input. I am using ExcelTestFactory.

Below is my sample input:

["nodename",["a","b","c"]]

I want the whole world to be read. QAF is not able to read everything as a whole as I have comma in it.

Can you please tell me how I can address this :)

Thanks much in advance for the help.

Also, I cannot store these values in an external file as the input is coming from external team.

Kindest Regards,
CK

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

No branches or pull requests

3 participants