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

Scenario Outline shows Incorrect / Doubles Count in Dashboard View - extentreports-cucumber6-adapter #263

Closed
bughunter7 opened this issue Oct 16, 2020 · 5 comments

Comments

@bughunter7
Copy link

bughunter7 commented Oct 16, 2020

When Running a Scenario Outline the count in the dashboard is incorrect . it displays double count to what scenario is executed also tags section shows same scenario title twice.

Please find Below link for report screenshots –
https://github.com/bughunter7/ExtentReportIssue

Dependency used –

tech.grasshopper
extentreports-cucumber6-adapter
1.2.0
test

96265766-7fbcbb00-0fe3-11eb-8446-b5d85f4d7924

Feature: user clicks on salesorder

@SalesOrder @reg
Scenario Outline: user clicks on orders
Given user is on landing page
And he enters his userid and password
Then he is redirected to dashboard adminpage
And he clicks on sales
And he clicks on orders
And clicks on create new order
Then he enters the and
And clicks on search button
And clicks on search results
Then selects Godirecttrade as a store
And clicks on add products
Then searches for
And selects the product from checkbox
And clicks on add selected products to order
And enters the purchase order no
And clicks on link get shipping methods and rates
And selects the radio button
And clicks on submit order
Then message visible is you created the order
And order no is displayed

Examples: 
  | email id              | userid | sku                                | po number |
  | tom@mailinator.com |     70 | abc-bat-4-1000-2118860-4-106-a0820 |      1234 |

@anshooarora
Please let me the solution its urgent .also let me know if any more info required from my end awaiting for your response 🙂

@anshooarora
Copy link
Member

ExtentReports version? The screenshots in the repo you have shared are for a reporter which is not available in the latest version 5.

@bughunter7
Copy link
Author

@anshooarora - I am using extentreports-cucumber6-adapter Version 1.2.0

Reporter used properties - extent.reporter.html.out=target/test-output/HtmlReport/ExtentHtml.html

on using only " Scenario outline " as a keyword in feature file the report generates an incorrect count as per attached screenshot above .
as of now I am using " Scenario " in feature files to avoid incorrect count But maintenance takes time it could be lot more easier if I get accurate count using " Scenario Outline " .

Please let me know if I need to upgrade to some other version / if you require anymore details.

Thanks :)

@grasshopper7
Copy link

U can try with 2.5.0 but HTML report is deprecated with extent 5. U will have to use the Spark report.

@bughunter7
Copy link
Author

@grasshopper7 / @anshooarora - changing version solved the count issue however screenshots of each steps are no more displayed in spark reports

Anyway can we view out screenshots in reports ? please let me know if you require anymore details :)

                       <dependency>
			<groupId>tech.grasshopper</groupId>
			<artifactId>extentreports-cucumber6-adapter</artifactId>
			<version>2.5.0</version>
			<scope>test</scope>
		        </dependency>

as it used to show in previous version ( small icon a click on it displays the taken screenshot )

new

Older Version ( HTML REPORTS ) ( Deprecated now )
old

To get screenshot for a desired step I am using

ExtentCucumberAdapter.addTestStepScreenCaptureFromPath(Util.screencapture());

	@Given("^user is on landing page$")
	public void user_is_on_landing_page() throws Throwable {
		driver = Base.getdriver();
		System.out.println(driver.getTitle());
		ExtentCucumberAdapter.addTestStepScreenCaptureFromPath(Util.screencapture());
		
	}

Method

public static String screencapture() {
		TakesScreenshot ts = (TakesScreenshot) driver;

		File src = ts.getScreenshotAs(OutputType.FILE);

		String encodedBase64 = null;
		FileInputStream fileInputStreamReader = null;

		try {
			fileInputStreamReader = new FileInputStream(src);
			byte[] bytes = new byte[(int) src.length()];
			fileInputStreamReader.read(bytes);
			encodedBase64 = new String(Base64.encodeBase64(bytes));
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return "data:image/jpeg;base64," + encodedBase64;
	}

Properties

extent.reporter.avent.start=false
extent.reporter.bdd.start=false
extent.reporter.cards.start=false
extent.reporter.email.start=false
extent.reporter.html.start=false
extent.reporter.klov.start=false
extent.reporter.logger.start=false
extent.reporter.tabular.start=false
extent.reporter.spark.start=true

extent.reporter.avent.config=
extent.reporter.bdd.config=
extent.reporter.cards.config=
extent.reporter.email.config=
extent.reporter.html.config=ReportConfig/ExtentConfig.xml
extent.reporter.klov.config=
extent.reporter.logger.config=ReportConfig/LoggerReport/LoggerReport.xml
extent.reporter.tabular.config=


extent.reporter.avent.out=
extent.reporter.bdd.out=
extent.reporter.cards.out=
extent.reporter.email.out=
extent.reporter.html.out=
extent.reporter.logger.out=
extent.reporter.tabular.out=
extent.reporter.spark.out=target/test-output/SparkReport/Spark.html

screenshot.dir=target/test-output/
screenshot.rel.path=../

@grasshopper7
Copy link

grasshopper7 commented Dec 14, 2020

U should try with 2.6.0 version for attaching images as Base64 encoded string src. U need to add the following property in extent.properties - extent.reporter.spark.base64imagesrc=true. Default is false. U just need to use scenario.embed() in step definition instead of the current code.
Refer to the README file for more details - https://github.com/grasshopper7/extentreports-cucumber6-adapter/blob/master/README.md. Search for 'Attach Image as Base64 String'

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

No branches or pull requests

3 participants