Search This Blog

Friday, April 5, 2019

Postman integration with Jenkins

Postman contains a full-featured testing sandbox that lets you write and execute JavaScript based tests for your API. You can then hook up Postman with your build system using Newman, the command line collection runner for Postman.
Newman allows you to run and test a Postman Collection. Newman and Jenkins are a perfect match. Let's review these topics to set up this operation.
Note: We are using Ubuntu as a target OS as in most cases your CI server would be running on a remote Linux machine.

Installation

Install NodeJS and npm. Newman is written in NodeJS and we distribute the official copy through npm. Install nodejs and npm for Linux.
Install Newman globally, to set up Newman as a command line tool in Ubuntu.
$ npm install -g newman

Run a collection in Postman

We assume you already have a Postman Collection with some tests. Run the collection in the Postman app. Here's an example of the output in Postman’s collection runner.
collection runner
Some of the tests are failing intentionally in the screenshot so we can show you the instructions for troubleshooting.

Run a collection using Newman

Run this collection inside Newman, using the command below. If everything is set up nicely, you should see the output below.
terminal output from collection run

Set up Jenkins

Jenkins exposes an interface at http://localhost:8080.
jenkins interface
Create a new job by clicking on the “New Item” link on the left sidebar > Select a “Freestyle Project” from the options > Name your project.
new Jenkins job
Add a build step in the project. The build step executes a Shell command.
execute shell command
Here is the command:
$ newman jenkins_demo.postman_collection --exitCode 1
Note here that we are using the Newman command parameter “exitCode” with the value 1. This denotes that Newman is going to exit with this code that will tell Jenkins that everything did not go well.
Click the Save button to finish creating the project.
source code management

Troubleshooting

Run this build test manually by clicking on the “Build Now” link in the sidebar.
run build
Jenkins indicates that the build has failed with a red dot in the title. We can check why with the console output from Newman.
build failed message
Click the “Console Output” link in the sidebar to see what Newman returned.
console output
Fix these tests inside Postman and then try again.
collection runner view
You can move on once you see green pass icons for all your tests like the screenshot above.
console output for all tests pass
Jenkins indicates that the build succeeded with a blue ball.

Configure frequency of runs

To set up the frequency with which Jenkins runs Newman, click on “Configure project” in the main project window and then scroll down.=. The syntax for setting the frequency is H/(30) * * * *.
build triggers
Note: 30 can be replaced with another number.
Jenkins will now run Newman at your desired frequency and will tell you whether the build failed or succeeded. In a bigger setup, Newman will be part of your build process and probably not the entire process. You can set up notifications and customize Jenkins as per your needs.
You can use a wide variety of other configurations to make your collection more dynamic. 

Tuesday, March 26, 2019

SDET Unicorns – Why is it so Hard to Hire SDETs?

SDET, also known as Software Development Engineer in Test, is a job role within Software Testing and Quality Assurance Domain. The term was originally used by Microsoft and then Google with a view of replacing mundane and repetitive manual testing task with automation.
Over the years, more and more companies are hiring SDETs as it’s a pivotal role in Agile and DevOps. However, it’s a challenging role to fill.
Technology changes very quickly and testers need to learn a lot to stay ahead of the game.
This post talks about the role of an SDET and why unicorn SDETs are difficult to find.

What Does an SDET do?

An SDET is a technical software tester with a focus on developing automated test scripts.
Typically, they are part of an agile team and work alongside developers to help automate Acceptance Criteria in user stories.
As well as participating in typical QA activities, they can write anything from automated integration tests, API tests and/or UI automation tests.
In addition, SDETs could help review unit tests which are written by the developers.

Why SDETs are Needed?

In every product, there are some core features which must be functioning on every release of the product. This means that in every sprint, new features plus existing functionality must be tested.
Agile development is fast-paced. With short sprints, which are typically 2-weeks long, testers don’t have the time to test everything manually.
When testers in a team don’t have the required skills to write automated checks, all testing has to be done manually.
Ultimately, testing becomes a bottleneck to the development and release of software because it will take longer and longer to complete.
Therefore, hiring and placing SDETs in an agile team can alleviate the burdens by automating much of the manual tests and tasks.

Interviewing and Hiring SDETs

So, why is it so hard to find and recruit good SDETs?
Over the years, the majority of so-called SDETs that I have interviewed either lack the required technical skills or have no comprehension of QA and testing principles.
They don’t fully understand the main reason for the role of SDET in a team. Most come across with the assumption that all they’re required to do is to automate acceptance criteria. Let’s be clear, an SDET is NOT an automation engineer.
Having the right balance of testing aptitude and technical skills is the key thing.
A great SDET is a software tester by trade, is passionate about software quality and at the same time is tech-savvy and has the right mix of technical skills.
When interviewing for SDETs, I always look for QA Mindset and Technical Skills.

SDET Profile – Full-stack Testers

What does the profile of a great SDET look like? What skills should SDETs have?
Now, some of us have heard of full-stack developers, but can we have full-stack testers?
In my opinion, an SDET should have at least the following skills and attributes:
  • Has a tester mindset, is curious and can come up with interesting test scenarios
  • Has a solid understanding of testing principles and methodologies
  • Knows that all testing is exploratory in nature and appreciates the difference between testing and checking.
  • Can apply appropriate test methods for a given scenario
  • knows the difference between testing and QA
  • Can code in at least one scripting or programming language (Java and Javascript happen to be the most popular)
  • Understands HTTP and how modern web applications are built
  • Can write UI as well as API automated tests. One or the other is not good enough!
  • Knows Git, Pull Requests, Branching, etc…
  • Is agile in nature and knows how testing fits in the agile model
  • Can write performance test scripts (Gatling and/or JMeter)
  • Thinks about security and is aware of OWASP
  • Understands CI/CD and Build pipelines
  • Knows the services offered by cloud platform providers such as AWS, Azure and Google Cloud

Becoming a great SDET

As can be seen, the range of skills expected of an SDET is quite broad.
My advice to testers who want to become SDETs and remain relevant in the new age of QA is:
Ensure you work towards having all of the above skills in the SDET profile, but as a minimum:

Know and understand the fundamentals of testing

First and foremost, know the foundations of software testing.
It is all too well to be on par with developers and able to write beautiful code. But if you lack the QA mindset, if you can’t come up with enough scenarios to test user stories and features in depth, then you’re not adding any value. You might as well work harder and become a developer.

Know and understand HTTP

Most modern web applications interact with APIs.
It is essential to know and understand HTTP architecture and how the web works. If you can’t differentiate between a POST request and a GET request or don’t know how to parse JSON, then how can you effectively test an API?
Invest time in learning API testing tools.
You can’t call yourself an SDET if all you want to do is automate tests and all you know is Java and Selenium and God forbid Cucumber!

My Profile

My photo
can be reached at 09916017317