Posts

Showing posts from 2018

Accessing your historical bash commands instantly !

As a tester, you might be testing several systems and each have different commands. A common interface might be the bash shell. How do you get all the previous commands you typed in bash before? Once you close the bash command? I struggled with this for a few days, and even wrote down commands in notepad, so that i can use them later. Later, I wondered how easy my work would become if i could type the first word of my command and i could search through my bash history. The problem Lets say, i used the following command a few days ago to encrypt a file using gpg. $ gpg --encrypt -r < > REGISTER.ABCD.01102018.917.csv   Today, I want to encrypt a new file. I know I used gpg before, but I don't remember the exact syntax.  So I want to type gpg in my command prompt and then use my arrow keys "up" or "down" to search through my bash history. Solution Add the following two lines to your  ~/.inputrc "\e[A": history-searc

API Testing with Rest Assured - Validating the json schema

Image
Sometimes you would get a json response while testing web applications. To make sure that all fields are present, but at the same time keeping the tests generic, you might write something like this given below.(although, a newbie way of writing tests)  @Category(RegressionTests.class)     @Test     public void verifyResponseByValidatingPresenceOfAllFields() {         given().                 param("product", "HomeLoan").                 param("fromHomeLoanId", -100).         when().                 get("/loans").         then().                 statusCode(200).                 contentType(ContentType.JSON).                 body(containsString("loans")).                 body(containsString("loanId")).                 body(containsString("businessId")).                 body(containsString("country")).                 body(containsString("statements")).                 body(contai

Build pipeline with Jenkins

Image
Jenkins pipeline with different stages Currently, we are using Jenkins for one of our projects. It is possible to have multiple stages in your jenkins to address the different areas of your testing like End to End testing, UI Testing, API Testing, Integration testing. Here is the current pipeline.

Adding validation to a field and tested using mockMVC

The controller class (controller.java) has this code. if (farmerIds.contains(farmerId)) { farmerUnionRequest farmerUnionRequest = new farmerUnionRequest(farmerId, customerId);                 String encryptedRequest = encryptor.encrypt(StringUtil.toJsonString(farmerUnionRequest));                 response = redirectService.getConfirmAccountResponse(headers, ImmutableMap.of("encryptedUnionId", encryptedRequest));  } else {             LOG.warn("Unknown farmer id: {}", farmerId);             response = new ResponseEntity("Unknown farmer id", BAD_REQUEST);          } I noticed that there is another main field called customerId and it is not checked for null or empty. I changed the controller class like this. if (farmerIds.contains(farmerId)) {             if (!customerId.isEmpty()) { .  / / isEmpty takes care of null as well as empty                 farmerFeedRequest farmerFeedRequest = new farmerFeedRequest(farmerId, customerId);          

Squashing the merges

When you want to merge into master, sometimes you want to squash all your commits (for that branch), so that they appear as a single commit on master. You will always go into master and pull the changes from the branch. Here are the git commands for you to do it. Say your bug fix branch is called  fixedAllBugs  and you want to merge it into  master : git checkout master git merge --squash fixedAllBugs git commit

Setting up IntelliJ IDEA for the first time and connecting to github

After installing IntelliJ IDEA, if you try to access "Check out from Version Control - GitHub", you will get the following error. "Unable to find git.exe This is due to git not being installed as part of the IDE installation. Go to this url => https://git-scm.com/downloads and download the file as per your operating system. Afterwards, if you do the same action on IDE, you will be able to connect to GitHub.

Webdriver io - Part 1

I have been using webdriverio to run selenium ui tests. When I joined the project, i found the code in the following format. I will provide a brief overview of the improvements I did, to make the code more readable and maintenable. It could help people who are joining projects with existing code bases and need to continue working on them. The sample code provided below has been changed so that it is anonymous, but is still useful for instruction purpose. describe('Loan Application UI', function () {     var infoTextElement, YellowBtnElement, RedBtnElement, contactElement, landingPageTextElement,         RedSignInBtnElement;     infoTextElement = 'h3';     RedBtnElement = 'button:nth-child(3)';     YellowBtnElement = 'button:nth-child(2)';     landingPageTextElement = 'h2';     RedSignInBtnElement = '#LoanApplicationSelected>div>button';     contactElement = '#BizDetails > div:nth-child(2)';     userLog

Using git

In the current scenario of software development and testing, git has become a core component in many projects. Being truly distributed and free, it is one of the best open source distributed version control systems. Here are a few commonly used commands of git. git status: Gives the current status. C02VM0HWHTD8:Beepy manoj.tharayil$ git status On branch 1712_Create_UI_tests_for_ledger_endpoint git stash:  Saves all your changes so that you can work on a fresh ( current) copy which is in server. C02VM0HWHTD8:Beepy manoj.tharayil$ git stash Saved working directory and index state WIP on 1654_Create_api_tests_for_ledger_endpoint-review: 67635081 #1654: Review comment regarding formatting fixed. IDE's have UI for committing and pushing your changes to git server. But if you want to do it from command line, the command is given below. git commit: C02VM0HWHTD8:Beepy manoj.tharayil$ git commit On branch 1712_Create_UI_tests_for_ledger_endpoint nothing to commit, wor