Monday, November 18, 2019

soap ui



soap ui file reading via groovy script

for more please refer

// To get the output value, use the built-in result map object
def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
def projectPath = groovyUtils.projectPath
def directoryName = projectPath + "/testData"
def row = testRunner.testCase.testSteps["DataSource"].currentRow
def allFiles = []
new File( directoryName ).eachFile() { file ->
    if( file.name =~ /.txt/ ) {
        allFiles.add( file.name ) }
}
if ( (row + 1) <= allFiles.size ) {
    // Output to the test step property called inputData
    result["inputData"] = new File( directoryName + "/" + allFiles[row] ).text
}

https://www.soapui.org/scripting-properties/tips-tricks.html

IOT languages

LUA
LUA has emerged as an extensible procedural language that is mostly designed to support procedural programming with powerful data description facilities. Since it is an embedded language, LUA needs to be embedded in a host client in order to function well. To help developers build IoT-enabled applications, LUA offers a framework called Node.lua that is built on lightweight Lua interpreter and libuv for event-driven (non-blocking I/O model).

ParaSail
Parallel Specification And Implementation Language is another unusual language that can build highly parallel yet secure applications which can be mapped to multicore, manycore, heterogeneous, or distributed architectures. ParaSail is a feature-rich language in terms of module parameterization, interface separation from implementation, and module-independent invariants, etc.

PHPoC
Yes, there is a variant of PHP language too available for IoT development. Not only a language but a hardware platform also, PHP on Chip (PHPoC) is a general-purpose language for IoT with most syntaxes and core functions inherited from PHP. Addition of new functions like I/O, UART, I2C, SPI, ADC, TIMER/COUNTER, RTC etc. gives it the ability to interact with hardware peripherals in a better way.

Rust
Similar to C/C++, Rust also conceives fine-grained memory management and low runtime overhead, which makes it a strong candidate in the IoT-friendly language list. Popularly known as an alternative to C, Rust is used for system programming and safeguards memory from getting corrupted. With basic structure and easy to learn syntaxes, Rust has become a language of choice for many IoT developers.

Go

Google’s child, Golang or Go programming language is considered a big player in IoT platform development because of its inherent qualities like inbuilt concurrency and ability to maximising the hardware usage to boost performance. Go’s cloud community support makes it real easy for learners to get acquainted with the knowledge of IoT development super quick and in a very

Tuesday, November 12, 2019

Memory Layout

Memory Layout of C Programs
A typical memory representation of C program consists of following sections.
1. Text segment
2. Initialized data segment
3. Uninitialized data segment
4. Stack
5. Heap


A typical memory layout of a running process

1. Text Segment:
A text segment , also known as a code segment or simply as text, is one of the sections of a program in an object file or in memory, which contains executable instructions.

As a memory region, a text segment may be placed below the heap or stack in order to prevent heaps and stack overflows from overwriting it.





Usually, the text segment is sharable so that only a single copy needs to be in memory for frequently executed programs, such as text editors, the C compiler, the shells, and so on. Also, the text segment is often read-only, to prevent a program from accidentally modifying its instructions.

2. Initialized Data Segment:
Initialized data segment, usually called simply the Data Segment. A data segment is a portion of virtual address space of a program, which contains the global variables and static variables that are initialized by the programmer.

Note that, data segment is not read-only, since the values of the variables can be altered at run time.

This segment can be further classified into initialized read-only area and initialized read-write area.

For instance the global string defined by char s[] = “hello world” in C and a C statement like int debug=1 outside the main (i.e. global) would be stored in initialized read-write area. And a global C statement like const char* string = “hello world” makes the string literal “hello world” to be stored in initialized read-only area and the character pointer variable string in initialized read-write area.

Ex: static int i = 10 will be stored in data segment and global int i = 10 will also be stored in data segment

3. Uninitialized Data Segment:
Uninitialized data segment, often called the “bss” segment, named after an ancient assembler operator that stood for “block started by symbol.” Data in this segment is initialized by the kernel to arithmetic 0 before the program starts executing

uninitialized data starts at the end of the data segment and contains all global variables and static variables that are initialized to zero or do not have explicit initialization in source code.

For instance a variable declared static int i; would be contained in the BSS segment.
For instance a global variable declared int j; would be contained in the BSS segment.

4. Stack:
The stack area traditionally adjoined the heap area and grew the opposite direction; when the stack pointer met the heap pointer, free memory was exhausted. (With modern large address spaces and virtual memory techniques they may be placed almost anywhere, but they still typically grow opposite directions.)

The stack area contains the program stack, a LIFO structure, typically located in the higher parts of memory. On the standard PC x86 computer architecture it grows toward address zero; on some other architectures it grows the opposite direction. A “stack pointer” register tracks the top of the stack; it is adjusted each time a value is “pushed” onto the stack. The set of values pushed for one function call is termed a “stack frame”; A stack frame consists at minimum of a return address.

Stack, where automatic variables are stored, along with information that is saved each time a function is called. Each time a function is called, the address of where to return to and certain information about the caller’s environment, such as some of the machine registers, are saved on the stack. The newly called function then allocates room on the stack for its automatic and temporary variables. This is how recursive functions in C can work. Each time a recursive function calls itself, a new stack frame is used, so one set of variables doesn’t interfere with the variables from another instance of the function.

5. Heap:
Heap is the segment where dynamic memory allocation usually takes place.

The heap area begins at the end of the BSS segment and grows to larger addresses from there.The Heap area is managed by malloc, realloc, and free, which may use the brk and sbrk system calls to adjust its size (note that the use of brk/sbrk and a single “heap area” is not required to fulfill the contract of malloc/realloc/free; they may also be implemented using mmap to reserve potentially non-contiguous regions of virtual memory into the process’ virtual address space). The Heap area is shared by all shared libraries and dynamically loaded modules in a process.

Examples.

The size(1) command reports the sizes (in bytes) of the text, data, and bss segments. ( for more details please refer man page of size(1) )

1. Check the following simple C program

filter_none
edit
play_arrow

brightness_4
#include <stdio.h>

int main(void)
{
    return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text       data        bss        dec        hex    filename
960        248          8       1216        4c0    memory-layout
2. Let us add one global variable in program, now check the size of bss (highlighted in red color).

filter_none
edit
play_arrow

brightness_4
#include <stdio.h>

int global; /* Uninitialized variable stored in bss*/

int main(void)
{
    return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text       data        bss        dec        hex    filename
 960        248         12       1220        4c4    memory-layout
3. Let us add one static variable which is also stored in bss.

filter_none
edit
play_arrow

brightness_4
#include <stdio.h>

int global; /* Uninitialized variable stored in bss*/

int main(void)
{
    static int i; /* Uninitialized static variable stored in bss */
    return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text       data        bss        dec        hex    filename
 960        248         16       1224        4c8    memory-layout
4. Let us initialize the static variable which will then be stored in Data Segment (DS)

filter_none
edit
play_arrow

brightness_4
#include <stdio.h>

int global; /* Uninitialized variable stored in bss*/

int main(void)
{
    static int i = 100; /* Initialized static variable stored in DS*/
    return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text       data        bss        dec        hex    filename
960         252         12       1224        4c8    memory-layout
5. Let us initialize the global variable which will then be stored in Data Segment (DS)

filter_none
edit
play_arrow

brightness_4
#include <stdio.h>

int global = 10; /* initialized global variable stored in DS*/

int main(void)
{
    static int i = 100; /* Initialized static variable stored in DS*/
    return 0;
}
[narendra@CentOS]$ gcc memory-layout.c -o memory-layout
[narendra@CentOS]$ size memory-layout
text       data        bss        dec        hex    filename
960         256          8       1224        4c8    memory-layout

for more refer https://www.geeksforgeeks.org/memory-layout-of-c-program/

Monday, November 11, 2019

What are Web Services?

What is a Web Service?

Web Services work on client-server model where client applications can access web services over the network. Web services provide endpoint URLs and expose methods that can be accessed over network through client programs written in java, shell script or any other different technologies.
Web services are stateless and doesn’t maintain user session like web applications.

Tuesday, September 10, 2019

Linux commands for day to day use

file search
1. print top lines
head sample.log
head -n 20 /path/to/logfile.log

2. print bottom lines
   tail  sample.log
   
terminal commands
control A - begining of the line
control E - end of the line
control right arrow
control left arrow
control U start line delete
control K start from custor delete 


file system

cd 
when folder name has space
cd Exercise Files error
cd Exercise\ Files

ls -R inside directory
ls --color=always


rm -sample?.txt

vs

cat sample.txt | cat -n | tail -n4

grep "hello" sample.txt - simple search
grep -in "hello" sample.txt - with line numbers /ignore case with line numbres
grep -vi "hello" sample.txt - with line numbers /ignore matching case and print remaining
grep -n "hello" sample.txt - with line numbers
grep -E "[hijk]" sample.txt - search for letters and shows the results
grep -E "/w{6,}" sample.txt - count words and shows the results


log analysis with awk command
awk '/error/ {print}' /var/log/syslog
awk '{print $2}' sample.txt
awk '{print $2 "\t" $1}' sample.txt | sort -n  more filter on tablular data 

sed s/Orange/Red/ sample_data  to edit& replace text
s for substitute
g for global replace

sort sample.txt
sort -k2 -n sample.txt sort the data
sort -u sample.txt - remove dublicates only unique print
rev tac tr



tar -xvf log.tar.gz 


log analysis
less filename
cat filename | grep "string" | awk '{print $9}' |sort -u > users.txt

free -h
cat /proc/cpuinfo - c

df -h memory information 





copy the text from ssh editor to local 

cntrl+insert for copy
shift +insert for paste

grep commands for daily use

 grep -B 3 -A 2 'Invalid user' /var/log/auth.log
https://www.loggly.com/ultimate-guide/troubleshooting-with-linux-logs/

scp command to transfer files

1. search text in vi editor

  1. Press ESC key.
  2. Type /vivek.
  3. Hit n to search forwards for the next occurrence of word named “vivek”. You can press N to search backwards.

Find Files linux commad


find / -name "*conf" 
find /home/exampleuser/ -name "*conf" 

2. How to unpack (ungzip, unarchive) a tar.gz file

For many systems, REBOL is distributed as a tar gz file. This is a common archive format. Here's how to unpack it...

For tar.gz

To unpack a tar.gz file, you can use the tar command from the shell. Here's an example:
tar -xzf rebol.tar.gz
The result will be a new directory containing the files.
(Also, on many systems, when you download the tar.gz from a web browser, an unpacker will open, and you can just use that.)

For just .gz (.gzip)

In some cases the file is just a gzip format, not tar. Then you can use:
gunzip rebol.gz
In order to execute it, you will need to add execute permissions to the file:
chmod +x rebol


for more refer below videos on detailed commands


Monday, August 12, 2019

Useful tools

#1. Glitch 

This is a multi-purpose tool that can be used to perform different actions. The Glitch website can help you create web apps in the browser or mix code developed by others. The online platform allows you to check out free apps built by other developers. You can edit any project and have your own app running instantly. Building a project becomes easier with Glitch. 

#2. Codeply 

Codeply is designed for front-end UI developers. You can easily create a responsive design playground using this tool. Codeply has Semantic UI and CSS tools, which are important for front-end developers. 

#3. Regexr 

This tool is basically a tester with syntax highlighting. You can use this online tool to learn, build & test Regular Expressions. Regexr supports JavaScript, PHP, and PCRE RegEx. 

#4. Jex.im 

Jex.im is an open source tool created to help you visualise JavaScript Regular Expressions. Programmers can write regular expressions into an editor and get the visual representation on of how the expressions work. 

#5. Httpie 

Httpie is a command line tool with an intuitive UI, JSON support, syntax highlighting, wget-like downloads, plugins etc. This tool can be used to make HTTP requests to web severs and Restful APIs. It comes with a simple version of CURL. 

#6. Mackaroo 

If you ever need some mock data to test your app, Mockaroo can help in generating up to 1,000 rows of data. The data can be exported in CSV, JSON, SQL, and Excel formats. 

#7. Astexplorer 

This tool allows you to paste JavaScript code into its editor. The web-based tool generates Abstract Syntax Tree, which offers better understanding of how the JavaScript code works.

Friday, August 2, 2019

SOFTWARE TESTING


1. MAIL TESTING

https://mailinator.com/

2. Website performance test

https://gtmetrix.com/

3. vulnerability or penetration testing
refer below video for more details





Books to read

1. A Practitioner’s Guide to Software Test Design (Lee Copeland)
Lee Copeland, in this book gives a guided approach to the software test design process. Every page you turn in this book you will discover handy test design techniques which are used in the software testing. Well, you can say this book is a one-stop good read for test engineers, system analysts, quality assurance professionals and even developers. This book will empower you to: choose the best test case design; find software defects in less time and with fewer resources; and develop optimal strategies that will not burn a hole in your pocket with costly errors. It also gives you a hand in estimating the effort, time and cost of good testing. A number of pages are filled with numerous case studies and software testing techniques which will enable you to understand the practical applications of these techniques. From well-established techniques such as equivalence classes, boundary value analysis, decision tables and state-transition diagrams, to new techniques like use case testing, pairwise testing and exploratory testing, this book provides you with the pool of resources for testing professionals seeking to improve their skills and a handy reference for college-level courses in software test design.


2. The Art of Software Testing, 2nd edition (Glenford Myers)
A revision of the best-seller, where this book communicates to you some great insights into the world of software testing. The new world methodologies for the design of effective test cases, including information on psychological and economic principles, managerial aspects, test tools, high-order testing, code inspections, and debugging can be found in this book. You may be an aspiring or a working programmer, this book unlocks the information you need to test eminently. Grab your book and end up with negligible bugs.


3. Software Testing Techniques, 2nd edition (Boris Beizer)
Software Testing Techniques by Boris Beizer is a book for the tester who indulges in eliminating the bugs, preventing the errors. This book covers nearly every aspect of the process of finding flaws in computer programs, moving from the base of software test design to intrusively digging a detailed picture of testing strategies in use today, compiling with important testing strategies in a development organization. The 549-page book covers everything which a practitioner can implement but can be equally utilized students in software engineering curriculum. A perfect amalgamation of theoretical and practical concepts, illustrated in a crystal clear manner and day-to-day techniques with numerous realistic examples.


4. How to Break Software: A Practical Guide to Testing (James Whittaker)
How to Break Software is a breakthrough from mundane testing in which testers prepare a written test plan and then use it as a script when testing the software. The new world testing techniques in this book are as flexible as conventional testing is rigid. And flexibility is needed in software projects in which requirements can change, bugs can become features and schedule pressures often force plans to be reassessed.

Software testing is not such an exact science or a process involving a number of steps with what to test in advance and then execute the plan and be done with it. Instead of a plan, intelligence, insight, experience and a “nose for where the bugs are hiding” should guide testers. This book helps testers to cultivate an insight required to surmount the problems. The techniques presented in this book not only allow testers to go off-script, they encourage them to do so.

Following a book where scripts are outworn which doesn’t relate to the problem is quite a waste. Instead, use your head! Open your eyes! Think a little, test a little and then think a little more. This book is all about to make a plan, to abolish the problem, a way to approach the problem, to solve it and patting yourself that you did it.


5. Testing Object-Oriented Systems: Models, Patterns, and Tools (Robert V. Binder)

An object-oriented (OO) software which is widely used for mission-critical, business applications. The challenges of OO Technology need not to hinder the quality and reliability of testing techniques. Testing Object-Oriented Systems: Models, Patterns, and Tools is an authoritative guide to designing and automating test suites for OO applications. This book is a hands-on winner as compared to other books on the same subject, as it explains why testing must be model-based and provides in-depth coverage of techniques to develop testable models from state machines, combinational logic, and the Unified Modeling Language (UML).

This book not only gives you the idea of test design pattern but also discloses you the 37 patterns that explain how to design responsibility-based test suites, how to tailor integration and regression testing for OO code, how to test reusable components and frameworks, and how to develop highly effective test suites from use cases. Effective testing must be automated and must leverage object technology.

Robert V. Binder describes how to design and code specification-based assertions to offset testability losses due to inheritance and polymorphism. Fifteen micro-patterns present oracle strategies–practical solutions for one of the hardest problems in test design. The automation of your test suites is explained by the seventeen design patterns with a systematic harness framework.

lvalue vs rvalue

  1. What is an lvalue? An lvalue is an object that: Has an identifiable memory location. Has a name (in most cases). Can appear on th...