четвер, 17 листопада 2016 р.

Static

If you make the member Static, it will be shared by all the objects which you will create. There will always be only 1 copy of the Static member in the memory, no matter how many objects you will create.

середа, 16 листопада 2016 р.

ARP

ARP (англ. Address Resolution Protocol — протокол определения адреса) — протокол в компьютерных сетях, предназначенный для определения MAC-адреса по известному IP-адресу.
Рассмотрим суть функционирования ARP на простом примере. Компьютер А (IP-адрес 10.0.0.1) и компьютер Б (IP-адрес 10.22.22.2) соединены сетью Ethernet. Компьютер А желает переслать пакет данных на компьютер Б, IP-адрес компьютера Б ему известен. Однако сеть Ethernet, которой они соединены, не работает с IP-адресами. Поэтому компьютеру А для осуществления передачи через Ethernet требуется узнать адрес компьютера Б в сети Ethernet (MAC-адрес в терминах Ethernet). Для этой задачи и используется протокол ARP. По этому протоколу компьютер А отправляет широковещательный запрос, адресованный всем компьютерам в одном с ним широковещательном домене. Суть запроса: «компьютер с IP-адресом 10.22.22.2, сообщите свой MAC-адрес компьютеру с МАС-адресом (напр. a0:ea:d1:11:f1:01)». Сеть Ethernet доставляет этот запрос всем устройствам в том же сегменте Ethernet, в том числе и компьютеру Б. Компьютер Б отвечает компьютеру А на запрос и сообщает свой MAC-адрес (напр. 00:ea:d1:11:f1:11) Теперь, получив MAC-адрес компьютера Б, компьютер А может передавать ему любые данные через сеть Ethernet.

MAC-address

MAC, Media Access Control, address is a globally unique identifier assigned to network devices, and therefore it is often referred to as hardware or physical address. MAC addresses are 6-byte (48-bits) in length, and are written in MM:MM:MM:SS:SS:SS format. The first 3-bytes are ID number of the manufacturer, which is assigned by an Internet standards body. The second 3-bytes are serial number assigned by the manufacturer.

Difference between TCP and UDP

Difference between TCP and UDP

TCPUDP
Reliability: TCP is connection-oriented protocol. When a file or message send it will get delivered unless connections fails. If connection lost, the server will request the lost part. There is no corruption while transferring a message.Reliability: UDP is connectionless protocol. When you a send a data or message, you don’t know if it’ll get there, it could get lost on the way. There may be corruption while transferring a message.
Ordered: If you send two messages along a connection, one after the other, you know the first message will get there first. You don’t have to worry about data arriving in the wrong order.Ordered: If you send two messages out, you don’t know what order they’ll arrive in i.e. no ordered
Heavyweight: – when the low level parts of the TCP “stream” arrive in the wrong order, resend requests have to be sent, and all the out of sequence parts have to be put back together, so requires a bit of work to piece together.Lightweight: No ordering of messages, no tracking connections, etc. It’s just fire and forget! This means it’s a lot quicker, and the network card / OS have to do very little work to translate the data back from the packets.
Streaming: Data is read as a “stream,” with nothing distinguishing where one packet ends and another begins. There may be multiple packets per read call.Datagrams: Packets are sent individually and are guaranteed to be whole if they arrive. One packet per one read call.
Examples: World Wide Web (Apache TCP port 80), e-mail (SMTP TCP port 25 Postfix MTA), File Transfer Protocol (FTP port 21) and Secure Shell (OpenSSH port 22) etc.Examples: Domain Name System (DNS UDP port 53), streaming media applications such as IPTV or movies, Voice over IP (VoIP), Trivial File Transfer Protocol (TFTP) and online multiplayer games etc

Port

A port number is a way to identify a specific process

HTTP, HTTPS, SSH, SSL and TLS protocols

HTTP - Hypertext Transfer Protocol
application protocol responsible for transfer data. HTTP functions as a request–response protocol in the client–server computing model. A web browser, for example, may be the client and an application running on a computer hosting a website may be the server. The client submits an HTTP request message to the server. The server, which provides resources such as HTML files and other content, or performs other functions on behalf of the client, returns a response message to the client. The response contains completion status information about the request and may also contain requested content in its message body.

