-
-
Notifications
You must be signed in to change notification settings - Fork 528
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
Add 10-minute-tutorial for Java #101
Conversation
- An IDE editor, for example [IntelliJ IDEA](https://www.jetbrains.com/idea/?fromMenu#chooseYourEdition) (which will be used in this | ||
introduction) | ||
|
||
- A Cucumber plugin for your IDE, for example [IntelliJ IDEA Cucumber for Java plugin](https://plugins.jetbrains.com/plugin/7212-cucumber-for-java) to go with IntelliJ IDEA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has this been fixed yet to work with cucumber-jvm 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It hasn't. I see now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we mention anything about that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IDE plugin is presumably optional? Maybe a link to working with Cucumber outside of the IDE?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, not sure the plugin is optional with IntelliJ: https://www.jetbrains.com/help/idea/cucumber.html so I'm going to leave it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eclipse one works great and is available in the marketplace, in case you want to mention it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Flaburgan IntelliJ works fine otherwise, maybe when adding a tutorial with Eclipse. Thanks!
content/10-minute-tutorial.md
Outdated
|
||
- [Cucumber-JVM](https://github.com/cucumber/cucumber-jvm) (which we will add as a dependency to our project) | ||
|
||
- [JUnit 4](http://junit.org/junit4/) (which we will also add as a dependency to our project) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So not needed to get started. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll remove them here :)
content/10-minute-tutorial.md
Outdated
2. Select **Run 'Feature: tutorial'** from the context menu. | ||
|
||
{{% note "Formatter error"%}} | ||
If you are using Cucumber v2.0.0 or higher, when running the test for the first time you might get an error message that mentions `CucumberJvmSMFormatterUtil`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are using Cucumber v2.0.0 or higher
can be removed we are using 2.0.0. You've specified that in the tutorial.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. Will update
content/10-minute-tutorial.md
Outdated
|
||
{{% note "Specify glue location"%}} | ||
You might need to tell Cucumber where to find your `StepDefinitions.java` file (i.e. the 'glue' between your Gherkin and your programming code). | ||
If so, open your **Run Configurations** and add the name of your `<project>` directory in the **Glue** field. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You describe a problem but not what the symptoms are.
Discussed with @mpkorstanje - as IntelliJ currently not working properly with Cucumber v2.x; I'll update this tutorial to describe running with a Cucumber runner (and move the running from InteliJ to |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some comments throughout, but this is good stuff!
- An IDE editor, for example [IntelliJ IDEA](https://www.jetbrains.com/idea/?fromMenu#chooseYourEdition) (which will be used in this | ||
introduction) | ||
|
||
- A Cucumber plugin for your IDE, for example [IntelliJ IDEA Cucumber for Java plugin](https://plugins.jetbrains.com/plugin/7212-cucumber-for-java) to go with IntelliJ IDEA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The IDE plugin is presumably optional? Maybe a link to working with Cucumber outside of the IDE?
|
||
3. Make sure that the Project SDK is selected (for instance, Java 1.8) and click **Next** | ||
|
||
4. Specify a **GroupId** and **ArtifactId** for your project and click **Next** |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we tell people what these are for? Or do we assume they already know because they are setting up a Java project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ad 3. Unfortunately cannot test what happens exactly as I have Java set up, so cannot describe in detail here. But I've helped coworkers who did not... and you run into interesting problems (stuff not getting recognized mainly)
Ad 4. If you don't, you cannot create the project.
For this tutorial, I'm going to assume they know why OR will just follow the steps (I only mention 3 because I've seen this lead to problems). Let me know if you disagree!
content/10-minute-tutorial.md
Outdated
|
||
# Specifying Expected Behaviour | ||
|
||
We specify the expected behaviour by defining features and scenarios. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
link these?
content/10-minute-tutorial.md
Outdated
|
||
We need to create this directory, as it was not created for us. In IntelliJ: | ||
|
||
1. Right click on the Test folder, select **New > Directory** and name this directory `resources`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably skip telling people how to create a dir, and just tell them how to mark it as Test Resources Root
content/10-minute-tutorial.md
Outdated
|
||
2. Right click the folder and select **Mark directory as > Test Resources Root**. | ||
|
||
3. You can add subdirectories as needed. Create a subdirectory for your project in `src/test/resources/` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this whole thing our project?
} | ||
|
||
|
||
Process finished with exit code 0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Myabe add a little explanation. here of the step implementations shown? Or just a bit of flow text that takes us into the next section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
content/10-minute-tutorial.md
Outdated
Process finished with exit code 0 | ||
``` | ||
|
||
## Snippets for Missing Steps |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing Snippets for Missing Steps?
content/10-minute-tutorial.md
Outdated
|
||
To add them to a Java class in IntelliJ: | ||
|
||
1. Navigate to the `src/test/java/<project>` folder and right-click it to display the context menu |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably condense these steps as well
content/10-minute-tutorial.md
Outdated
Once you have implemented all your step definitions (and the expected behaviour in your application!) and the test passes, the summary of your results should look something like this: | ||
|
||
``` | ||
Tests run: 5, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 0.656 sec |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why are they skipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy-paste error. thanks!
content/10-minute-tutorial.md
Outdated
``` | ||
|
||
# Examples | ||
If you prefer to get started with a working project, try the skeleton project [which is available from GitHub](https://github.com/cucumber/cucumber-java-skeleton). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd link "skeleton project" not "available on GitHub"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And by this stage, asking them if they prefer something else feels odd. Maybe "If you'd like to test out a working example, try...
Thanks @plaindocs for the excellent feedback. Think this is ready to (squash! and) merge now... |
Thanks @plaindocs ! |
My pleasure! |
Add a 10-minute-tutorial for Java, with Maven, JUnit and IntelliJ.
A preview is available on Netlify.
Note: This PR does not include tutorials on JavaScript & Ruby.
Those can be added once this is reviewed & merged.