Skip to content

Instantly share code, notes, and snippets.

View PramodDutta's full-sized avatar
🎯
Focusing

Promode PramodDutta

🎯
Focusing
View GitHub Profile
@PramodDutta
PramodDutta / 00002CodeFixed.py
Created September 5, 2024 02:53
00002CodeFixed.py
class Calc:
def __int__(self):
print("DC")
def sum(self, a, b):
return a + b
def sub(self, a, b):
return a - b
class Calculator:
def __init__(self, a, b):
self.a = a
self.b = b
self.add = self.addition()
self.sub = self.subtraction()
self.mul = self.multiplication()
self.div = self.division()
def addition(self):
@PramodDutta
PramodDutta / EncapsulationExample.py
Created September 5, 2024 01:24
EncapsulationExample
class MyClass:
# Public variable
public_var = "I am public."
# Protected variable
_protected_var = "I am protected."
# Private variable
__private_var = "I am private."
@PramodDutta
PramodDutta / What is Test in APIs?.md
Last active August 30, 2024 10:48
What is Test in APIs?

What To Test in APIs?

  • Test nulls and empty strings, these have a habitat of causing issues ;).
  • Test with Unicode characters, ensure they are correctly saved to the database.
  • Test mandatory and optional parameters, in particular test with just mandatory values.
  • Ensure correct status codes are returned, you will find false positives e.g a 500 being returned as a 200.
  • Functionality Bugs: the test looks for missing functionality bugs
  • Reliability Bugs: API testing helps identify bugs pertaining to integration across different systems
  • Performance Bugs: The tests help determine how much traffic the system can handle before being overloaded, and how to expand - infrastructure to meet rising demand at the core, but also are very effective at pinpointing weak points in the API
  • Security Bugs

Shallow and deep copies are two methods of duplicating objects in Python, particularly useful when dealing with complex data structures like lists and dictionaries. Here’s a detailed comparison between the two:

Shallow Copy

  • Definition: A shallow copy creates a new object but does not create copies of nested objects within the original object. Instead, it copies references to those nested objects.

  • Behavior: Changes made to nested objects in the shallow copy will affect the original object and vice versa because both share the same references to the nested objects.

  • Implementation: You can create a shallow copy using the copy() method or the copy module's copy() function.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n"/>
</Console>
<File name="FileLogger" fileName="logs/test.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1} - %m%n"/>
</File>
</Appenders>
@PramodDutta
PramodDutta / TestFrameworks.md
Last active July 29, 2024 02:42
Why API & Web Automation Framework ? (Setup)

Why API & Web Automation Framework ? (Setup)

  • Can we write all the code in single python file and this is what we call automation?
    • No
    • High Maintenance
    • Code duplicated.
    • Properly Maintenance code it will difficult to maintain such a large files /files.
    • Not scalable -> TC 10, tc 100, TC 1000, TC 10,000 -> Impossible to maintain this.

What is the Framework?

A framework is a **structure **that provides a foundation for developing software applications / testAutomation.

package com.thetestingacademy.tests;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.edge.EdgeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.time.Duration;
@PramodDutta
PramodDutta / POMSTMANCreate.js
Created July 19, 2024 02:22
POMSTMANCreate.js
pm.test("TC1 Verify the booking Id is not Null",function(){
var response = pm.response.json()
console.log(response)
// Expected Result = Actual Result
//response["bookingid"] = null;
pm.expect(response["bookingid"]).not.equal(null)
});
@PramodDutta
PramodDutta / Javascript_Overview.js
Created July 19, 2024 02:04
JavaScript Learning
// // Javascript - Overview
// // console.log("Hello Wolrd, JS");
// // // ; is optional in JS
// // console.log("Without the semi colon")
// // console.log(2+2)
// // console.log(2-2)
// // console.log(2*2)
// // console.log(2/2)