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.attach() does not exist #600

Closed
dbnex14 opened this issue Mar 16, 2021 · 5 comments
Closed

scenario.attach() does not exist #600

dbnex14 opened this issue Mar 16, 2021 · 5 comments
Labels
🍼 incomplete Blocked until more information is provided ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support

Comments

@dbnex14
Copy link

dbnex14 commented Mar 16, 2021

The page shows example how to capture and attach screenshot to report


if (scenario.isFailed()) {
    byte[] screenshot = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.BYTES);
    scenario.attach(screenshot, "image/png", "name");
}

attach() method does not exist in Scenario

@aslakhellesoy aslakhellesoy added 🍼 incomplete Blocked until more information is provided ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support labels Mar 16, 2021
@aslakhellesoy
Copy link
Contributor

What page?
What Cucumber version?

What is the fully qualified class name of your scenario? Perhaps you've imported the wrong type or perhaps you're using an old version.

Here is attach

@dbnex14
Copy link
Author

dbnex14 commented Mar 18, 2021

https://cucumber.io/docs/guides/browser-automation/?sbsearch=take%20screenshot

import cucumber.api.Scenario;

I dont know where to find version of cucumber. I am using IntellyJ IDEA. Here are dependencies in my pom.xml, based on that, I think it is 4.4.0:

    <dependencies>
        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-core</artifactId>
            <version>4.4.0</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-html -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-html</artifactId>
            <version>0.2.7</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.sourceforge.cobertura/cobertura -->
        <dependency>
            <groupId>net.sourceforge.cobertura</groupId>
            <artifactId>cobertura</artifactId>
            <version>2.1.1</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-java</artifactId>
            <version>4.4.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-junit</artifactId>
            <version>4.4.0</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-jvm-deps -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>cucumber-jvm-deps</artifactId>
            <version>1.0.6</version>
            <scope>provided</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/net.masterthought/cucumber-reporting -->
        <dependency>
            <groupId>net.masterthought</groupId>
            <artifactId>cucumber-reporting</artifactId>
            <version>4.7.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.hamcrest/hamcrest-core -->
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>2.1</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/io.cucumber/gherkin -->
        <dependency>
            <groupId>io.cucumber</groupId>
            <artifactId>gherkin</artifactId>
            <version>5.1.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>3.141.59</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/junit/junit -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

@luke-hill
Copy link
Contributor

luke-hill commented Mar 18, 2021

Hi @dbnex14

So reading your POM file you're looking for the <version> key. You'll see for cucumber java this is quite old. It's 4.4.0

As you can see from this page https://mvnrepository.com/artifact/io.cucumber/cucumber-java - That version was released in June 2019 (So it's nearly 2 years old).

The work to standardise the method names attach and log was done quite recently. So I'd advise trying to upgrade to a version of the cucumber-jvm jar that's more recent. Definitely something in the 6.x tree.

EDIT: You can see the conversation here regarding the work - cucumber/common#897 Most of which was done / standardised in 2020.

@dbnex14
Copy link
Author

dbnex14 commented Mar 18, 2021

Hi @dbnex14

So reading your POM file you're looking for the <version> key. You'll see for cucumber java this is quite old. It's 4.4.0

As you can see from this page https://mvnrepository.com/artifact/io.cucumber/cucumber-java - That version was released in June 2019 (So it's nearly 2 years old).

The work to standardise the method names attach and log was done quite recently. So I'd advise trying to upgrade to a version of the cucumber-jvm jar that's more recent. Definitely something in the 6.x tree.

EDIT: You can see the conversation here regarding the work - cucumber/cucumber#897 Most of which was done / standardised in 2020.

Thank you Luke. I guess that explains it. This item can be closed

@dbnex14 dbnex14 closed this as completed Mar 18, 2021
@dbnex14
Copy link
Author

dbnex14 commented Mar 18, 2021

Thanks Luke~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍼 incomplete Blocked until more information is provided ❓ question Consider using support forums: https://cucumber.io/tools/cucumber-open/support
Projects
None yet
Development

No branches or pull requests

3 participants