Skip to main content

Posts

Showing posts from July, 2016

XPath tutorial for Selenium

XPath is designed to allow the navigation of XML documents,with the purpose of selecting individual elements, attributes, or some other part of an XML document for specific processing. What is XML? The Extensible Markup Language (XML) is the context in which the XML Path Language, XPath, exists. XML provides a standard syntax for the markup of data and documents. XML documents contain one or more elements. If an element contains content,whether other elements or text, then it must have a start tag and an end tag. The text contained between the start tag and the end tag is the element’s content. <Element> //Start tag Element content goes here.//Element Content </Element>//End Tag An element may have one or more attributes, which will provide additional information about the element type or its content. Below is the sample XML: <?xml version='1.0'?> <Catalog> <Book> <Title>XML Tutorial</Title> <Author>Selenium Easy</A

API Testing With Selenium WebDriver

REST API Testing Framework We will be creating a simple Rest Testing Framework in Java and JUnit that could be used for any testing scenarios. Rest Testing Framework Overview The framework should be able to execute the basic REST operations (GET, POST, PUT, PATCH, DELETE) and perform the validations on the code, message, headers and body of the response. The completed code can be accessed from my  GitHub account   from where you can collect and make modifications based on your requirements. Design We will be having three classes for the framework (in package com.axatrikx.controller ) RestExecutor  : Performs the HTTP operations using Apache Http Client RestResponse  : A javabean class to hold our response values (code, message, headers, body) RestValidator  : Validates the response with the expected values The package  com.axatrikx.test  holds the test scripts. Note: I will be using ‘ json-server ‘ to fake the REST API. Its a real handy tool to r