8.4.24

Payment Gateway Testing components:-

E-comm Payment Gateway Testing:-


Payment Gateway vendors:- 

CyberSource( It also Supports TAX calculator)

authorize.net

Spring Citi

Integration Guide (citi.com)

Note:- CyberSource & Authorize.net both are VISA Companies



Payment Methods:-

Credit cards

Paypal: 

https://www.paypalobjects.com/en_AU/vhelp/paypalmanager_help/credit_card_numbers.htm

Google Pay

Apple Pay

Klarna

with & without 3DS authentication

TAX Calculator:-  VERTEX

4.11.22

Cypress Cucumber Setup

 


Install the plugin by running:

$ npm install --save-dev cypress-cucumber-preprocessor


Running Cucumber feature file with TAGS like @Smoke & @Regression:

$ npx cypress-tags run -e TAGS="@Smoke" --headed --browser chrome

26.10.22

Cypress.io Imp CMD's

$ npm -i init :  to create package.json file

$ node_modules/.bin/cypress open :  to open the test runner

Cypress run commands:- can use either of the below 4 commands

$(npm bin)/cypress run
./node_modules/.bin/cypress run
npx cypress run
yarn cypress run


Cypress run commands for 1 test case:-

$ npm run cy:run -- --record -- spec "cypress/integration/myspec.js" 

by default all test cases from cmd line runs in headless mode. if needed to run in browser? need to mention --headed in the end of cmd.

./node_modules/.bin/cypress run --headed                                    $ npm -i init :  to create package.json file

if we need to run spec's in specific browser we can specify that in cmd.

$ ./node_module/.bin/cypress run --browser chrome

$ ./node_module/.bin/cypress run --browser edge


Cypress framework folder structure:

fixture: for storing data in json or excel files.

Integration: for writing test spec's

Plugins: for setting browser settings like full screen, to handel cypress listeners events.

Support: customize cmds,  reusable methods, basically used to build POM

Videos: it stores the latest execution proofs of test specs


CMD to install mocha:-

$ npm install --save-dev mocha

CMD to install mochawesome reports:-

$ npm install --save-dev mochawesome


CMD to install IFrame in Cypress:

npm install -D cypress-iframe

CMD to override the execution url from terminal:-

$ ./node_module/.bin/cypress run --spec cypress/integration/UI/TestFramework1.js --env url=https://rahulshettyacademy.com/angularpractice/shop --headed

CMD to run scripts and have results in dashboard:-

npx cypress run --record --key <"your respective project key from dashboard">


22.9.22

Jenkins

Connect VM machine

Connect through SSH

 Jenkins installation:-

$> sudo apt-get update.

$> sudo apt install openjdk-8-jdk (OR) sudo apt install default-jdk

$> wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key |  sudo apt-key add -

wget --no-check-certificate -qO - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -

$> sudo sh -c 'echo deb https://pkg.jenkins.io/debian-stable binary/ > \
/etc/apt/sources.list.d/jenkins.list'
$> sudo apt-get update
$> sudo apt-get install jenkins




sudo su - ubuntu

sudo apt-get update


20.9.22

GIT commands

 Working Directory:-

  • Project folder resides in your system.
  • It may or may not be tracked by Git.
  • Git tracking is initiated by "git init", it automatically creates a hidden .git folder.

Staging Area:-

  • Once you are in working directory , we have to specify which files are to be/not tracked by mentioning in the gitignore.
  • Some of the temp files need to be ignored which don't need to be tracking.
  • To add files into staging area, we "git add".

Commit:-   

  • Once files are moved into staging , we can commit them to repo, until it's not commited to git its not saved in repo.
  • "git commit -m "code change message".
  • Commit id will be generated once you commit any thing, to manage versioning.


Github:-

  • Once code is committed to your local repo, we need to publish it to remote server.
  • "git push"
  • commit id will help in revert the code to previous version.
  • A pointer to latest commit is called HEAD.


Master branch & Feature Branch.



git setup in GCP, Ubuntu instance:-

  • check if git is already exists?  git --version.
  • "mkdir  git_demo" : create a folder for repo.
  • ls -ltr and ls -ltra(hidden files)
  • run "git init" to track changes in this folder
  • "ls -ltra"
  • "ls -ltr .git"
  • "cat .git/HEAD" will show the head pointer.
  • "git status" to track/see the changes in repo.
  • "git add ."  this add all the files in the current directory to tracking, "." mean current directory files, no hidden files will be added for tracking.
  • "git rm --cached <file>..." to unstage/remove files.
  • "git config --global user.email xyz@gmail.com"
  • "git_demo$ git config --global user.name xyz"
  • "git remote add origin https://github.com/xyz/GitRemoteRepoTest.git"
  • "git push"
  • "git push origin master". enter username"xyz" and personal access token.
  • Refer:- https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token

