Postman Flows: A Guide

This post is an overall guide to what Flows are and what they can do. Alternatively, click these links if you want to see some example Flows in action or learn more about what each block that makes up a flow does.

TLDR: look at the vids, they’ll tell you all you need to know.

What is it?

Here are the words of Postmanaught Neil Studd, on the fab new Tech Team Weekly podcast:-

“We’ve done a soft launch for a new feature called Flows, which we’ve been working on for ages. Basically it is a widget based canvas that you can drag and drop components and link them together.

Previously if you wanted to start chaining requests at Postman, or start carrying values between requests you had to know a fair amount of how to structure JavaScript and work with code.

Flows is basically our codeless approach to chaining processes together. It really opens up Postman to a whole new audience.”

Now I have been waiting for this to drop for awhile, partly out of sheer consumer curiosity as someone who is still reasonably inexpert when it comes to code, and partly because I had originally wanted to include a chapter on this feature in my Test Automation University Postman course. I think any technology that wants to make it easier for non-tech people to get into and not harder gets my vote, so this is an exciting area for Postman to move into.

I’ve had an hour or so to take a look at the beta, and here are my thoughts, as well as tips on how to use it.

How do I find Flows?

Flows can be found in both the Web version and the desktop Postman app.

To access Flows:-

  • Select a workspace
  • Select Flows from the left hand horizontal menu (underneath History)
  • Click on “new flow” to view the canvas

Click on the “flow” menu on the bottom of the left hand side of the screen.

Where to find Postman Flows

How Do I Get Started Using Flows?

It is very important to say that this is only a BETA version, and inevitably lots of changes will happen between now and the final formal release. I have to be completely honest here and admit that it wasn’t the most intuitive feature for me to get to grips with, but nor was it so painful I had to give up on it completely. I’m sure by the time you come to read this Postman will be several iterations in and it will look and feel much better.

If you wish to explore for yourself, the Flows work by adding blocks in a chain. Think like a daisy chain necklace. Currently these blocks can take several forms in Postman:-

video showing current list of blocks in Postman Flow

If you want to learn more about what each of the blocks do, read my other post here.

There are tonnes of use cases for this that I’m sure your brain is whirring with already, but I’m going to start with a basic example.

Say you are using an endpoint that returns a list of bookings for your hotel. You want to see if there have been lots of bookings, or its been a slow day and you haven’t had much success.

With PostmanFlows you can use blocks like “send request”, and then add a chain to a “for each” condition – this allows you to iterate through the response and run a query against it using a third block called “validate”. Finally, as the validate outputs a true or false data, each of those records can be sent to a different “terminal” log group, allowing you to view what data has been applied to what “pot”.

Picture showing an example Postman Flow

You can see this for yourself in much more detail in this vid:-

How to use Postman Flows

*NEW* And here is another vid on how to chain requests together to “flow” data from one request to the next. (updated March 2022 to show the latest functionality of Postman Flows version 9.15).

*NEW* How to pass data using Assign Variables and Data Durables

I hope this very basic guide to this new feature is useful to you. I’m looking forward to what future iterations bring, and will aim to update this blog post with future updates.

Enjoy!

What I learned from Mabl’s State of Testing in DevOps report 2021

Here we go again.

A few months back, I blogged about a testing report which aims to cast light on the state of testing. That blog was weirdly popular. So much so that when I saw Mabl had released a similar report, this time focussing on DevOps in relation to testing, I thought it would be remiss of me not to talk about it (love that phrase!).

So, what is the Mabl report all about? This is the third year running that the popular automation tool has surveyed those in and around the QA profession about how, or indeed if, they work with DevOps. 600 people were surveyed, and there are some great insights. You can find the detail here, curtesy of Software Testing Weekly.

Now, if I’m letting my imposter syndrome hat drive my pre-report thinking, I’d have been expecting it to paint a picture of pretty much everybody being fully DevOps. Think multiple deployments a day, 100% automation at all levels of the stack, perfect pipelines and testers (if they even exist anymore right?) scratching their heads thinking “what can we do now?”.

However, as with so many things, the reality lives down to the hype.