HTTPS
is a protocol for secure communication over a computer network which is widely used on the Internet. HTTPS consists of communication over Hypertext Transfer Protocol (HTTP) within a connection encrypted by Transport Layer Security or its predecessor, Secure Sockets Layer.

SSL - Secure Sockets Layer
is a standard security technology for establishing an encrypted link between a server and a client—typically a web server (website) and a browser, or a mail server and a mail client (e.g., Outlook).

TSL - Transport Layer Security
the same as SSL but new

SSH - Secure Shell
The best known example application is for remote login to computer systems by users. SSH provides a secure channel over an unsecured network in a client-server architecture, connecting an SSH client application with an SSH server

How is the lack of IP addresses being solved today?

NAT - Network Address Translation
devices, increasingly popular in homes and offices, allow multiple machines to share a single Internet address. 

IP, IPv4, IPv6

IP address
is short for Internet Protocol address. An IP address is an identifier for a computer or device on a TCP/IP network. The format of IP address is a 32-bit numeric address written as four numbers

IPv4
is a 32-bit numeric address written in decimal as four numbers separated by periods. Each number can be zero to 255. For example, 1.160.10.240

IPv6
In IPv6 the IP address size increased from 32-bits to 128-bits. IPv6 adress written in hexadecimal and separated by colons. An example IPv6 address could be written like this: 3ffe:1900:4545:3:200:f8ff:fe21:67cf

Differnces between hub, roter and switch

1. Hub
very primitive device. It creates a network between computers. it is impossible to manage it. If one computer send package to the another, this package is sending to the all computers  in the network

2. Switch
also create a network. One computer can send package to the another. Only this computer will receive this package

3. Router
connect networks. Links computer to the Internet. Via router you can send data between netorks

пʼятниця, 19 серпня 2016 р.

How to create database in Microsoft SQL Server and view via Visual Studio

1. Download SQL Server Express
2. Download Microsoft SQL Server Management Studio
3. On SQL Express window click on Connect now button.
or
in cmd type sqlcmd -S <ComputerName>  
As result sqlcmd window will be opend
type create database NewDB
4. type go
5. type  use NewDB
6. type go
7. type create table NewTable ( columnname1 columntype1, columnname2 columntype2)
8. type go
9. In Management Studio click on File/Connect Object Explorer
    type server name and authentication
If DB created locally you can find server name on the tpo of sqlcmd
If DB created locally authentification will be Windows Authentification
10. in Visual Studio Tools/Connect to Database type server name and authentication

четвер, 18 серпня 2016 р.

How set/get data to cache c#

1. create helper class
 public static class CacheHelper
    {
        static readonly ObjectCache Cache = MemoryCache.Default;

        public static void SaveTocache(string cacheKey, object savedItem, DateTime absoluteExpiration)
        {
            MemoryCache.Default.Set(cacheKey, savedItem, absoluteExpiration);
        }

        public static T GetFromCache<T>(string cacheKey) where T : class
        {
            return MemoryCache.Default[cacheKey] as T;
        }

        public static void RemoveFromCache(string cacheKey)
        {
            MemoryCache.Default.Remove(cacheKey);
        }

        public static bool IsIncache(string cacheKey)
        {
            return MemoryCache.Default[cacheKey] != null;
        }

        public static T Get<T>(string cacheKey, string regionName = null) where T : class
        {
           
            return MemoryCache.Default.Get(cacheKey) as T;
        }

        /// <summary>
        /// Gets all cached items as a list by their key.
        /// </summary>
        /// <returns></returns>
        public static List<string> GetAll()
        {
            return Cache.Select(keyValuePair => keyValuePair.Key).ToList();
        }
    }

2. in base class add

        /// <summary>
        ///     The general test clean.
        /// </summary>
        [TestCleanup]
        public void GeneralTestClean()
        {
            this.TestContextWithTimer.EndTimer(TestName);
           
            //Create a custom Timeout of 10 seconds
            DateTime customTimeout = DateTime.Now.AddSeconds(60.0);
            testDetailed.TestName = TestName;
            testDetailed.Date = DateTime.Now;
           
            testDetailed.Duration = this.TestContextWithTimer.TestDuration(testName).ToString();
            testDetailed.PassFail = (Microsoft.VisualStudio.TestTools.UnitTesting.UnitTestOutcome.Passed == this.TestContext.CurrentTestOutcome ? "Pass" : "Fail");
            result.Add(testDetailed);

            CacheHelper.SaveTocache(CacheKeyValue, result, customTimeout);

            //get list of keys
            List<string> getCacheKeyList = CacheHelper.GetAll();
            getCacheValueList = new Dictionary<string, List<string>>();
            foreach (var item in getCacheKeyList)
            {
                var getCacheValueFromCache = CacheHelper.GetFromCache<List<string>>(item);
                getCacheValueList.Add(item, getCacheValueFromCache);
            }
         
           this.client.Dispose();
        }

        private readonly string CacheKeyValue = "TestResultDetails " + DateTime.Now;

        private static Dictionary<string, List<string>> getCacheValueList;

        private static List<TestDetailed> endResult = new List<TestDetailed>();

        [AssemblyCleanup]
        public static void ClassCleanup()
        {                            
            foreach (string key in getCacheValueList.Keys)
            {
                foreach (string val in getCacheValueList[key])
                {
                    Console.WriteLine(val);
                }
            }        
        }

середа, 13 липня 2016 р.

Івенти


  1. Событие, это ситуация, при возникновении которой, произойдут некоторые действия. Само событие имеет определенную структуру
  2. https://habrahabr.ru/post/213809/

Делегати


  1. делегат - это класс, содержащий данные о сигнатуре метода
  2. delegate string MyDelegate(int x)
  3. http://metanit.com/sharp/tutorial/3.13.php

четвер, 23 червня 2016 р.

Test Reports with Visual Studio, NUnit and Allure

  • Firstly we need to download and install NUnit: www.NUnit.org
  • Secondly we need the Allure NUnit adaptor, follow instructions here: Allure Framework Adaptor for NUnit
  • The Allure Command Line Interface is needed, get it from here: Allure CLI
  • Java JDK needs to be installed and specified correctly in your JAVE_HOME variable in your environment

вівторок, 23 лютого 2016 р.

Git: main commands

1. git status
Основной инструмент, используемый для определения, какие файлы в каком состоянии находятся
2. git add
Для того чтобы начать отслеживать (добавить под версионный контроль) новый файл, используется команда
3. git commit

четвер, 11 лютого 2016 р.

Spring: questions

1. What are the main Spring features?

  • AOP support 
  • Lightweight framework 
  • container 
  • Inversion of control implementation 

Spring


  1. What is Spring
  • lightweight jar libraries
  • container (manages lifecycle of objects) (there is no need to use new for creating objects. All objects are in container)
  • framework (there are a lot of classes which can help with data base, services)
  • Dependency Injection (Inversion of Control) (objects get their their dependencies and do not create it)
  • AOP (Aspect Oriented Programming)

середа, 3 лютого 2016 р.

Examples with xpath and Css (ID, Name, Text and Links)

1. With ID : - //input[@id='email'] or  //*[@id='email']
   css - input#email or #email
2. With Name - //input[@name='email'] or  //*[@name='email']
    css - input[name=email] or [name=email]

вівторок, 2 лютого 2016 р.

Hadoop installation notes

Cluster planning:

  • Small cluster (2-10 nodes): Clusters of three or more machines typically use a dedicated NameNode/ResourceManager, and all other nodes are workers. 
  • Medium cluster (10-40 nodes): separate machines for master, usually dedicated edge node 
  • Large cluster (> 40 nodes): occupies multiple racks, requires individual planning

Storage layer for HDFS:

  • Cloud and virtualization solutions are very popular in the enterprise world 
  • With Hadoop, focus on using JDOD (just bunch of disks) instead of SAN (storage area network) 
  • Hadoop heterogeneous storage was introduced in Hadoop 2.5

Commodity hardware:

Balanced configuration for one worker recommended by vendors:

  • 2-4 8-cores CPU 
  • 128 GB RAM 
  • 12 hard drives (1 or 2 TB each)

HDFS Architecture


  • Individual machines are known as nodes 
  • A cluster can have as few as one node, as many as several thousands
  • Two types of nodes: NameNode and DataNode 
  • More nodes = better performance 
  • HDFS is a filesystem written in Java 
  • The NameNode daemon must be running at all times If the NameNode stops, the cluster becomes inaccessible 
  • The NameNode holds all of its metadata in RAM for fast access 
  • A separate daemon known as the Secondary NameNode takes care of some housekeeping tasks for the NameNode
  • Although files are split into 64MB or 128MB blocks
  • Blocks are stored as standard files on the DataNodes, in a set of directories specified in Hadoop’s configuration files 
  • Without the metadata on the NameNode, there is no way to access the files in the HDFS cluster
  • When a client application wants to read a file: It communicates with the NameNode to determine which blocks make up the file, and which DataNodes those blocks reside on. It then communicates directly with the DataNodes to read the data

понеділок, 1 лютого 2016 р.

Git: how to restore deleted no commited file

If the deletion has not been committed, the command below will restore the deleted file in the working tree.
$ git checkout -- <file>

четвер, 28 січня 2016 р.

How to test SOAP service in Eclipse by Webservice Explorer

1. create soap service
2. run on server the project
3.copy the wsdl
4. go to Run/Launch Webservice Explorer

How to test SOAP service

1. click soap service
2. create war file and deploy to Tomcat
3. test by SoapUI
create project and input wsdl file
message should be sent for testing soap service. For testing rest service URI should be send

Create SOAP web services in java(JAX-WS) using Apache CXF

1. create Dynamic web project
2. create interface ICalculator

How to push existing project to github

1. create repository in github
2. On your machine, first you will need to navigate to the project folder using git bash. When you get there you do:
git init
which initiates a new git repository in that directory.
When you've done that, you need to register that new repo with a remote (where you'll upload -- push -- your files to), which in this case will be github. You'll get the correct URL from your repo on GitHub.
$ git remote add origin https://github.com/[username]/[reponame].git
You need to add you existing files to your local commit:
git add .   # this adds all the files
Then you need to make an initial commit, so you do:
git commit -a -m "Initial commit" # this stages your files locally for commit. 
                                  # they haven't actually been pushed yet
Now you've created a commit in your local repo, but not in the remote one. To put it on the remote, you do the second line you posted:
git push --set-upstream origin master
3. Right click your project, select Team -> Share Project -> Git. Select the proposed line and press "Create repository". Press finish

HTTP Status Codes

Sr. No.HTTP CodeDescription
1200OK, shows success.
2201CREATED, when a resource is successful created using POST or PUT request. Return link to newly created resource using location header.
3204NO CONTENT, when response body is empty for example, a DELETE request.
4304NOT MODIFIED, used to reduce network bandwidth usage in case of conditional GET requests. Response body should be empty. Headers should have date, location etc.
5400BAD REQUEST, states that invalid input is provided e.g. validation error, missing data.
6401UNAUTHORIZED, states that user is using invalid or wrong authentication token.
7403FORBIDDEN, states that user is not having access to method being used for example, delete access without admin rights.
8404NOT FOUND, states that method is not available.
9409CONFLICT, states conflict situation while executing the method for example, adding duplicate entry.
10500INTERNAL SERVER ERROR, states that server has thrown some exception while executing the method.

How to test REST service

1. create service
2. deploy it on Tomcat or run locally in Eclipse "Run on server"
3. test by SoapUI
   add REST project in SoapUI

пʼятниця, 22 січня 2016 р.

Create RESTful web services in java(JAX-RS) using Apache CXF

Java API for RESTful Web Services (JAX-RS), is a set if APIs to developer REST service. JAX-RS is part of the Java EE6
Apache CXF is an open source services framework. CXF helps you build and develop services using frontend programming APIs, like JAX-WS and JAX-RS
In this article we will build a service and deploy it on Tomcat

How to create APACHE CXF REST service Calculator


  1. Create a Java Project
  2. Configure to Maven project
  3. in pom file add JAX RS and  APACHE CXF dependencies
  4. Create a Java class ‘CalcREST’ and type the following code. 

четвер, 21 січня 2016 р.

About REST and SOAP services

1. Web services is a technology for transmitting data over the Internet and allowing programmatic access to that data using standard Internet protocols, typically HyperText Transfer Protocol (HTTP).
2. You can think of an individual Web service as a piece of software that performs a specific task (also known as a function), and makes that task available by exposing a set of operations that can be performed (known asmethods or Web methods) with the task. Additionally, each of the methods exposes a set of variables that can accept data passed into the method. These variables are known as parameters or properties. Together, the properties and methods refer to a Web service's interface.
3. Web services provide an application integration technology that can be successfully used over the Internet. 
4. based Web applications that interact with other web applications for the purpose of exchanging data. Web Services can convert your existing applications into Web-applications.
5. A web service takes the help of WSDL to describe the availability of service. It provides a definition of how the Web service works, so that when you create a reference to it
6. WSDL is an XML-based language for describing web services and how to access them.
7. SOAP is an XML-based protocol for exchanging information between computers.
8. Simple Object Access Protocol (SOAP) and REpresentational State Transfer (REST) are two answers to the same question: how to access Web services. 
9. Web services are client and server applications that communicate over the World Wide Web’s (WWW) HyperText Transfer Protocol (HTTP)


Rest:
1. RESTful web services are based on HTTP protocol and its methods PUT, GET, POST, and DELETE. These web services are better integrated with HTTP than SOAP-based services are, and as such do not require XML SOAP messages or WSDL service definitions


вівторок, 19 січня 2016 р.

Types of Automation Frameworks

types of automation frameworks
  1. Linear – Simplest form of creating a test. Just write a one single program without modularity in sequential steps
  2. Keyword driven – Create different keywords for different set of operations and in the main script we can just refer to these keywords.
  3. Data driven – To run same set of operations on multiple sets of data that are kept in separate files, mostly excel sheets.
  4. Hybrid – A combination framework that can be partly data driven and partly keyword driven
  5. BPT – This just means that programs are broken down into business components and are used with one or the other of the above types of frameworks
link

Below are the different types of frameworks:

  1. Module Based Testing Framework: The framework divides the entire “Application Under Test” into number of logical and isolated modules. For each module, we create a separate and independent test script. Thus, when these test scripts taken together builds a larger test script representing more than one module.
  2. Library Architecture Testing Framework: The basic fundamental behind the framework is to determine the common steps and group them into functions under a library and call those functions in the test scripts whenever required.
  3. Data Driven Testing Framework: Data Driven Testing Framework helps the user segregate the test script logic and the test data from each other. It lets the user store the test data into an external database. The data is conventionally stored in “Key-Value” pairs. Thus, the key can be used to access and populate the data within the test scripts.
  4. Keyword Driven Testing Framework: The Keyword driven testing framework is an extension to Data driven Testing Framework in a sense that it not only segregates the test data from the scripts, it also keeps the certain set of code belonging to the test script into an external data file.
  5. Hybrid Testing Framework: Hybrid Testing Framework is a combination of more than one above mentioned frameworks. The best thing about such a setup is that it leverages the benefits of all kinds of associated frameworks.
  6. Behavior Driven Development Framework: Behavior Driven Development framework allows automation of functional validations in easily readable and understandable format to Business Analysts, Developers, Testers, etc.

How to Select Correct Test Cases for Automation Testing

Step 1:
Identify the parameters on which you will base your test case as a candidate for automation.
As of now I am identifying the below parameters, you can have your own parameters depending on your application.
  • Test case executed with different set of data
  • Test case executed with different browser
  • Test case executed with different environment
  • Test case executed with complex business logic
  • Test case executed with different set of users
  • Test case Involves large amount of data
  • Test case has any dependency
  • Test case requires Special data

Advantages of automation

There are many advantages of automation:

  1. Useful to execute the routine tasks like smoke tests and regression tests. 
  2. Useful in preparing the test data. 
  3. Helps to execute the test cases which involve complex business logic.
  4. Good to execute the cross platform test cases (like different OS, browsers etc.) 
  5. Great to execute the test cases which are a bit difficult to execute manually. 
  6. When the number of iterations of the test case executions are not known.

Web Site Test Tools and Site Management Tools

Links to useful resources: