Java 14 Selenium Framework with SpringBoot
- OpenJDK 14
- Code editor (the rest of this guide uses IntelliJ Community Edition)
- Setup GitHub SSH key
- Pull down this repo using SSH locally
- Open IntelliJ
- Click "Open or Import" option in IntelliJ Launcher
- Locate the repo you pulled down
- Select to open it's
build.gradle
- Click open as project
- Allow gradle dependencies to be downloaded (progress bar is shown in IntelliJ)
As in most Java projects, framework implementation will go in src
directory and and unit tests of the framework (if needed) belong in test
directory.
If added, Cucumber/RestAssured/etc test scripts/specs will also belong in the test
directory.
There is a basic runner to run the context test in the /.run
folder. If I am correct, this should appear in IntelliJ as a run option, but to check this I would need to reimport the project and see what happens. I will test this through a collaborator instead first.
This should appear in the upper right in IntelliJ next to a play button. It is setup to just run the one example SpringBoot test in Chrome browser. You can adjust the selenium.browser
VM option to other com.ddaypunk.dupage.browsers to run it in that browser. I have noticed that the first run seems to fail possibly due to webdriver manager downloading the needed driver. A second run seems to usually work though.
There are many ways to do this, and ask me if you need some ideas on how to setup git. The normal flow will be as below (using git command line). If you know how to, you can also use a git GUI for this like the one in IntelliJ or others like Git Kraken.
- Using terminal, please fetch and pull down the main branch:
git fetch origin && git checkout origin/main
. - Then create a named dev branch locally:
git checkout -b your-named-branch
. This will create a development branch locally for you to work off of. - Make your changes in IntelliJ
- In terminal,
git add .
will add all of your changes to stage (ready to be committed) - Then commit the changes
git commit -m "message to explain what was changed"
- Then push changes to github
git push -u origin your-named-branch
- After some git magic, git should give you a link to make a pull request to the repo, click this
- Target the main branch, from your-named-branch, provide some details, and tag people you want to review it
- Once approved by a team member, you can click the arrow on the merge button and set to squash and merge. This will merge all of your changes into one commit message and then merge it to main.
Please ask me to show you how to do things directly in IntelliJ. It will be easier to explain