Some of the facts that struck me were:-

  • only 11% of those surveyed classed themselves as “fully DevOps & Automated”. The majority were Aspiring, or Striding (in order words, not there yet).
  • there was a 14% decline year-on-year with those who said they had adopted “CI” (continuous integration) principles. 33% said they were in the process of “Transitioning” to utilising CI.
  • Just 27% of respondents said they had adopted Continuous Deployment.
  • How about regular deployments? Almost half of teams still deploy new code less than once a month – so if you’re in a team where that is happening trust me you are not alone. Just 15% deploy daily or more, and this %age has actually decreased year-on-year.
  • When it comes to what layer of the stack to automate, unit, UI and regression are the firm favourites – but all of those have only around 40% of teams saying they automate them.

Perhaps the key one for me was this.

One very interesting revelation from this year’s data is that most teams – regardless of where they are in the DevOps maturity – rely on a combined automated and manual testing approach.

Mabl, State of Testing in DevOps Report 2021, page 17.

We often here “manual testing is dead” type themes from those who want to emphasize the silver bullet type benefits that automation can supposedly bring. I’m with Melissa Fisher here, click this to listen to her insightful Racket on this topic. Automation is a useful tool that can help testers, but it can’t replace them, and nor should it try to. Speed should not come at the expense of quality.

Whilst the companies who are nailing DevOps are more likely to have a culture of quality, and even though they are smaller in number than we might have realized, they will undoubtedly be destination companies for testers keen to embrace future patterns of working. Customers of these companies seem to be happier too, which is a great measure of success in my book.

So DevOps does appear to be on the horizon for a lot of testers. We’re just not all there yet.

It won’t be an overnight move, and if you happen to work somewhere which hasn’t fully embraced DevOps ways of working, whether that’s due to cost, politics or a plethora of other reasons, you don’t need to consider yourself over the hill and unemployable. If you’re somewhere that does bits of DevOps, but is still trying to slowly do more, you’re not alone.

And if you think you have to only do 100% automation to survive in the world of testing, you might want to think again.

Cover image: Online illustrations by Storyset

What I learned from Practitest’s State of Testing Report 2021

Look at the rules, not the exceptions

Now in its 8th year, the SOT Report provides testers with some valuable trend-based information on all things testing. The full report in all of its chart based glory was delivered today, and is well worth bookmarking. You can read the full report here.

Sometimes, when attending meetups, conferences or reading online articles, the loudest voices are often those with the most exceptional experiences. But we may discover this fact long after our own Imposter Syndrome has reprimanded us for not living up to their ideals. We may find ourselves wondering “I’ll never be a proper tester, I don’t even write unit tests” or “I’ve never done test coaching/worked on IoT technology/done BDD/shifted left/[insert plethora of missing skills]” so is there even a future for me in this industry?

Stats tend to be more accurate at revealing general trends. As I did at my Testbash Manchester talk, rather than focusing on the exceptions, I want to pull out some of the rules. How the majority of people who consider themselves to work in Testing define what they do, what they call themselves, and how they work.

Nope, its not sexy. But it is reassuring to learn that out of all the responses:-

  • 28% are known as “Test/QA engineers”, only 0.89% Test Coach and 2.14% are SDETS.
  • 74% and 60% test Web and Mobile, only 9% IoT and 18% Big Data.
  • 92% work in Agile environments, only 27% use BDD.
  • 75% have tasks that involve Test Automation & Scripting, 68% validating users stories. Just 15% are tasked with Unit Testing (and that’s down 3% on the year before).
  • 75% use bug tracking tools like Jira, only 14% use exploratory note taking tools.

Its important to note I don’t want to denigrate the activities on the right. At all. But the fact is, waaaaaaay more folk are doing the things on the left. You just don’t hear about it.

For me, this report puts into sharp relief some of the misconceptions doing the rounds, that you have to know how to do all this stuff to be successful. You don’t. Why? Because as with so much in testing, the answer is often “it depends”. BDD is a great fit for some organizations, but not for all.

Learn the fundamentals, safe in the knowledge that what you may be learning at your current place in terms of processes, tooling or skills could go out of the window at your next company. And that’s totally fine.

Testing is a broad church, and there is still a seat for everyone.

Creating A Test Automation Portfolio Episode 6: C# Solution For Ui Automation Using Selenium 4.0 (aka the missing episode)

Intro

This is the missing episode. The one that I wrote and somehow inexplicably deleted (even from the trash). Rewriting as faithfully as I can the final project in my test automation portfolio series.

This time, its the one I put off until I was too far gone into the project to turn back. The one I was most nervous of attempting. Selenium 4.0 with C# to automate at the Ui level.

