Tuesday 12 May 2020

Parametrize pytest with custom class

Some times while using pytest we may end up in situation where we would like to pass a class object for assertion.
In some of situations i have come across , i used the same principal for invoking custom functions inside a module.

Below example simplify the process of passing a parameter to a pytest. This object could have n number of properties a savior when you have more then 7 parameters passed to the pytest function.


The below test code will generate 10 tests and pass random values to the class object.

Later inside pytest the passed values will be asserted.


1  Create a test class


2.  Create a list to hold random generated objects and set values of each property with a random values from a list.


3. Create a pytest with marker parametrize and pass the object list .

Monday 11 May 2020

Git Cherry pick simplified

This tutorial is written to unleash how to be hands on with Git Cherry pick. As a Prerequisite you may require git installed on your computer. The below demo is performed on Window 10  and show case  cherry pick using command line .

Please note cherry pick only brings changes under a commit.



1. Start by creating a empty folder named as cherry-pick


2. Initialize the git repository by using command : git init



3.  Create a empty file using touch command . Add the file and commit it to the master branch.


4.  Create a new branch and name it as newbranch and add two files to it using separate commits.



5.  Copy the Hash of the last commit identified by using git log command.



6. Check out the master branch and use the command git cherry-pick with the hash copied in step 5


7. You will notice that the third file will be added to the folder as we cherry picked the last commit.


8.  Repeat step 5-6 with the second last commit in the new branch.


9. You will see that after applying step 8 the second file will appear before the third file.







Apache Beam Learning In Java Tutorials

 Wow  https://youtu.be/9kGETU63rkc