Java For Testers
0 FOLLOWERS
Java For Testers: a book and a blog
Java For Testers
4y ago
TLDR; Getting started with programming is the hardest part. Installing the IDE, adding dependencies, writing your first test. Pick whichever language you have someone to help you with, or you have a tutorial to work through. Switching languages when you know one is not too hard so do not worry about being stuck with a language, focus on getting started.
Which programming language should I learn?
I still receive a lot of questions about “Which programming language should I learn?”
And the answer is really - whichever language you can get more support for from people that you know.
Because l ..read more
Java For Testers
5y ago
TLDR; Downloading a file with RestAssured is as simple as taking the body of a request as a byte array and writing it to a file.
When automating I often have to download files. One very common FAQ for WebDriver is “How do I download a file with WebDriver?”.
How to download a file with WebDriver
Answer: Don’t, use an HTTP Library instead.
You can, by configuring the browser session to not prompt for location dialogs, and then click download button. But usually that is more pain that it is worth so, if I have to download a file, I’ll use an HTTP library.
RestAssured is an HTTP library
Rest ..read more
Java For Testers
5y ago
TLDR; Using Visual SVN, svnserve and local SVN repositories I was able to easily convert SVN to Git on Windows.
I hit every error possible when converting SVN to GIT. I eventually figured out the simplest way to avoid errors during the conversion process.
Migrate SVN to Git from local file repositories
To migrate from SVN to GIT I found it most reliable to use a local svn server, having migrated from remote svn using an svn dump file. then using svnserve to allow conversion using git svn over the svn protocol.
have a local svn server I’ve been using Visual SVN Server
I migrated remote svn ..read more
Java For Testers
5y ago
TLDR; Bonobo is a free and simple to install Git Server for windows.
The Bonobo git server install page instructions don’t fully match the process I had to use to install, so I’ve documented the process here.
I will show you the steps to install a local Git server on Windows 10.
Install Steps for Git Server
The Git Server used is Bonobo Git Server, this runs on IIS on Windows.
https://bonobogitserver.com/
Pre-requisite:
use Turn Windows Features On and Off to install
Internet Information Services > Web Management Tools > IIS Management Console
Internet Information Services > Wo ..read more
Java For Testers
5y ago
TLDR; Coding Tips for beginners.Write your code as temporary comments, remove syntax errors as soon as you see them.
Here are a few tips I’ve been verbally passing on when teaching people on my Java For Testers face to face training.
write the code you want to see as comments first
remove syntax errors as soon as you see them
Write the code you want to see as comments first
Creating a blog comment e.g.
/*
iterate over the list and print the name of each object in the list
and assert that when I call getAge for each object it is greater than 18
*/
The reason for doing this is that learn ..read more
Java For Testers
5y ago
TLDR; Rather than migration your assertions line by line, create an abstraction class to represent the new implementation and then perform inline refactoring.
I’m experimenting with migrating my projects to JUnit 5.
Many of the “how to migrate to JUnit 5” blog posts show differences, but not a lot of strategies. I used a Branch By Abstraction strategy to migrate JUnit 4 Assertions. This allowed me to experiment with using JUnit5 assertions or AssertJ assertions.
Differences between JUnit 5 and JUnit 4
The main differences between JUnit4 and JUnit5 seem to be: annotations, rules, and assert ..read more
Java For Testers
5y ago
TLDR; Apply MVP principles when coding. Code to the API first. The API is internal before it is external. Unit tests with classes. In code testing with classes in combination. In code API testing. External HTTP API Testing. And then if necessary -In memory and process HTTP API testing. GUI.
A long time ago, in a town which I no longer live in, I wrote a tool called Compendium-TA
Commercially that was a disaster: it was self funded, it took a long time to write and I made some poor technology decisions.
I learned MVP and API First Thinking the hard way. I’ll try and explain within.
One of t ..read more
Java For Testers
5y ago
TLDR: Learn one programming language and you have already learned parts of other languages. You can speed up learning other languages by learning the differences.
I wrote a bunch of code in Java in my Test Tool Hub for generating CounterStrings.
I thought it would be useful to have it online and written in JavaScript.
JavaScript and Java have a lot of similarities. So many similarities in fact that I was able to copy and paste the code, and then make minor tweaks without too much thinking.
If you already know Java then learning these similarities and differences might help learn JavaScript ..read more
Java For Testers
5y ago
TLDR: Spark is static so having it run in an @BeforeClass allows HTTP request testing to begin.
I use Spark as the embedded web server in my applications. I also run simple HTTP tests against this as part of my local maven build. And I start Spark within the JUnit tests themselves. In this post I’ll show how.
We all know that there are good reasons for not running integration tests during our TDD Red/Green/Refactor process. We also know that we can run subsets of tests during this process and avoid any integration tests. And hopefully we recognise that expedient fast automated integration ..read more
Java For Testers
5y ago
TLDR: when I have a small set of HTTP use-cases, and I’m working on fast in-build HTTP integration verification then I’ll probably use HttpURLConnection
I do receive a question fairly often like:
“Why would you ever use basic HTTP libraries rather than Rest-Assured?”
“When would you choose to use basic HTTP libraries instead of Rest-Assured?”
And other variants.
I’ll try to answer that in this post.
It isn’t an easy answer since I’ll know it when I see it.
But… since I’ve just implemented a bunch of @Test methods for a test app that I’m writing and they use the HttpURLConnection I will ex ..read more