The Project

I used the amazing course by Carlos Kidman on Test Automation University as my starting point, and added a few additional bits and bobs along the way. I’ve since re-used this framework for another paid project, so proof that putting the effort into an automation portfolio pays off on many levels, thanks past Beth!

So, what does it do?

The framework uses Page Factory Model (POM derivative) to organise the code. It is written in C#, and a base class to store the startup/teardown info. The tests check basic functionality on the Opencart website. But I converted the version of Selenium to be the latest big upgrade, version 4.0. This meant I was itching to trying at least one of its new features. I went for relative locators:-

This allowed me to click a button by its relative location to another button. A little flaky in practice, but handy to know for future.

Here is a video I made that goes into more detail:-

Video of how to use relative locators in C#

Rex Jones II has a brilliant set of video’s which go into way more detail on all the other cool features too.

Key Features

My strategy was basic, namely:-

  • Get the original framework running.
  • Upgrade Selenium
  • Add in a drivers section so that the test can run against multiple drivers
  • Convert the tests so they run against the Opencart demo website

Here is a video of how I overcame the difficulties of installing the Edge Chromium browser – not as easy as you’d think, and judging by the fact its my most popular video I reckon a fair few people agree with me!

YouTube video of how to run tests using Microsoft Edge Chromium Browser and Selenium 4

The Code

I’ve published my repo as a template, which means you can use it as a basis to begin your automation framework. Check it out here if using the drivers is your thing:-

https://github.com/askherconsulting/CSharp_.Net_Selenium_Automation_Portfolio

However, I’ve since revisited Carlos’s course, and added a lot more of the bits I missed out from the first framework in this new upgraded version here (so I’d suggest you use this one, unless you want the drivers in which case look at the other one, I’ll update this when I have time):-

https://github.com/askherconsulting/Mailinator_Selenium_Automation

Lessons Learned

A lot of people still default to using Selenium and Ui automation tools like it. We know that isn’t always the most robust way to automate, but once you have the framework up and running and just want a quick and dirty test, sometimes it is your best option.

When I finished this particular framework, it meant that my test automation portfolio that I’d set out to do 4 months before (target being 1 year) had been completed. I was ecstatic, and continue to be proud of this. Others have read these blog posts and been inspired to do something similar – I hope you may be one of them.

T’ra for now!

Testing Pearls Of Wisdom

As you may or may not be aware, I’m currently half way through helping to deliver a software testing bootcamp. This involves me working as part of a team of instructors (who are all working testers) to give sessions on various topics to those wishing to pursue a career in software testing.

I’m enjoying the course a lot, as aside from learning loads it has made me reassess some of my core values, and try to put them in a pithy, easy to read way that can translate to different audiences.

I decided to create Twitter/LinkedIn posts using tools like Canva and Piktochart to create the images below, and I’ve been pretty amazed at the positive response.

Personal Brand Vs. Personal Reputation

My philosophy on growth

"If you learn the why, you can always Google the how"
“If you learn the why, you can always Google the how” quote

I’ve learnt this from years of watching developers and other testers, whilst also letting my Imposter Syndrome talk me into thinking that doing exactly as they were doing somehow translated into me being rubbish at my job. I attended a mock interview recently, and one of the responses was “we don’t expect you to have the answer to your fingertips every single time, just tell us your thought processes to how you know where to find the answer”. I Google stuff every. single. day. I couldn’t debug an automated test without using Stack Overflow, and I lean on others for guidance and support both in work and outside it. And this actually makes me better at my job – because often my instinct is proved wrong, and I can refine what I’ve done long before I’ve taken myself down a rabbit warren of mistakes. And judging by the 200+ comments on this post, a helluva lot of people feel the same.

Automated Car Analogy

Quote "Automated software testing is like driving an automatic car.  The car takes care of the checks, like wipes, lights and gears. This frees up the driver to focus more fully on the unexpected and more complex twists, turns and bumps in the road."
Test Automation Analogy: Automated Car

I came up with this one when driving my car (my first ever automatic, nothing fancy mind) back from the supermarket. I noticed a car in the opposite lane with its hazards on, and it took me fully 5 seconds to realise it had stopped on the road so that the driver could visit the Tesco over the fence. Not a great bit of driving, and the cars behind were similarly confused. I thought to myself, if I’d have been thinking about that for 5 seconds and had to concentrate on the road as well as gear changes and wipers (it was raining) I’d have probably stalled. But my automatic car took care of those checks for me, giving me that head space I needed to assess the dangers, or lack thereof, in front of me.

