Forum Discussion
5 Replies
- hkim5Staff
It sounds like you're using TestLeft, since you are staying within your Intellij IDE to create tests using cucumber(probs java?)
I'm also not too familiar with cucumber-reports, but they consume the cucumber-json format reports generated by the command that goes something like
@RunWith(Cucumber.class)
@CucumberOptions(
format = {"pretty", "html:target/Destination", "json:report/cucumber.json"},
features = {"src/test/resources/AddOrder.feature"})
public class AddOrderTest {
}within your test....
I'm not sure if there is an elegent way to view the pictures within your cucumber reports in that case.
I'd point you towards asking the same question within the TestLeft and Cucumber community, since they may have some more insight into doing what you're trying to do!
https://community.hiptest.com/
https://community.smartbear.com/t5/TestLeft/ct-p/TestLeft
Otherwise, if you are considering using TestComplete, with the integration, there are Log.Picture type of built in methods that can post screenshots of each of the step definitions when the test runs publish the mht style logs.
- sonya_mSmartBear Alumni (Retired)
- sebroseSmartBear Alumni (Retired)
HiHarithaSaji ,
Can you give me some more details:
- what version of IntelliJ are you using?
- what version of Cucumber are you using?
- are you running your scenarios against an Android device or a simulator (which version)?
- are you running Cucumber from the IntelliJ integration or using a Cucumber runner (e.g. RunCukesTest)?
- please share your CucumberOptions (if using the runner) or a screenshot of the relevant IntelliJ Run/Debug Configuration
Thanks
Seb
- aslakhellesoySmartBear Alumni (Retired)
Hi HarithaSaji
Try this:
package io.cucumber.skeleton; import io.cucumber.java.AfterStep; import io.cucumber.java.Before; import io.cucumber.java.Scenario; import org.openqa.selenium.OutputType; import org.openqa.selenium.TakesScreenshot; public class StepDefinitions { private TakesScreenshot webDriver; private Scenario scenario; @Before public void before(Scenario scenario) { this.scenario = scenario; } @AfterStep public void attachScreenshot() { this.scenario.embed(webDriver.getScreenshotAs(OutputType.BYTES), "image/png", "screenshot"); } }
If the screenshot doesn't contain what you want, then it's not a problem related to Cucumber, but rather to the tool you are using to take the screenshot (I have assumed WebDriver).
Please also beware that TestComplete (whose forum we're in) and Cucumber are two different products, so please use the Cucumber forum for questions about Cucumber to avoid getting answers about TestComplete 😉
Related Content
- 11 months ago
- 4 years ago
- 5 years ago
Recent Discussions
- 4 months ago
- 5 months ago