Cloning a Repo:- 
  • Go to github and copy the url for clone "https://github.com/xyz/GitRemoteRepoTest.git"
  • "git clone https://github.com/xyz/GitRemoteRepoTest.git" run this command in new folder for creating the git repo.
  • git pull https://github.com/xyz/GitRemoteRepoTest.git ( to pull updated changes from repo).
GIT Branching:-

  • "Git branch <anybranch name>".      to create new branch
  • git branch.                                          to list the branches
  • git checkout <newbranch name>.    this will make HEAD point to new branch.
  • git log --graph --pretty=oneline
GIT STASH:-

git stash -u
git stash pop

GIT REVERT:-

git revert <commit id>

GIT DIFF:- To find difference between two versions of the file.

git diff <commit id>


MERGING BRANCHES:-

Git Merge:

git merge <source branch name/feature branch name>    run this cmd from the master branch.

Git Rebase:

It's more used to get the latest master branch code to feature branch, once after the feature branch code is tested and merged into master branch.  it helps the feature branch to rebase the latest code from master.

1. "git checkout <featurebranch name>"      2. "git rebase master"






19.9.22

Useful Cypress commands

 

1. To Run Single test :

npx cypress open --config testFiles="/Users/rajeshvarma/Documents/CypressProj/cypress/integration/UIScripts/tc1.spec.js"    ---------------------------------------------------------------------------------------------------------------------------  

2. To run cypress multiple test cases option:

npx cypress open

---------------------------------------------------------------------------------------------------------------------------

3. crossbrowser testing:-

$ npx cypress run --browser chrome --spec “cypress/integration/examples/tests/e2e_test.spec.js”

update package.json file with below entries for crossbrowser:

"scripts": {
"cy:run:chrome": "cypress run --browser chrome",
"cy:run:firefox": "cypress run --browser firefox"

}

---------------------------------------------------------------------------------------------------------------------------

4. Cypress reporting:-

$ npm install mochawesome.   OR.      $ npm install junit

 update cypress.json file with below entries :-

{
"reporter": "mochawesome",
"reporterOptions":
{
"reportDir": "cypress/results",
"overwrite": false,
"html": true,
"json": true
}

}



$ npx cypress run --reporter mochawesome --spec “cypress/integration/examples/tests/e2e_test.spec.js”



Cypress.json config file for JUnit:--

{
"reporter": "junit",
"reporterOptions":
{
"reportDir": "cypress/results",
"mochaFile": "results/my-test-output.xml",
"toConsole": true
}

}


$ npx cypress run --reporter junit \ --reporter-options “mochaFile=results/my-test-output.xml,toConsole=true”

---------------------------------------------------------------------------------------------------------------------------







22.8.18

API status code assertions



S-1: Status Code Assertion:-




S-2: Access Points Parameterization:-




Define access points as below




S-3: Payload – Parameterization

Define payload parameters at test suite level and refer them in pay load



S-4: Path Parameterization:-

Define property at test suite level and do the following in the request tab


S-5:Data Driven Testing:-

Add data source



Add Data source loop




Create XL – file as below





Define File path and sheet name and on run in configuration section





It will load the data as below




Click on Rest request à Form see the navigation


Request will be modify as below





S-6:Validate the response using script:-
import groovy.json.*

//grab the response
def ResponseMessage = testRunner.testCase.getTestStepByName("Req1").getPropertyValue("response")
def qa = new JsonSlurper().parseText(ResponseMessage)

//verify the slurper isn't empty
assert !(qa.isEmpty())
def arr = qa.id

//verify the Id, Type and Guid aren't null
log.info (qa.id)
log.info(arr.size())
//log.info(arr.sort())
assert qa.id!=null
assert qa.location!=null

for (int i=0;i<arr.size();i++)
{
                  log.info(arr[i])
}

S-7:- Convert XML to Json response and compare with expected values
//def response = context.expand('${Request 1#Response}')
//def User = new XmlParser().parseText(response)

import groovy.json.JsonSlurper
def response = context.expand( '${TryAddingAPIWithNewService#Response}' )
def slurper = new JsonSlurper() 
def result = slurper.parseText(response)
def errorMessageWhenAddingAPIWithNewServiceDisabled = result.faultstring.toString() 
log.info errorMessageWhenAddingAPIWithNewServiceDisabled

assert errorMessageWhenAddingAPIWithNewServiceDisabled == "The feature for adding an API or API version with new service is disabled.  For assistance, please contact the Site Administrator."

S- 8: Concatenation




S-9: Test Suite Report:-
Click on below icon to generate common reports and click on ‘Ok’.



Following report will be generated





S-10: JsonPath Match - Verifies the value specified by a JsonPath expression matches some expected value



Click on ‘Select node from to validate from current page’ and select any node. Click on ‘Ok and Save’




Assertion is passed as expected




S-11: JsonPath Existence Match - Verifies the element specified by a JsonPath expression exists in the target JSON




Click on ‘135’,





Click on ‘Save’ and send request