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

Fix Cucumber reports for cucumber-android #605

Merged
merged 1 commit into from
Oct 13, 2013

Conversation

friederbluemle
Copy link
Contributor

This PR enables standard Cucumber reports using the format parameter of CucumberOptions by

  • Not clearing the list of formatters prior to adding AndroidFormatter
  • Correctly assigning reporter and formatter before feature execution

Reports will be stored on the device.

Example:
@CucumberOptions(features = "features", format = {"pretty", "html:/data/data/com.mypackage/cucumber-html", "json:/data/data/com.mypackage/cucumber.json"})

This will generate an HTML report in the cucumber-html directory and a JSON report. The pretty formatter writes to System.out, which will appear as nicely colored output in your logcat, given you use a color aware terminal. See Cucumber Reports for supported formatters/reporters.

After test execution reports can be pulled from the device:
adb pull /data/data/com.mypackage/cucumber-html
adb pull /data/data/com.mypackage/cucumber.json

You can also write reports to the SD card.

Note that the html reporter requires the cucumber-html jar in the libs directory of your Android test project.

@aslakhellesoy
Copy link
Contributor

@SierraGolf or @mfellner can you decide what to do with this PR please? You're more cosy with the Android code than me.

@SierraGolf
Copy link
Contributor

@friederbluemle can you rebase please? a couple of your changes already came in with #598. I think after the rebase this PR will only contain the removal of the clear() call which is fine with me.

@mfellner any objections?

@mfellner
Copy link
Contributor

No objections. Maybe you should add a note regarding the cucumber-html.jar dependency to examples/cukeulator-test/libs/README.md.

This is the only place right now for information about required jars when not building with Maven.

@friederbluemle
Copy link
Contributor Author

Rebased onto origin/master. Indeed the clear() call was the only remaining line.
Also added a comment to the README file of the example project.

This enables standard Cucumber reports using the 'format' parameter of
CucumberOptions. Reports will be stored on the device.
SierraGolf added a commit that referenced this pull request Oct 13, 2013
Fix Cucumber reports for cucumber-android
@SierraGolf SierraGolf merged commit 05031fd into cucumber:master Oct 13, 2013
@friederbluemle friederbluemle deleted the android-fix-reports branch October 13, 2013 20:17
@brasmusson
Copy link
Contributor

@SierraGolf Don't forget to update the History.md when merging a PR (or closing an issue). From https://groups.google.com/forum/#!topic/cukes-devs/0dhf7-RgcZc

If you merge a PR that doesn't update History.md or close the issue in the commit message, 
make a commit yourself right after the merge.

(or do what I have sometimes done, merge locally and amend the merge commit with the History.md change before pushing to GitHub)

@friederbluemle
Copy link
Contributor Author

#607

@SierraGolf
Copy link
Contributor

@brasmusson thanks for the info.

@rusuo
Copy link

rusuo commented Dec 5, 2013

Hello,

I am trying to get Cucumber reports, but I get a message with permission denied.

In my Manifest file I have:

and in my class I have:
@RunWith (Cucumber.class)
@CucumberOptions(format = {"pretty", "html:/data/data/android.test/cucumber-html", "json:/data/data/android.test/report.json"}, features = "features")
public class RunTestAT {

}

When I try to run the tests I get:
FileNotFound :data/data/android.test/report.json open failed: EACCES (Permission denied).

@dkowis
Copy link
Member

dkowis commented Dec 5, 2013

@rusuo Github is not a support forum, use the mailing list: https://groups.google.com/forum/#!forum/cukes

@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants