Posts

 I worked on UI Automation using Cucumber, Java and Selenium in a company ( company name hidden due to confidentiality agreement). After creating the framework completely, when it was time to deploy to pipeline, I found we don't have devops team in the company. The devs were helping out by doing devops work in addition to their normal duties. They explained that they can help with C# code ( basically .Net core deployments into agents), but could not help maintaining agents which run JVM ( for Java code). It was time to switch to C#. I found Specflow is a C# implementation of Cucumber and we need Visual Studio ( Professional at least) to continue the work. The management at the highest level were very supportive and they were willing to spend the money and give me all the support to rewrite the entire framework in C#. It was time to make Automation a success in the company. And it was going to be more thrilling than any movie we can imagine with all the twists and turns.

Finding a particular file when coding in IntelliJ

Image
  When working on the Mac and coding in IntelliJ, sometimes you see an error in the console, and it gives the file name. If you want to open the specific file (instead of searching a particular text in all files), use this shortcut instead. Alternatively, if you are in the finder window and want to go to a particular folder, you can always press "Cmd + shift + G" and paste the path in the dialog box.

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