Posts

Showing posts from July, 2021

Why OOPs - Python

  Organization : OOP defines well known and standard ways of describing and defining both data and procedure in code. Both data and procedure can be stored at varying levels of definition (in different classes), and there are standard ways about talking about these definitions. That is, if you use OOP in a standard way, it will help your later self and others understand, edit, and use your code. Also, instead of using a complex, arbitrary data storage mechanism (dicts of dicts or lists or dicts or lists of dicts of sets, or whatever), you can name pieces of data structures and conveniently refer to them. State : OOP helps you define and keep track of state. For instance, in a classic example, if you're creating a program that processes students (for instance, a grade program), you can keep all the info you need about them in one spot (name, age, gender, grade level, courses, grades, teachers, peers, diet, special needs, etc.), and this data is persisted as long as the object is ali...

Python Class

Image
  Object-oriented programming (OOP) is a method of structuring a program by bundling related properties and behaviors into individual objects An object contains data, like the raw or preprocessed materials at each step on an assembly line, and behavior, like the action each assembly line component performs. Class Classes are used to create user-defined data structures. Classes define functions called methods, which identify the behaviors and actions that an object created from the class can perform with its data. All class definitions start with the class keyword, which is followed by the name of the class and a colon. Any code that is indented below the class definition is considered part of the class’s body. Note: The body of the Dog class consists of a single statement: the pass keyword. pass is often used as a placeholder indicating where code will eventually go. It allows you to run this code without Python throwing an error. __init__() sets the initial state of the object by ...

Python new operation

  self.sides = [0 for i in range(no_of_sides)] This will create the list of initial values zero.   class  Polygon:      def  __init__(self, no_of_sides):          self .n = no_of_sides          self .sides = [ 0   for  i  in  range(no_of_sides)]      def  inputSides(self):          self .sides = [float(input( "Enter side " +str(i+ 1 )+ " : " ))  for  i  in  range( self .n)]      def  dispSides(self):          for  i  in  range( self .n):             print( "Side" ,i+ 1 , "is" , self .sides[i]) class  Triangle(Polygon):      def  __init__(self):...

Check remote Linux machine CPU usage python

Image

Linux process monitoring commands

  Kill a process on a port:  sudo kill -9 $(sudo lsof -t -i:#port-no) top: Provides a list of all the active processes in the machine, refreshes every 5s vmstat: Displays statistics for virtual memory, the kernel, the number of threads, CPU activity, interrupts, the swap, etc. lsof: List of open files, it is a command line utility that is used to list the information about the files that are opened by various processes. In Linux, everything is a file, ( pipes, sockets, directories, devices, etc.). So by using lsof, you can get the information about any opened files. netstat: Netstat command displays various network-related information such as network connections, routing tables, interface statistics, masquerade connections, multicast memberships etc. netstat -a | more:   List all ports using netstat -a netstat -at:  List all tcp ports using netstat netstat -ud:   List all udp ports using netstat iostat:  The iostat command in Linux is used for mo...

Python Loop

Image
  For Loop This loop can be used to iterate over any iterable object in python e.g. list, tuple, string, etc. Using range function If you do need to iterate over a sequence of numbers, the built-in function comes in handy. It generates arithmetic progressions: To iterate over the indices of a sequence Below are some examples for using the range function >>> list ( range ( 5 , 10 )) [5, 6, 7, 8, 9] >>> list ( range ( 0 , 10 , 3 )) [0, 3, 6, 9] >>> list ( range ( - 10 , - 100 , - 30 )) [-10, -40, -70]

Linux Commands

  Linux is only free if your time has no value - Anonyms whoami :    Displays current username. id : Returns user's identity hostname : Sets or prints the name of the current host system. uname :  Prints operating system name. pwd : Returns working directory name. ifconfig : The ifconfig utility is used to assign or to view an address to a network interface and/or configure network interface parameters. ip : Ip is a utility to show or manipulate routing, network devices, interfaces, and tunnels. netstat:  Shows network status. ss : Another utility to investigate sockets. ps: Shows process status. who: Displays who is logged in. env:  Prints environment or sets and executes the command. lsblk : Lists block devices. lsusb:  Lists USB devices lsof:  Lists opened files. lspci:  Lists PCI devices. ssh : Secure Shell (SSH) refers to a protocol that allows clients to access and execute commands or actions on a remote computer. On Linux-based ...

Test Strategy

  The problem is not that testing is the bottleneck. The problem is that you don’t know what’s in the bottle. That’s a problem that testing addresses   — Michael Bolton, author, “Rapid Software Testing” The purpose of the test strategy is to define the overall approach that will be taken by the Testing Team when delivering testing services within the business. The document helps to clarify the testing activities, roles, and responsibilities, processes and practice to be used across successive projects. Just like developers follow the Software Development Life Cycle (SDLC) likewise testers also follow the Software Testing Life Cycle which is called STLC. It is the sequence of activities carried out by the testing team from the beginning of the project till the end of the project. A good software tester is expected to have good knowledge of the STLC life cycle and its activities. https://learnqualitytesting.blogspot.com/2021/07/software-testing-life-cycle-stlc.html Is it...

Defect Life Cycle

Image
  “Never allow the same bug to bite you twice.” ( Steve Maguire ) A defect lifecycle is the movement of a defect or bug through different phases from the beginning when it was identified till it is verified and closed. There are different tools used for managing the defect currently (Jira, Bugzilla, HP ALM, etc.). Different organizations follow different processes for managing the defect, however underlying phases remain the same. New It is the phase when the defect/bug is identified. As soon as a defect is found it is assigned with 'New' state and the process of defect life cycle starts.  Open From the 'New' state the defect moves to the 'Open' state where the defect is assigned to dedicated developer who first tries to recreate the defect, if the defect is valid then the developer starts fixing the bug. During this phase if the defect is not valid then it moved to a deferred state. Deferred This state occurs when the defect is not appropriate, then the develop...

Software Testing Life Cycle - STLC

Image
    “Software testers succeed where others fail.” – Anonymous. Software Testing Life Cycle is a process to conduct software testing to ensure quality goals are met and implemented. As the name stands, it is a cyclic process to ensure quality gates are met and repeated till the product is deemed suitable for release. Below is the Software testing life cycle phases: Requirement Analysis It is the first phase of software testing where testers study and analyze the available specification and requirements. In this phase usually, a requirement document is studied which has been created during SDLC. From the document, the testers analyze both functional as well as non-functional in order to get the testable requirements information.  Entry Criteria Requirement specification, Architecture document of the application, Software Development Document must be available for planning this phase. Activities List of queries and requirements needed to be clarified Product Owner, Architect...

Quality Engineering

“Quality is never an accident; it is always the result of high intention, sincere effort, intelligent direction and skillful execution; it represents the wise choice of many alternatives.” ~ William A. Foster Quality engineering is the discipline of engineering concerned with the practice of product and service quality and control. It is the management, development, maintenance, operation of IT systems. These include enterprise architectures with high-quality standards. Quality engineering focuses on making sure that products and services are designed developed, and made to meet or exceed consumers' expectations and requirements. Difference between Quality Assurance and Quality Engineering Quality Assurance is the process of making sure the product is functioning properly. Quality Engineering defines the system through which quality assurance is achieved. Quality Assurance is about maintaining the quality whereas Quality Engineering is about creating and maintaining the system. Qua...