Automated testing is just the same – get those repetitive regression checks taken care of by the machine, and allow the driver to explore the application at leisure.

Bug Reporting = Archaeology

Quote "Reporting software bugs is like digging for dinosaur bones.  The best thing you can do when you find something is to uncover as much as you can before you confidently shout "It's a T-Rex!""
Bug Reporting as Archaeology Analogy

I’ve got to thank @TheTestingPeers for this one, as they refined my original thoughts. This one works on a few levels, as identified by David Maynard and Russell Craxford. Firstly, in archeology people dig in teams of different experts – so you can call on the right person to help you figure out what you are seeing as part of your analysis.

Secondly, archaeologists have to document the position of what they have found, in much the same way testers do (e.g. this is on chrome version 88.39393) – adding this detail instead of just shouting “I’ve found something”, when something may turn out to be a chicken bone will save the team time and earn you a reputation as someone who’s opinion can be relied upon.

Thirdly, archaeology, just as testing, is mostly about what you don’t find. You can asses the quality of a piece of software by its absence of bugs (as long as your testing the right things) as much as by the existence of them. Knowing something isn’t a T-Rex, and being confident of that assertion, is just as mighty.

Summary

I hope you’ve enjoyed these pithy analogies. Feel free to share with anyone who would benefit from seeing them.

How RuPaul’s Drag Race Has Taught Me to Be a Better Tester – and Why You Should Watch it too!

OK. So I have only just discovered that the new season of reality TV show RuPaul’s Drag Race will air on Netflix Saturday 2nd Jan 2021 in the UK. I cannot tell you how ludicrously excited I am by this news. 🥳

If you’re not familiar with the show, it is a competition with a $100,000 prize fund, where Drag Queens from all over the world compete to win “the race”. It is incredibly popular, and I have loved watching it for years.

It seems a tenuous link, but I honestly think my all-time favourite TV programme has a lot to teach us all. Here are a few lessons I’ve learnt from the show:-

The power of community

If anyone is looking to join, build or grow a community this year, Drag Race is the perfect example of how to do it. It respects its roots, celebrating what came before it such as the iconic “Paris is Burning” documentary and the Stonewall uprising. It also embraces and celebrates all that is weird, “other”, non-conformist and challenging. As testers (and as people), we need to embrace other points of view, and be a part of a psychologically safe workplace. It might sound wooly but it makes the difference between dreading coming into work or staying around for years and years. RPDG provides a space for everyone spectacularly if, like me, you’re into the Testing Peers concept of culture-add not culture fit.

The importance of being authentic

I’ve always loved that Drag Race Queens are selected because of their “charisma, uniqueness, nerve and talent”. A drag act might be all about image and looks, but that alone won’t get them a ticket to the final. What matters is what you do and who you are. Queens who don’t fit the looks mold but excel comedically or are super kind or super talented do spectacularly well.

“Club Kid” looks celebrate the unusual and unique

I’ve always liked that I work in an industry where I’m not judged on my looks. That I come to work most days with no make up on, my hair tied in a crappy bun wearing an old jumper and jeans and that makes zero difference to people’s respect for me or their view on how well I can do my job. Trying to hide who you are at work to fit in is exhausting, and as a long term strategy will likely fail for you. Be yourself, and support others who want to be authentic too.

You will fail. Success comes to those who keep trying.

RPDG has become a phenomenon. It has spawned so many successful global careers for the contestants (who win or lose, yes you Porkchop) that they are often willing to come back and try again. Many who failed to snatch the crown first time around try harder, work on their failures and return to take the “All Stars” title – another RPDG series which takes past contestants and puts them through their paces once again. A lot of the contestants have endured genuine and profound hardships to be who they are, and to even make it on to the show in the first place is rightly considered a major life win.

The power of resilience and persistence in testers is a mighty one too. RuPaul himself says “what other people think of you is none of your Goddamn business” – and I believe this to be 100% true. Do not waste your time stressing about what others think, or being afraid to be the one who says “I don’t understand this”. Push those boundaries Queen.

Shea Coulee, runner up then crowned winner in 2020.

Don’t take yourself too seriously

