Skip to main content

Posts

Working Set feature in Eclipse and other IDEs

The "Working Set" is a very old feature in Eclipse or other IDEs but there are many folks who don't use it and prefer to hide non-working project(s) by either closing the project(s) itself or deleting those from workspace especially when they have to demo something to someone. It is a super useful feature that lets you group your related projects to ease search and organize views within the IDE. Read here about what it is and how to use it: http://www.avajava.com/tutorials/lessons/what-is-a-working-set-and-how-do-i-use-it.html

JSON to POJO

In case you have JSON or JSON-Schema (simple or complex) that you want to map into a POJO without hustling too much to write a complete POJO class, then you can use the jsonschema2pojo UI or library. It is an awesome library that lets you create Java classes using your input JSON. Plus, it supports many Annotation styles such as Jackson, Gson, etc. Using UI: http://www.jsonschema2pojo.org Or https://github.com/csanuragjain/extra/tree/master/convertJson2Pojo (Git Repo by Anurag Jain) P.S. There are many other ways to achieve this and this is just one of them.

Benefits of running your automation suite

In the agile world, the deployment window will continue to grow narrow and for sure you can’t catch every bug- so, always use the power of both i.e. on-demand (including webhook on every change) and scheduled automation test suite run.  On one hand, your on-demand test run will make sure that you get fast feedback (i.e. which change and by whom broke it) and also you will get the complete test coverage. And, on the other hand, your scheduled runs ensure that you get continuous feedback, don't push any broken pieces to the next environment and hence confidence in your code changes especially after the integration with the larger system(s). Keep your builds green (Organically).

Copy paste java code from clipboard to your Eclipse

Small but a cool and an old trick for copy-pasting Java code in Eclipse. I have seen so many folks are still doing this when they want to copy-paste the Java code from the net via clipboard in their Eclipse. >Right click on the target folder where you want clipboard Java code >New >Create Class >Give a name and then finally remove the default code in this class and paste the Java code from their clipboard. You don't need to do all this. Just Right-click on the target folder where you want this Java code and paste from the clipboard or directly CTRL+V. Nice- isn’t it? Sample code: package com.test.apiAutomation.test; import java.util.HashMap; import java.util.Map; import org.testng.annotations.Test; public class TestCopyPaste { @Test public static void testCopyPaste() { Map<String, String> formParams = new HashMap<String, String>(); formParams.put("grant_type", "hey"); System.out.println("It's working, TADA

Want to read something of your gmail (not only subject but body content too) using javax Lib?

Want to read something of your Gmail (not only subject but body content too) using javax Lib? For contentBody where MimeType is "text/plain" i.e. it's a plain text message, it works straight forward by using getContent() method but in case you have contentBody MimeType= text/html i.e. the message body only in HTML, you need to take care of Multipart for multipart/alternative and multipart/mixed based on your requirements. Here's the working code: Note * You still need to tweak the code based on your requirements like if there are more than 1 unread or read emails having the same subject that you are trying to look for in the subject like by setting Flags.Flag.DELETED=True before reading this new email or using Flags.Flag.RECENT=True. You may need to enable less secure apps to use JavaMail with Gmail: https://myaccount.google.com/lesssecureapps // userName is your gmail userName // password is your gmail password // subjectToContains is what you need to lo

Accessibility testing: Chrome DevTools

Though there are specifically designed tools like NVDA, Jaws, etc. for accessibility testing but if you would like to perform a quick Accessibility test on your website for below mentioned P1 checks, please go through this link : https://developers.google.com/web/tools/chrome-devtools/accessibility/reference - The user is able to navigate through the page with a keyboard or/and screen reader? - Are the page(s) elements properly marked up for screen readers?

JSON Server: Rest API

I get that a lot that there are so many folks especially college students who struggle to find Rest APIs where they can play not only with the GET but with POST, PUT, DELETE methods too. The JSON Server is a popular and handy tool that lets you play with the mock REST APIs. It helps you to set up a REST API with CRUD operations very fast. Please go through this link to know more about it: https://github.com/typicode/json-server From set-up >> installation >> usage- everything is so simple. I recommend to use it along with the faker library to make it more effective: https://github.com/Marak/faker.js , like by creating a js file to inject the fake data: module.exports = () => { var faker = require("faker"); const data = { users: [] } // Create 50 users for (let i = 0; i < 50; i++) { data.users.push({ id: i, name: faker.name.findName(),email:faker.internet.email(), zipCode: faker.address.zipCode()}) } return data } Here's th