From the pun-tastic names (“Bagga Chips”, “Heidi n Closet” and “Lattrice Royale”) to the tasks and even the guest judges, everything about RPDG has its tongue firmly in its cheek. Be prepared to work hard, but know life is for living and enjoying yourself.

I always work best in teams with a healthy approach to their work life balance and who enjoy lifting those around them to be positive and have a good experience at work. If your only focus is on delivery on time at all costs, this will lead to burnout, low morale and all the best people leaving. I’ve said it before and I’ll say it again, just don’t be a dick.

I intend to add to this post in future once I’ve watched the latest season (and probably gone back and watched the previous ones for like the 10th time too) but after the year we’ve had I would wholeheartedly encourage you to jump in to the the craziness and life-affirming goodness that is Drag Race.

Can I get an amen? ;o)

Creating A Test Automation Portfolio Bonus Edition: Codeless UI automation using TestProject

I recently completed a marathon project to create 5 working test automation frameworks from scratch, which form a Test Automation Portfolio.  This article is a bonus edition of that portfolio, where I use TestProject to create the same tests in an earlier framework using their codeless solution. (hint: it was insanely easy).

TLDR:

  1. You should consider writing a test automation portfolio if:-
    1. You think you might need to show off your automation skills e.g. to an interviewer
    2. You want to learn more about automation by getting your hands dirty
    3. You want to improve your visibility as a tester and share your knowledge with others
  2. You should consider using TestProject’s codeless test automation for your Test Automation Portfolio if:-
    1. You want a quick (like, lightning quick) way to create tests
    2. You’ve been frustrated by how long it takes to get a fully fledged automation framework set up in the past and want an easier solution
    3. You want to see how far IDE type solutions have come since “the bad old days”

The Project

I had created a test framework which executed a few basic tests such as login on the OpenCart admin demo website – this is a great one to use for testing because it has a lot of features.

I wanted to wrap these tests up into a suite so I could run them all together.

Winning Features

Test Project is the first codeless solution I have used since early Selenium IDE, and I’ve got to say that codeless solutions have definitely come a long way since then! Test Project feels much more solid to me, and yet super easy to get started and have something up and running in no time at all.

The test recorder is a great feature if you want a quick solution.  For example, in an earlier framework I’d spent hours trying to get my head around relative locators in Selenium 4 to identify a tricky logout button that didn’t have a nice user friendly ID in the DOM. I wanted the code to be easily readable, so didn’t want to map some crazy CSS query, and I really struggled to identify the element.

Here it is:-

With the Test Project recorder, all I had to do was click “logout” and it added a user readable step into my test case, no manual intervention required. To someone like me, this is literally hours saved.

Not only did I use the recorder to create all 3 of my test cases, but I also tried out the new sharing feature to pass my test case from one user to the next.  This felt like Postman to me, being able to easily send someone else my code and for them to accept it and run it right .  

You can read more about this feature here.

I was even inspired to do a few video tutorials! Here is how easy it is to create a test:-

And here is a video about how to create a “run” consisting of several tests:-

The code

The codeless solution has some great features that genuinely surprised me.  Once you have written a test, such as login, you can add that test into another test, to avoid re-writing code that you need to maintain in different places.  

Also the use of parameters such as Username and Password was fantastic.  You can set project (global) or test specific variables and even make them secret.  The great benefit of this is if a parameter changes or you want to use a different user you only need to go to one place to update and it will propagate through all your tests.

Thanks to the sharing feature, I thought it would be helpful to share the links to my tests with you. Feel free to import them into your solution and see if it works!

Login:- This test clears the default username and password, types in a new one and logs in.  It then validates the user has landed on the correct page.

View Orders: – This test logs in (reusing the login test above to reduce duplicate code), opens the menu bar and selects sales -> orders.  It then validates the orders page is visible.

Logout:- This test logs in, clicks logout and validates the user is returned to the login page

Lessons learned

Getting the chance to add Test Project into my portfolio was an enlightening experience for me.  I learned how easy it is to over engineer an automated framework, particularly if you only want a quick and easy solution.  The speed with which I was able to get up and running and produce parameterised tests which could run on any browser installed on my machine was a game changer.

Summary

I would definitely turn to codeless solutions in future as the fastest way of getting off the ground, and the fact Test Project has some many features to increase maintainability, such as global parameters, test imports and the ability to share test cases with other team members, means you don’t have to worry that you’re somehow “not doing it properly”.  I also love how you can convert the tests into coded tests using the SDK if you want a more fully fledged solution, as this allows you to start off small, and as your skills mature the framework can grow with you.  If you are interested in creating a test automation portfolio for yourself, I’d encourage you to take a look at Angie Jones article here for inspiration.

Creating A Test Automation Portfolio Episode 5: UI Web Browser testing using Cypress

Cypress Logo
  • OVERVIEW
  • Languge: JavaScript
  • IDE: VSCode
  • Runner: Cypress Runner, called from NPM
  • Source Code Management Tool: Github via Github Desktop
  • Type of Tests: UI / Web browser automation
  • Websites Tested: Opencart and todomvc

Intro

This blog continues my journey of creating a test automation portfolio, which I started back in at the start of August (aka that time when it was occasionally sunny and not just bleedin damp and cloudy all the time!). This time I wanted to talk you through my exploits using the increasingly popular web browser end to end automation tool Cypress. I’d heard quite a few people say this tool was easy to pick up with lots of great documentation, so I thought I’d give it a go.

The Project

By now you won’t be surprised to hear that I did what lots of folk, both experienced and newbies do when starting using a new tool – I magpied, and yes, that is an actual noun, who knew! My sources of information including code were:-

Gil Tayar’s “An Introduction To Cypress” Tutorial on Test Automation University (note this was created a few years back and some features of the tool e.g. cross browser execution have moved on since, code base is still solid though)

Marie Drake’s wonderfully easy GitHub Repo On Cypress Fixtures and Login Example Code

Toby Steed @ Learn Automation’s series on Cypress including a very handy cheat sheet

I decided to focus on two learning sites – todomvc as per the original TAU course material, and Opencart’s demo website, as this gives lots of scope to add new tests in future as my familiarity with the tool grows.

Key Features

I wanted to develop what was already in the repo to support my learning by:-

  • Install the original repo from the TAU course, and get it up and running.
  • Get the existing tests to run
  • Add in Marie’s login tests
  • Refactor them to work against the Opencart website
  • Add in a few new ones based on the extensive Cypress docs and Toby’s cheet sheet
list of key features from the Cypress Website

I did indeed find Cypress an easy one to pick up and get working, a few NPM commands from within the VSCode terminal is all it took. There aren’t any libraries to import as cypress takes care of this for you, as well as adding a load of useful example code. So far so good.

Another handy feature, although I’m told its not the best idea to rely on this exclusively, is using the Selector playground to identify and copy Cypress elements – or even the full Cypress command – which can then be inserted directly into your code. Tidy. Here is a video:-

video of using Cypress Selector Playground to identify elements

As far as the code itself goes, its a new syntax to get used to, but fairly readable, and adding the reference types code at the top of the page ensures if you do get stuck examples are only a hover away:-

/// <reference types="cypress" />

describe('todo actions', () => {
    beforeEach(() => {
        cy.visit('http://todomvc-app-for-testing.surge.sh/');

        cy.get('.new-todo', {timeout: 6000}).type("Clean room{enter}");
    });

    it('should add a new todo to the list', () => {
    cy.get('label').should('have.text', 'Clean room');

    cy.get('toggle').should('not.be.checked');

});
code screenshot showing cypress help shown when hovering over a command e.g. “visit”

The Code

I tried to learn from my earlier mistakes here, and just started my own repo from scratch. I am really getting used to the Github Desktop app, which personally I prefer to the new CLI.

You can take a look at my code on GitHub here.

Here’s a visual of the key elements:-

screenshot of VSCode showing key features of my Cypress codebase

To run the tests, simply go to the terminal window (terminal -> add) in VSCode, navigate to the correct folder and type

npx cypress open
screenshot of terminal window with npx cypress open command

This then brings up the in-built Cypress testrunner, which is a nice UI interface you can use for execution. I tested the code against a number of browsers by using this dropdown and selecting the relevant spec (Firefox is now officially out of beta as per release 5.3.0):-

selecting to execute tests in Chrome, Firefox, Edge, Electron Browsers

This video shows me executing the login tests using Cypress UI. Take a look at the very clear step by step results panel on the left hand side which you can actually use to rewind through the history of your test execution to see what was happening at each step, which is another user-friendly feature:-

A video of the login tests executing against opencart – note failure is correct as incorrect details did not prevent login

Lessons Learned

The more I work on this stuff, the more I see appreciate that getting a framework off the ground is the easy bit. The hard part comes when refactoring tests, and coming up with a structure to make them as maintainable as possible – also doing those tricky edge cases which take up 80% of your time but are only 20% of your tests.

Just one last repo to create, and I’ve saved it til last on purpose, Selenium Webdriver.

Wish me luck!

Creating A Test Automation Portfolio Episode 4: API testing for Restful Booker using Postman

Intro

This blog continues my journey of creating a test automation portfolio, which has been ongoing for a few months now. Although I’ve covered API testing in an earlier post, I wanted to include Postman as the tool of choice, partly because its something we use at work, partly because I want to get better at it and partly because its such an industry leading tool.

I’ve already had a go at using a Newman call to run a Postman collection through the Microsoft DevOps Azure CI Pipeline – you can check out the code for that here as I won’t be referring to it again in this post. I find terms like DevOps and CI a bit scary when I read them in blogs, and I don’t want to put you off reading on, Postman is a super simple one to start with I promise!

Postman Image

The Project

I continued my magpie tendency and avoided reinventing the wheel by Googling “Postman tests for Restful Booker API” and hit gold with an amazing GitHub Repo from Joanna Denni. She had created a really great and easy to read repo with some excellent README instructions.

The great thing about the pretend hotel booking website Restful Booker is there is a limited number of really clearly documented API endpoints, so its easy to get a good amount of test coverage, and practice testing GET, POST, PATCH, PUT as well as DEL calls. Mark Winteringham (its co-creator) recently tweeted about the sheer number of requests which are sent to the public server, so there must be plenty of other people learning in this particular sandpit.

Tweet from Mark Winteringham About the Popularity of Restful Booker

Key Features

I wanted to develop what was already in the repo to support my learning by:-

  • Install the original repo, and get it up and running.
  • Get the existing tests to run (very straightforward, also includes pre-request script examples which is v. cool)
  • Add in a few new tests from scratch including MOCKs, randomised response variables and params
Example set of tests for a GET endpoint and below actual code snippets (for improved accessibility)
pm.test("Status code should be 200 OK", function () {
    pm.response.to.have.status(200);
});
pm.test("Response Content-Type should be json", function () {
    pm.response.to.be.json;
    pm.response.to.have.header("Content-Type", "application/json; charset=utf-8");
});
pm.test("Response should contain at least one bookingid", function () {
    var jsonData = pm.response.json();
    pm.expect(jsonData[0].bookingid).to.not.be.null;
    pm.expect(jsonData[0].bookingid).to.be.a('number');
});

Here is a video of the tests successfully passing against the public Restful Booker site when executed via a Postman Collection Runner. I did 2 iterations which gave me 130 test passes in just a few seconds – not bad eh!

Video of test execution using Postman’s Collection Runner

The Code

I’m still learning the inner circle workings of GitHub, so I have a lingering doubt that I’ve gone about this in the wrong way, but this time instead of forking my own branch I took the original code and generated pull requests for my additional work. The code can be found here:-

https://github.com/joannalaine/postman-restful-booker/pulls

Pull Requests demonstrating the additional work I have added to the original brilliant repo

Lessons Learned

I think the idea of “API” testing is massively offputting to a lot of people, because it feels super techy and “backend”. In reality, particularly when using Postman, I’ve found it way simpler than a lot of UI type automation. It is also very maintainable once you know what you’re doing with variables etc. Feel free to use this code as an example to get you started!

The other thing I’ve found about Postman that I love is the amazing amount of online help available. The Postman learning center is great, and a big shout out to the incredible Danny Dainton, who has helped me out a tonne too.

I’m now over half way through my Test Automation Portfolio, which is a pace I’m really happy with. Yaaaaaaaaay.

Onwards!

How can we help you develop your career in the next 12 months?

If you were asked this by your boss, do you know what you would say?

Its a question that’s been posed to me this week, and I’ll admit I’ve been a bit stumped by it. When jobs seem scarce on the ground at times, just keeping hold of mine has felt like enough. But I’m northern, and if a gift horse is on the loose I’m not likely to be asking it to open wide and say “ahhh”. :o)

Would you ask for something reasonable and achievable, or go for broke and ask for something bonkers hoping you’ll meet in the middle somewhere? Would you say you want to learn something that you’re interested in, something which may advance your career, or something that will help your employer? Have you been asked this before and wished you’d have given a better answer?

Tweet or DM me @Beth_AskHer with any insight you have on this.