<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Uthpala Pathirana on Medium]]></title>
        <description><![CDATA[Stories by Uthpala Pathirana on Medium]]></description>
        <link>https://medium.com/@uthpalanp?source=rss-4ad9acc29e09------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*dxm-xDGQKk71A3D-</url>
            <title>Stories by Uthpala Pathirana on Medium</title>
            <link>https://medium.com/@uthpalanp?source=rss-4ad9acc29e09------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 03:01:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@uthpalanp/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built a Web UI Automation Framework Using Page Object Model]]></title>
            <link>https://medium.com/@uthpalanp/how-i-built-a-web-ui-automation-framework-using-page-object-model-c5860792f040?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5860792f040</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Fri, 14 Nov 2025 05:42:55 GMT</pubDate>
            <atom:updated>2025-11-14T06:26:50.758Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, I present my project of web automation framework using Selenium and TestNG for Guru99 Demo site.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*bDTbtcumAL_6aSKDUOq2pw.png" /></figure><p>As we all know, both manual and automation testing approaches have their significant place in the SDLC. The choice between those 2 approaches depends on various factors, including project requirements, time constraints, budget, system complexity, and the testing team’s skills and expertise. Automated QA testing is important for companies that practice continuous integration, which means that software is developed, tested, and deployed multiple times per day, rather than in stages, as was common in more traditional development models. It helps to saves time and money, increases test coverage, improves accuracy, early bug detection, fast development and delivery and for the reusability of test scripts.</p><p>Following are the used items for the project: 👇</p><ul><li><strong>Frameworks: </strong>Selenium, TestNG</li><li><strong>Programming Language:</strong> Java</li><li><strong>Version control: </strong>GitHub</li><li><strong>IDE:</strong> IntelliJ IDEA</li><li><strong>Build/Dependency Management:</strong> Maven</li><li><strong>Design Pattern:</strong> Page Object Model</li><li><strong>Web application:</strong> <a href="https://demo.guru99.com/test/newtours/index.php">Guru99 Demo Site</a></li></ul><p><strong>Selenium:</strong> Selenium is one of the most widely used web automation tools. It is open-source, supports multiple browsers and operating systems, allows parallel test execution, and integrates well with other testing tools.</p><p><strong>TestNG:</strong> TestNG is a robust testing framework for Java that simplifies the creation and execution of automated tests. It supports annotations, flexible test configurations, grouping, prioritization, and parallel execution of tests. TestNG also generates detailed HTML reports and integrates seamlessly with Selenium.</p><p><strong>Java:</strong> Java is a versatile, platform-independent programming language ideal for developing automation frameworks. Its object-oriented nature promotes code reusability and maintainability, while a rich ecosystem of libraries makes it perfect for scalable test automation.</p><h3><strong>Page Object Model (POM)</strong></h3><p>POM is a design pattern that improves code organization, readability, and maintainability. Each web page is represented by a separate class containing locators and methods for interacting with page elements. Separating page logic from test logic reduces code duplication and allows for faster updates when the UI changes.</p><p><strong>Why POM is suitable?</strong></p><p>Web elements like buttons often change over time. For example, let’s assume there is a “login” button in a web page with the id=”loginBtn_123&quot;. And with the UI change the id must be updated as id=”loginBtn_456&quot;. If we wrote this locator directly inside the test script, we have to update the every affected test case manually, which is time-consuming, error-prone, and hard to maintain as the project grows. (if we include this element in 10 test cases, as 2 places in each test case, we have to updated all those 20 places)</p><p>But with the page object model, all locators and actions are stored in dedicated page classes, so when there is an element change, we only have to update it once.</p><p><strong>Advantages of POM</strong></p><ul><li>Reusability of code</li><li>Organized</li><li>Manageable</li><li>Understandable</li><li>Scalable</li><li>Cost effective</li><li>Less maintenance</li></ul><h3><strong>Project Structure</strong></h3><p>I organized the framework as following structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*Dh_DrX2n3OzqCmtuMr_QhQ.png" /></figure><p><strong>pom.xml</strong></p><p>Before start the project, I added those two essential dependencies to my pom.xml file. They are, Selenium dependency and TestNG dependency.</p><pre>&lt;dependencies&gt;<br>        &lt;!-- Selenium --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;<br>            &lt;artifactId&gt;selenium-java&lt;/artifactId&gt;<br>            &lt;version&gt;4.33.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;!-- TestNG --&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>            &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>            &lt;version&gt;7.3.0&lt;/version&gt;<br>        &lt;/dependency&gt;  <br><br>    &lt;/dependencies&gt;</pre><p><strong>How did I implement POM to this project</strong></p><ol><li>Created a separate class for each web page under src/main/java/pages.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/440/1*omj51xdtBVLMkte2Q47dsw.png" /></figure><p>2. Defined web elements and actions within these classes.</p><p>ex: HomePage.java</p><pre>package Pages;<br><br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br><br>public class HomePage {<br><br>    WebDriver driver;<br><br>    public HomePage(WebDriver driver){<br>        this.driver=driver;<br>    }<br><br>    By registerBtnLocator = By.linkText(&quot;REGISTER&quot;);<br>    <br>    public void selectRegisterMenu(){<br>        driver.findElement(registerBtnLocator).click();<br>    }<br>}</pre><p>RegisterPage.java</p><pre>package Pages;<br><br><br>public class RegisterPage {<br><br>    WebDriver driver;<br><br>    public RegisterPage(WebDriver driver){<br>        this.driver = driver;<br>    }<br><br>        By firstName_loc = By.xpath(&quot;//input[@name=&#39;lastName&#39;]&quot;);<br>        By lastName_loc = By.xpath(&quot;//input[@name=&#39;firstName&#39;]&quot;);<br>        By email_loc = By.xpath(&quot;//input[@id=&#39;userName&#39;]&quot;);<br>        By countrySelect_loc = By.xpath(&quot;//select[@name=&#39;country&#39;]&quot;);<br>        By userName_loc =By.xpath(&quot;//input[@id=&#39;email&#39;]&quot;);<br>        By password_loc = By.xpath(&quot;//input[@name=&#39;password&#39;]&quot;);<br>        By confirmPassword_loc = By.xpath(&quot;//input[@name=&#39;confirmPassword&#39;]&quot;);<br>        By submitBtn_loc = By.xpath(&quot;//input[@name=&#39;submit&#39;]&quot;);<br><br>    public void setFirstName(String firstName){<br>            driver.findElement(firstName_loc).sendKeys(firstName);<br>        }<br>    public void setLastName(String lastName){<br>        driver.findElement(lastName_loc).sendKeys(lastName);<br>    }<br>    public void setEmail(String email){<br>        driver.findElement(email_loc).sendKeys(email);<br>    }<br>    public void selectCountry(){<br>            WebElement countrySelect_ele = driver.findElement(countrySelect_loc);<br>            Select dropDownCountry = new Select(countrySelect_ele);<br>            dropDownCountry.selectByIndex(2);<br>    }<br>    public void setUsername(String username){<br>        driver.findElement(userName_loc).sendKeys(username);<br>    }<br>    public void setPassword(String password){<br>        driver.findElement(password_loc).sendKeys(password);<br>    }<br>    public void setConfirmPassword(String confirmPassword){<br>        driver.findElement(confirmPassword_loc).sendKeys(confirmPassword);<br>    }<br>    public void setSubmitBtn(){<br>            driver.findElement(submitBtn_loc).click();<br>    }<br>}</pre><p>RegisterSuccessPage.java</p><pre>package Pages;<br><br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br><br>public class RegisterSuccessPage {<br><br>    WebDriver driver;<br><br>    public RegisterSuccessPage(WebDriver driver){<br>        this.driver = driver;<br>    }<br><br>    By successText_loc = By.xpath(&quot;//b[contains(text(), &#39;Dear&#39;)]&quot;);<br><br>    public String registerSuccessText(){<br>        String successText = driver.findElement(successText_loc).getText();<br>        return successText;<br>    }<br><br>    By signInBtnLocator = By.xpath(&quot;//a[normalize-space()=&#39;sign-in&#39;]&quot;);<br><br>    public void selectSignInBtn(){<br>        driver.findElement(signInBtnLocator).click();<br>    }<br>}</pre><p>3. And I created test cases in src/test/java/testCases package.</p><p>First I created one test class for the <strong>Home page → Register page → Register success page</strong> flow.</p><p>TC001_RegisterUserTest.java</p><pre>package testCases;<br><br>import Pages.HomePage;<br>import Pages.RegisterPage;<br>import Pages.RegisterSuccessPage;<br>import org.openqa.selenium.Rectangle;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.chrome.ChromeDriver;<br>import org.testng.Assert;<br>import org.testng.annotations.AfterMethod;<br>import org.testng.annotations.BeforeMethod;<br>import org.testng.annotations.Test;<br><br>import java.time.Duration;<br><br>public class TC001_RegisterUserTest {<br><br>    WebDriver driver;<br><br>    @BeforeMethod<br>    public void openPage(){<br>        driver = new ChromeDriver();<br>        driver.manage().window().maximize();<br>        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));<br>        driver.get(&quot;https://demo.guru99.com/test/newtours/index.php&quot;);<br>    }<br><br>    @Test<br>    public void TC001(){<br><br>        HomePage homePage = new HomePage(driver);<br>        homePage.selectRegisterMenu();<br><br>        RegisterPage registerPage = new RegisterPage(driver);<br>        registerPage.setFirstName(&quot;Uthpala&quot;);<br>        registerPage.setLastName(&quot;Pathirana&quot;);<br>        registerPage.setEmail(&quot;test01@gmail.com&quot;);<br>        registerPage.selectCountry();<br>        registerPage.setUsername(&quot;Uthpala123&quot;);<br>        registerPage.setPassword(&quot;test1234&quot;);<br>        registerPage.setConfirmPassword(&quot;test1234&quot;);<br>        registerPage.setSubmitBtn();<br><br>        RegisterSuccessPage registerSuccessPage = new RegisterSuccessPage(driver);<br>        String actualText = registerSuccessPage.registerSuccessText();<br>        Assert.assertTrue(actualText.contains(&quot;Dear&quot;), &quot;Registration Attempt Failed&quot;);<br>    }<br><br>    @AfterMethod<br>    public void closeBrowser(){<br>        driver.quit();<br>    }<br>}</pre><p>This was the initial page object model framework I created. Then I did some changes.</p><p>Instead of using this “findElement” to identify the element, I used “Page Factory” to locate and identify the elements as following.</p><p>ex: HomePage.java</p><pre>package pages;<br><br>public class HomePage {<br><br>    WebDriver driver;<br><br>    public HomePage(WebDriver driver){<br>        this.driver = driver;<br>        PageFactory.initElements(driver, this);<br>    }<br><br>    @FindBy(linkText = &quot;REGISTER&quot;)<br>    WebElement registerBtn_ele;<br><br><br>    public void selectRegisterMenu(){<br>        registerBtn_ele.click();<br>    }<br>}</pre><p>RegisterPage.java</p><pre>package pages;<br><br><br>public class RegisterPage {<br><br>    WebDriver driver;<br><br>    public RegisterPage(WebDriver driver){<br>        this.driver = driver;<br>        PageFactory.initElements(driver,this);<br>    }<br>    <br>    @FindBy(name = &quot;firstName&quot;)<br>    WebElement firstName_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;lastName&#39;]&quot;)<br>    WebElement lastName_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;phone&#39;]&quot;)<br>    WebElement phone_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;address1&#39;]&quot;)<br>    WebElement address_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;city&#39;]&quot;)<br>    WebElement city_ele;<br><br>    @FindBy(name=&quot;state&quot;)<br>    WebElement state_ele;<br><br>    @FindBy(name = &quot;postalCode&quot;)<br>    WebElement postalCode_ele;<br><br>    @FindBy(xpath = &quot;//input[@id=&#39;userName&#39;]&quot;)<br>    WebElement email_ele;<br><br>    @FindBy(xpath = &quot;//select[@name=&#39;country&#39;]&quot;)<br>    WebElement countrySelect_ele;<br><br>    @FindBy(xpath = &quot;//input[@id=&#39;email&#39;]&quot;)<br>    WebElement userName_ele;<br><br>    @FindBy(name = &quot;password&quot;)<br>    WebElement password_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;confirmPassword&#39;]&quot;)<br>    WebElement confirmPassword_ele;<br><br>    @FindBy(xpath = &quot;//input[@name=&#39;submit&#39;]&quot;)<br>    WebElement submitBtn_ele;<br><br>    public void setFirstName(String firstName){<br><br>       firstName_ele.sendKeys(firstName);<br>    }<br><br>    public void setLastName(String lastName){<br>        lastName_ele.sendKeys(lastName);<br>    }<br><br>    public void setPhoneNum(int phone){<br>        phone_ele.sendKeys(Integer.toString(phone));<br>    }<br><br>    public void setEmail(String email){<br>        email_ele.sendKeys(email);<br>    }<br><br>    public void setAddress(String address){<br>        address_ele.sendKeys(address);<br>    }<br><br>    public void setCity(String city){<br>        city_ele.sendKeys(city);<br>    }<br><br>    public void setState(String state){<br>        state_ele.sendKeys(state);<br>    }<br><br>    public void setPostalCode(int postalCode){<br>        postalCode_ele.sendKeys(Integer.toString(postalCode));<br>    }<br><br>    public void selectCountry(){<br>        WebElement countrySelectElement = countrySelect_ele; //find the element<br>        Select dropdownCountry = new Select(countrySelectElement);<br>        dropdownCountry.selectByIndex(2);<br>    }<br><br>    public void setUserName(String userName){<br>        userName_ele.sendKeys(userName);<br>    }<br><br>    public void setPassword(String password){<br>       password_ele.sendKeys(password);<br>    }<br><br>    public void setConfirmPassword(String confirmPassword){<br>        confirmPassword_ele.sendKeys(confirmPassword);<br>    }<br><br>    public void submit(){<br>        submitBtn_ele.click();<br>    }<br>}</pre><p>RegisterSuccess.java</p><pre>package pages;<br><br>import org.openqa.selenium.By;<br>import org.openqa.selenium.WebDriver;<br>import org.openqa.selenium.WebElement;<br>import org.openqa.selenium.devtools.v136.page.Page;<br>import org.openqa.selenium.support.FindBy;<br>import org.openqa.selenium.support.PageFactory;<br><br>public class LoginSuccessPage {<br>    WebDriver driver;<br><br>    public LoginSuccessPage(WebDriver driver){<br>        this.driver = driver;<br>        PageFactory.initElements(driver, this);<br>    }<br><br>    @FindBy(xpath = &quot;//b[contains(text(), &#39;Thank&#39;)]&quot;)<br>    WebElement successLoginText_ele;<br><br><br>    public String loginSuccessText(){<br>        String loginSuccessText = successLoginText_ele.getText();<br>        return loginSuccessText;<br>    }<br>}</pre><p>What is this Page Factory, how it works and what are the key features? Let’s see.</p><h3>Page Factory</h3><p><strong>Page factory</strong> is a common design pattern in Selenium which is used to create Page Object Model implementations more efficiently.</p><p>We can use <strong>@FindBy</strong> annotation to locate and declare web elements directly within the page class. So we no need to use “driver.findElement()” or “driver.findElements()”. We can specify various locator strategies within this @FindBy annotation like id, name, className, xpath, linkText etc.</p><p>Here we can use this @FindBy annotation in two ways.</p><p>1st way:</p><pre>@FindBy(how = How.LINK_TEXT, using = &quot;REGISTER&quot;)</pre><p>2nd way: <em>I used this way.</em></p><pre>@FindBy(linkText = &quot;REGISTER&quot;)</pre><p>Following is the Selenium PageFactory method that initializes all the @FindBy annotated Web elements in this HomePage class.</p><pre>PageFactory.initElements(driver, this);</pre><p>It automatically finds and assigns web elements to declared WebElements in this class. Here, we have to pass 2 arguments:</p><ol><li>driver → It is used to find the elements on the page</li><li>this → This refers to the current class (HomePage) where the elements are declared.</li></ol><p>This means we don’t have to call “driver.findElement()” manually each time.</p><p>Let’s see, what will happened if we do not use this “PageFactory” or “WebDriver driver;” in the constructor:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0DU2fKVoKpPSS0b19Sz9Hw.png" /></figure><p>It gives this NullPointerException error : <em>java.lang.NullPointerException: Cannot invoke “org.openqa.selenium.WebElement.click()” because “this.registerBtn_ele” is null</em></p><p>So this is what happened here, in simply:</p><ol><li>When the test case execute, the constructor is called (HomePage homePage = new HomePage(<em>driver</em>);) and this line is executed first→ PageFactory.initElements(driver, this);</li><li>Selenium finds the element with link text “REGISTER” and binds it to “registerBtn_ele.”</li><li>The method “selectRegisterMenu()” calls “registerBtn_ele.click();”</li><li>The “REGISTER” link is clicked on the browser.</li></ol><p>And I added a base class and .properties files for more readability.</p><h3>BaseClass and Cross Browser Testing</h3><p><strong>BaseClass.java</strong></p><pre>package base;<br><br>public class BaseClass {<br><br>    public static WebDriver driver;<br>    public Properties prop;<br><br>    @BeforeSuite (groups = {&quot;smoke&quot;, &quot;regression&quot;})<br>    public void beforeSuite(){<br>        ExtentReportUtility.startReporter();<br>    }<br>    @BeforeMethod (groups = {&quot;smoke&quot;, &quot;regression&quot;})<br>    public void openPage() throws IOException {<br>        FileInputStream fileInputStream = new FileInputStream(System.getProperty(&quot;user.dir&quot;)+<br>                                                &quot;\\src\\test\\resources\\config.properties&quot;);<br>        prop = new Properties();<br>        prop.load(fileInputStream);<br>        String env = prop.getProperty(&quot;env&quot;);<br>        String browser = prop.getProperty(&quot;browser&quot;);<br><br>        //Select browser - Cross Browser Testing<br>        switch(browser.toLowerCase()){<br>            case &quot;chrome&quot;:<br>                driver = new ChromeDriver();<br>                break;<br>            case &quot;edge&quot;:<br>                driver = new EdgeDriver();<br>                break;<br>            case &quot;firefox&quot;:<br>                driver = new FirefoxDriver();<br>                break;<br>            default:<br>                System.out.println(&quot;Browser not support: &quot;+browser);<br>                return;<br>        }<br>        driver.manage().window().maximize();<br>        String iml_wait = prop.getProperty(&quot;implicit_wait&quot;);<br>        long imp_wait_long  = Long.parseLong(iml_wait); //to convert to the long data type<br>        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(imp_wait_long));<br><br>        //Select environment (QA/Dev/Prod etc.)<br>        String appUrl = prop.getProperty(env + &quot;.url&quot;);<br>        if (appUrl == null){<br>            throw new IllegalArgumentException(&quot;URL not defined for environment: &quot;+env);<br>        }<br><br>        driver.get(appUrl);<br>        //driver.get(prop.getProperty(&quot;App_url&quot;));<br>    }<br><br>    @AfterMethod (groups = {&quot;smoke&quot;, &quot;regression&quot;})<br>    public void closeBrowser(){<br>        driver.quit();<br>    }<br><br>    @AfterSuite (groups = {&quot;smoke&quot;, &quot;regression&quot;})<br>    public void afterSuite(){<br>        ExtentReportUtility.endReport();<br>    }<br>}</pre><p>Here, I used BaseClass.java which serves as the foundation of the test automation framework and also a key design pattern in automation. By using this we can create reusable methods and configurations that can be shared across multiple test cases. This increases code reusability, improves maintainability, and ensures consistency in our tests.</p><p>In this base class, I have used different TestNG annotations such as <strong>@BeforeSuite, @BeforeMethod, @AfterMethod </strong>and <strong>@AfterSuite.</strong></p><p>And also, here I set up the configurations for cross browser testing.</p><p><strong>Cross Browser Testing: </strong>We need to ensure that the web application works correctly and looks consistent across the difference browsers like Chrome, Firefox, Edge, etc. Different browsers can show pages in different ways, so this testing helps find and fix any issues early. It ensures that every user has the same good experience no matter which browser they use.</p><p>At the beginning, this loads the configuration file (“config.properties”) which includes the key settings like browser type, environment (qa, dev or prod), application URL and implicit wait time. Bases on this browser specified, it lunches the relevant browser dynamically. (ex: Chrome)</p><p>@BeforeMethod : Before each test case runs, this ensures that the browser is opened, maximized or minimized, and navigated to the correct environment URL.</p><p>@AfterMethod: Closes the browser after each test to ensure a clean state for subsequent executions.</p><p>@BeforeSuite &amp; @AfterSuite : These annotations are used to start and end the Extent Report (which I have explained later), which generates detailed test execution reports for better visibility and analysis of results.</p><h3><strong>Properties files</strong></h3><p>I created two .properties files inside src/test/resources folder named: “config.properties” &amp; “testData.properties”. And I used key-value pair structure to store data in these files.</p><p>config.properties</p><pre>#Application URL<br>App_url = https://demo.guru99.com/test/newtours/index.php<br><br>#Automating environment<br>env = dev<br><br>#Environment URLs<br>qa.url = https://demo.guru99.com/test/newtours/index.php<br>dev.url = https://demo.guru99.com/test/newtours/index.php<br>prod.url = https://demo.guru99.com/test/newtours/index.php<br><br>#Autmoating browser<br>browser=chrome<br><br>#Implicit wait<br>implicit_wait=10</pre><p><em>Note: I mentioned the same URL for all 3 environment since there is only that URL available in publicly.</em></p><p>To read these data from property file, I included “FileInputStream” class in BaseClass.java as following:</p><pre>public Properties prop;<br><br>@BeforeMethod (groups = {&quot;smoke&quot;, &quot;regression&quot;})<br>    public void openPage() throws IOException {<br>FileInputStream fileInputStream = new FileInputStream(System.getProperty(&quot;user.dir&quot;)+<br>                                                &quot;\\src\\test\\resources\\config.properties&quot;);<br>        prop = new Properties();<br>        prop.load(fileInputStream);<br>}</pre><p>So instead of hardcoding the details like browser, environment, URL etc, we can use this .getProperty();</p><pre>String env = prop.getProperty(&quot;env&quot;);<br>String browser = prop.getProperty(&quot;browser&quot;);</pre><p>Also, I created PropertyFileReader.java class under the src/main/java/utility folder to read data from property files. It can open any .properties file (like testdata.properties), read key-value pairs, and return the value when requested.</p><pre>package utility;<br><br>import java.io.File;<br>import java.io.FileInputStream;<br>import java.io.FileNotFoundException;<br>import java.io.IOException;<br>import java.util.Properties;<br><br>public class PropertyFileReader {<br><br>    private Properties getData(String fileName){<br><br>        File file = new File(System.getProperty(&quot;user.dir&quot;)+&quot;\\src\\test\\resources\\&quot;+fileName+&quot;.properties&quot;);<br><br>        FileInputStream fileInputStream = null;<br><br>        try {<br>            fileInputStream = new FileInputStream(file);<br>        } catch (FileNotFoundException e) {<br>            e.printStackTrace();<br>        }<br><br>        Properties prop = new Properties();<br>        try {<br>            prop.load(fileInputStream);<br>        } catch (IOException e) {<br>            e.printStackTrace();<br>        }<br><br>        return prop;<br>    }<br><br>    public String getProperty(String fileName, String key){<br>        return getData(fileName).getProperty(key);<br>    }<br><br>}</pre><p>Then I created testdata.properties file to store test data using key-value pair like following:</p><pre>#pass<br>pass = test123;</pre><p>Then I created object of the PropertyFileReader.java class inside the test class and called it.</p><pre>PropertyFileReader propertyFileReader = new PropertyFileReader();<br>String pass = propertyFileReader.getProperty(&quot;testData&quot;, &quot;pass&quot;);</pre><p>So I no need to hardcode those data in test class. Like I used this for password using “pass” keyword and assign a value. So I only have to pass this key to the password.</p><pre>registerPage.setPassword(pass);<br>registerPage.setConfirmPassword(pass);</pre><p>And instead of the above TC001_RegisterUserTest.java class, we can simplified the test case by dividing it into several methods (like public void registerUser(){}, public void verifyRegistrationSuccess(){} )inside the same class and call them, so anyone can understand it clearly and easily.</p><p>And, I extended the BaseClass.java to the test case.</p><pre>package testCases;<br><br>import base.BaseClass;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;<br>import pages.HomePage;<br>import pages.RegisterPage;<br>import pages.RegisterSuccessPage;<br>import utility.PropertyFileReader;<br><br>public class TC001_RegisterUserTest extends BaseClass {<br><br>    PropertyFileReader propertyFileReader = new PropertyFileReader();<br>    String pass = propertyFileReader.getProperty(&quot;testData&quot;, &quot;pass&quot;);<br><br>    @Test (groups = &quot;smoke&quot;)<br>    public void TC001(){<br>        registerUser(); //call registerUser method<br>        verifyRegistrationSuccess(); //call verifyRegistrationSuccess method<br>    }<br>    public void registerUser(){<br>        HomePage homePage = new HomePage(driver);<br>        homePage.selectRegisterMenu();<br><br>        RegisterPage registerPage = new RegisterPage(driver);<br>        registerPage.setFirstName(&quot;Uthpala&quot;);<br>        registerPage.setLastName(&quot;Pathirana&quot;);<br>        registerPage.setPhoneNum(071234567);<br>        registerPage.setEmail(&quot;test@gmail.com&quot;);<br>        registerPage.setAddress(&quot;No 112, Albania.&quot;);<br>        registerPage.setCity(&quot;Albania&quot;);<br>        registerPage.setState(&quot;Albania&quot;);<br>        registerPage.setPostalCode(4509);<br>        registerPage.selectCountry();<br>        registerPage.setUserName(&quot;Uthpala123&quot;);<br>        registerPage.setPassword(pass);<br>        registerPage.setConfirmPassword(pass);<br>        registerPage.submit();<br>    }<br><br>    public void verifyRegistrationSuccess(){<br>        RegisterSuccessPage registerSuccessPage = new RegisterSuccessPage(driver);<br>        String actualText = registerSuccessPage.registerSuccessText();<br>        Assert.assertTrue(actualText.contains(&quot;Dear&quot;), &quot;Registration Attempt Failed&quot;);<br>        registerSuccessPage.clickLoginBtn();<br>    }<br>}</pre><p>I added login part to the code as well, so created another test case to add the whole register-login flow with <strong>Home page → Register page → Register success page → Login page → Login success page</strong>.</p><p>TC002_RegisterLoginUserTest.java</p><pre>package testCases;<br><br>import base.BaseClass;<br>import org.testng.Assert;<br>import org.testng.annotations.Listeners;<br>import org.testng.annotations.Test;<br>import pages.*;<br>import utility.PropertyFileReader;<br><br>public class TC002_RegisterLoginUserTest extends BaseClass {<br><br>    PropertyFileReader propertyFileReader = new PropertyFileReader();<br>    String pass = propertyFileReader.getProperty(&quot;testData&quot;, &quot;pass&quot;);<br><br>    @Test (groups = &quot;regression&quot;)<br>    public void TC002() {<br>        registerUser();<br>        verifyRegistrationSuccess();<br>        loginUser();<br>        verifyLoginSuccess();<br>    }<br><br>    public void registerUser(){<br>        HomePage homePage = new HomePage(driver);<br>        homePage.selectRegisterMenu();<br><br>        RegisterPage registerPage = new RegisterPage(driver);<br>        registerPage.setFirstName(&quot;Uthpala&quot;);<br>        registerPage.setLastName(&quot;Pathirana&quot;);<br>        registerPage.setPhoneNum(071234567);<br>        registerPage.setEmail(&quot;test@gmail.com&quot;);<br>        registerPage.setAddress(&quot;No 112, Albania.&quot;);<br>        registerPage.setCity(&quot;Albania&quot;);<br>        registerPage.setState(&quot;Albania&quot;);<br>        registerPage.setPostalCode(4509);<br>        registerPage.selectCountry();<br>        registerPage.setUserName(&quot;Uthpala123&quot;);<br>        registerPage.setPassword(pass);<br>        registerPage.setConfirmPassword(pass);<br>        registerPage.submit();<br>    }<br><br>    public void verifyRegistrationSuccess(){<br>        RegisterSuccessPage registerSuccessPage = new RegisterSuccessPage(driver);<br>        String actualText = registerSuccessPage.registerSuccessText();<br>        Assert.assertTrue(actualText.contains(&quot;Dear&quot;), &quot;Registration Attempt Failed&quot;);<br>        registerSuccessPage.clickLoginBtn();<br>    }<br><br>    public void loginUser(){<br>        LoginPage loginPage = new LoginPage(driver);<br>        loginPage.setlUserName(&quot;Uthpala123&quot;);<br>        loginPage.setlPassword(pass);<br>        loginPage.setlSubmitBtn();<br>    }<br><br>    public void verifyLoginSuccess(){<br>        LoginSuccessPage loginSuccessPage = new LoginSuccessPage(driver);<br>        String actualLoginText = loginSuccessPage.loginSuccessText();<br>        Assert.assertTrue(actualLoginText.contains(&quot;Thank&quot;), &quot;Login Attempt Failed &quot;);<br>    }<br><br>}</pre><h3><strong>TestNG.xml file</strong></h3><p>I created a new testNG.xml file named “QA_Plan1.xml” under package called “xmlPlans” so I can call the test cases here, instead of calling each test case individually.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;https://testng.org/testng-1.0.dtd&quot; &gt;<br><br>&lt;suite name=&quot;QA_Plan1_FE_Automation_Guru99DemoSite&quot;&gt;<br><br>    &lt;test name=&quot;Register User TC&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;testCases.TC001_RegisterUserTest&quot;/&gt;<br><br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br><br>    &lt;test name=&quot;Register and Login User TC&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;testCases.TC002_RegisterLoginUserTest&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br><br><br>&lt;/suite&gt;</pre><p>We can use this kind of .xml files to include several test cases in one file and run them at once.</p><h3><strong>Utility package</strong></h3><p>In this utility package, I included the 2 classes and one whole package. The two classes are:</p><ol><li>PropertyFileReader.java → I mentioned about this earlier.</li></ol><p>2. RetryAnalyzer.java</p><p>And I created a new package called “extentReport” to include the relevant class to extent reports.</p><h3><strong>Extent Reports</strong></h3><p>It’s not enough we do a test automation and say verbally in the daily standup or any other stakeholder meeting. We need to provide a standard report of the summary of the test execution results showing which tests passed, failed, or were skipped. Those reports helps teams to quickly identify what are the issues, track the overall quality of the application, and ensure transparency in the testing process. These reports also support decision-making by giving developers and managers valuable insights into system stability and testing progress, making it easier to monitor improvements and maintain software quality over time.</p><p>There are several kind of test reports are used in the current industry such as Extent Report, TestNG, Allure Reports, Chain Test Reports etc. Among them, we can use a simple report like TestNG which provides basic HTML and XML reports. But they are very simple. When thinking from a client perspective, it is not sufficient. So I used one of the most popular report here: Extent Reports.</p><p><strong>Extent Report</strong> is a tool that generates reports in multiple formats, including HTML, PDF, and email, offering a good overview of test executions. It is an open-source reporting library. It can be easily integrated with major testing frameworks like JUnit, NUnit, TestNG, etc. They also allow the generation of custom logs, snapshots, and other customized details.</p><p>How to integrate the extent reports with TestNG.xml:</p><ol><li>First I added the dependency — <a href="https://mvnrepository.com/artifact/com.aventstack/extentreports">https://mvnrepository.com/artifact/com.aventstack/extentreports</a></li><li>Then setup the extent report configuration .</li></ol><p>Here, I created a separate package named as “extentReports‘ under the utility package and created new class as ExtentReportUtility.java.</p><pre>public class ExtentReportUtility {<br><br>    public static ExtentSparkReporter sparkReporter;<br><br>    public static ExtentReports extent;<br>    public static ExtentTest test;<br><br>//configuration of extent report    <br>public static void startReporter(){<br>        sparkReporter = new ExtentSparkReporter(System.getProperty(&quot;user.dir&quot;)+&quot;//test-output//extentReports//ExtentReport.html&quot;);<br>        sparkReporter.config().setDocumentTitle(&quot;Automation Test Report for Guru99 Demo Site&quot;);<br>        sparkReporter.config().setReportName(&quot;Test Report for Guru99 Demo Site&quot;);<br>        sparkReporter.config().setTheme(Theme.DARK);<br><br>        extent = new ExtentReports();<br>        extent.attachReporter(sparkReporter);<br><br>        extent.setSystemInfo(&quot;Environment&quot;, &quot;QA&quot;);<br>        extent.setSystemInfo(&quot;ProjectName&quot;, &quot;FE_Automation_Guru99DemoSite&quot;);<br>        extent.setSystemInfo(&quot;Browser&quot;, &quot;Chrome&quot;);<br>        extent.setSystemInfo(&quot;Operating Systems&quot;, System.getProperty(&quot;os.name&quot;));<br>        extent.setSystemInfo(&quot;java Version&quot;, System.getProperty(&quot;java.version&quot;));<br>        extent.setSystemInfo(&quot;Tester&quot;, System.getProperty(&quot;user.name&quot;));<br>    }<br><br>    public static void createTest(String testName){<br>        test = extent.createTest(testName);<br>    }<br><br>    public static void endReport(){<br>        extent.flush();<br>    }<br><br>    //Add screenshots to the extent report - using base64<br>    public static void captureScreenShotAtBase64_ReportOnly_StepInfo(WebDriver driver, String message){<br>        String base64 = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);<br>        test.info(message, MediaEntityBuilder.createScreenCaptureFromBase64String(base64).build());<br>    }<br><br>    public static void captureScreenShotAtBase64_ReportOnly_FailCase(WebDriver driver, String message){<br>        String base64 = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);<br>        test.fail(message, MediaEntityBuilder.createScreenCaptureFromBase64String(base64).build());<br>    }<br><br>    public static void captureScreenShotAtBase64_ReportOnly_SkipCase(WebDriver driver, String message){<br>        String base64 = ((TakesScreenshot) driver).getScreenshotAs(OutputType.BASE64);<br>        test.skip(message, MediaEntityBuilder.createScreenCaptureFromBase64String(base64).build());<br>    }<br>}</pre><p>Like this, I setup the configuration and I added some screen shots using Base64 to the report, we can directly append the screen shots to the extent report.</p><p>3. Then created a Listener class to make action based on the test result.</p><p>Here, I created another class called, “ExtentReportListenerManager.java”</p><pre>public class ExtentReportListenerManager extends BaseClass implements ITestListener{<br><br>    public void onTestStart(ITestResult result){<br>        String testName = result.getTestClass().getName() + &quot; - &quot; + result.getMethod().getMethodName();<br>        ExtentReportUtility.createTest(testName);<br>        ExtentReportUtility.test.info(&quot;Started Test Execution: &quot;+result.getMethod().getMethodName());<br>    }<br><br>    public void onTestSuccess(ITestResult result){<br>        ExtentReportUtility.test.pass(&quot;Test case passed: &quot;+result.getName());<br>    }<br><br>    public void onTestFailure(ITestResult result){<br>        ExtentReportUtility.test.fail(result.getName()+&quot; - Test case failed&quot;);<br>        ExtentReportUtility.test.fail(result.getThrowable());<br>        ExtentReportUtility.captureScreenShotAtBase64_ReportOnly_FailCase(driver, result.getName()+&quot;_failed_point_screenshot&quot;);<br>    }<br><br>    public void onTestSkipped(ITestResult result){<br>        ExtentReportUtility.test.skip(result.getName()+&quot; - Test case skipped&quot;);<br>        ExtentReportUtility.captureScreenShotAtBase64_ReportOnly_SkipCase(driver, result.getName()+&quot;_skipped_point_screenshot&quot;);<br>    }<br>}</pre><p>4. Finally added ExtentReportListnerManager.java class either at test class level individually or in testng.xml file.</p><p>I included the listener to the “QA_Plan1.xml” file so it will affect to all the test cases in the same test suite.</p><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; ?&gt;<br>&lt;!DOCTYPE suite SYSTEM &quot;https://testng.org/testng-1.0.dtd&quot; &gt;<br><br>&lt;suite name=&quot;QA_Plan1_FE_Automation_Guru99DemoSite&quot;&gt;<br><br>    &lt;listeners&gt;<br>        &lt;listener class-name=&quot;utility.extentReport.ExtentReportListenerManager&quot;&gt;&lt;/listener&gt;<br>    &lt;/listeners&gt;<br><br>    &lt;test name=&quot;Register User TC&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;testCases.TC001_RegisterUserTest&quot;/&gt;<br><br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br><br>    &lt;test name=&quot;Register and Login User TC&quot;&gt;<br>        &lt;classes&gt;<br>            &lt;class name=&quot;testCases.TC002_RegisterLoginUserTest&quot;/&gt;<br>        &lt;/classes&gt;<br>    &lt;/test&gt;<br><br>&lt;/suite&gt;</pre><p>So when I run the test plan, it automatically creates an extent report:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*9aBVZi8l5eLN8l4EDcn46A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LNQ2MDplCn10TkjMUk9tmg.png" /></figure><p>With the use of any browser mentioned here, we can easily get an extent report.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z14w2v49qjOlOBVvb-N6dA.png" /></figure><p>Let’s see the extent report related to the above test suite execution.</p><p><em>Note: Here I used 2 test cases for the execution but displayed 4 test runs. It because I used rerun method for test cases and it will be mentioned later here.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XieQIK0jTcSWGONEA9E7oQ.png" /></figure><p>This is the extent report. It clearly gives us all the needed details including what are the passed test cases, failed test cases, skipped/ignored test cases. And all other details like execution time, data, report name etc.</p><p>Not only that, we can get this kind of summary of our test execution. It gives a nice, easily understand report using pie charts with the relevant colors for pass/fail/skip test cases.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WrsgXX1utzt6VZlZ9xm1hQ.png" /></figure><p>And also it gives all the details we provided about the test execution system/environment during configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wLXoOpJAmfMb6ICs6XYwJg.png" /></figure><p>Additionally, since I used the base64 to appened the screen shots in failure/skipping points, they also are displyed here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1g-rSZPRtiOl_QzgFDvadg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WMCAIsP86OeGC-LuG9VP0Q.png" /></figure><p>So it is very clear and easy to understand for any stakeholder about the summary of test execution.</p><h3><strong>Re-run failed test cases</strong></h3><p>During test execution, some test cases are failed, which is a normal occurrence. To identify whether these failures are temporary or consistent, we need to rerun those failed test cases.</p><p>I used “IAnnotationTransformer” with “IRetryAnalyzer” to re-run the test cases automatically.</p><p>Initially I created “RetryAnalyzer.java” class inside the utility package and configured it like following:</p><pre>package utility;<br><br>import org.testng.IRetryAnalyzer;<br>import org.testng.ITestResult;<br><br>public class RetryAnalyzer implements IRetryAnalyzer {<br><br>    int failedCount = 0;<br>    int maxRetryCount = 2;<br><br>    @Override<br>    public boolean retry(ITestResult iTestResult) {<br>        if (failedCount&lt;maxRetryCount){<br>            failedCount++;<br>            return true;  //retry the test<br>        }<br>        return false;<br>    }<br>}</pre><p>We can customize this maxRetryCount as we wish how many times we want to re-run the failed/skipped test cases.</p><p>We can add this into each test case individually like following:</p><pre>@Test(retryAnalyzer = RetryAnalyzer.class)<br>public void TC001(){<br>  //code<br>}</pre><p>But this is time consuming and if there are 1000 test cases, we have to add this manually. Therefore I used IAnnotationTransformer with this IRetryAnalyzer.</p><p>For that we can easily implement this interface in to the ExtentReportListenerManager.java class which I created before.</p><p>And I did override the transform(){} method like following:</p><pre>public class ExtentReportListenerManager extends BaseClass implements ITestListener, IAnnotationTransformer {<br><br>    @Override<br>    public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod) {<br>        annotation.setRetryAnalyzer(RetryAnalyzer.class);<br>    }<br><br>    public void onTestStart(ITestResult result){<br>        String testName = result.getTestClass().getName() + &quot; - &quot; + result.getMethod().getMethodName();<br>        ExtentReportUtility.createTest(testName);<br>        ExtentReportUtility.test.info(&quot;Started Test Execution: &quot;+result.getMethod().getMethodName());<br>    }<br><br>    public void onTestSuccess(ITestResult result){<br>        ExtentReportUtility.test.pass(&quot;Test case passed: &quot;+result.getName());<br>    }<br><br>    public void onTestFailure(ITestResult result){<br>        ExtentReportUtility.test.fail(result.getName()+&quot; - Test case failed&quot;);<br>        ExtentReportUtility.test.fail(result.getThrowable());<br>        ExtentReportUtility.captureScreenShotAtBase64_ReportOnly_FailCase(driver, result.getName()+&quot;_failed_point_screenshot&quot;);<br>    }<br><br>    public void onTestSkipped(ITestResult result){<br>        ExtentReportUtility.test.skip(result.getName()+&quot; - Test case skipped&quot;);<br>        ExtentReportUtility.captureScreenShotAtBase64_ReportOnly_SkipCase(driver, result.getName()+&quot;_skipped_point_screenshot&quot;);<br>    }<br>}</pre><p>So, since I added the listener to the .xml file, when we run the .xml plan, the failed/skipped test cases are run according to this “maxRetryCount” which is 2, as I customized.</p><p>And that’s why there are 4 test runs and it clearly displays in the extent report: 1st test case has been passed. 2nd test cases has been skipped. So it has been re-run another 2 times, to confirm whether these failures are temporary or consistent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8W9Ay-iEaL3iMXHbVknIvQ.png" /></figure><h3><strong>Test cases grouping</strong></h3><p>We have to group the test cases into smoke or regression testing groups so they can be run together based on their purpose. This grouping concept is important because it helps to run only the needed tests instead of executing the whole test suite. It saves time, improves test management, and makes it easy to focus on specific areas of testing.</p><p>I included TestNG grouping concept in all test cases.</p><p>ex: @ Test(groups = “smoke”).</p><p>We should group each &amp; every TestNG annotation like this. Since there are common annotations like @BeforeMethod, @AfterSuite etc. in BaseClass.java, we have to put all groups there.</p><p>ex: @BeforeMethod (groups = {“smoke”, “regression”})</p><p>Then in .xml files, I called like this.</p><pre>&lt;groups&gt;<br>    &lt;run&gt;<br>        &lt;include name=&quot;regression&quot;/&gt;<br>    &lt;/run&gt;<br>&lt;/groups&gt;</pre><p>Since I used the extent report, I added a line inside onTestSuccess(), onTestFailure() and onTestSkipped() methods in “ExtentReportListenerManager.java” class, to display groups in the report.</p><pre>ExtentReportUtility.test.assignCategory(result.getMethod().getGroups());</pre><p>This is the extent report of my test execution. It gives clearly about which group has been executed with the test result.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ry2XuApXXcWLv_wBUBFUFQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cTdJqyDFlBs5SKq92mEibQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ABWL5T2eIwODcxwq5PyOpA.png" /></figure><p>So I tried to demonstrate how a well-structured automation framework using Selenium, Java and TestNG with Page Object Model, can significantly improve the efficiency, maintainability, and scalability of web UI testing. Even though this is only for login-registration flow, I included some important concepts of the automation framework such as POM with Page Factory, Cross Browser testing, implicit waits, how to handle different environments, property files, test reporting using extent reports, re-run test cases, grouping test cases etc.</p><p>Overall, building this framework gives me a solid foundation of web UI automation to understand how to structure tests professionally, manage reusable components, create a setup that is scalable, maintainable, and easy to extend as projects grow.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5860792f040" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[REST API Testing Simplified: Practical Examples of REST API Automation Using Rest Assured]]></title>
            <link>https://medium.com/@uthpalanp/rest-api-testing-simplified-practical-examples-of-rest-api-automation-using-rest-assured-e16f95ff8a13?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/e16f95ff8a13</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Wed, 24 Sep 2025 04:36:45 GMT</pubDate>
            <atom:updated>2025-09-24T04:44:30.926Z</atom:updated>
            <content:encoded><![CDATA[<p>In my <a href="https://medium.com/@uthpalanp/api-testing-with-rest-assured-concepts-setup-and-implementation-59de590c64a6">first article</a>, I talked about the basics of Rest Assured and explained how to set up a simple GET request. In this second article, I will take you further by walking through all major HTTP methods (GET, POST, PUT, PATCH, and DELETE) with practical code examples.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u6e0P1mKUnIlwXJo5nZDqg.png" /></figure><p>Let’s start with GET method!</p><p>Here, I have created a java class named “GetAndPostExamples.java” under the src/test/java folder. And then I imported the whole RestAssured class to the project as a “static” so I can directly use the methods in RestAssured class. Next I created a method named “testGet()” and converted it into a test method using “@Test” annotation.</p><pre>import org.testng.annotations.Test;<br>import static io.restassured.RestAssured.*;<br>import static org.hamcrest.Matchers.*;<br><br>public class GetAndPostExamples {<br>    <br>    @Test<br>    public void testGet(){<br>        baseURI = &quot;https://reqres.in/api&quot;;<br><br>        given().<br>           get(&quot;/users?page=2&quot;).<br>        then().<br>           statusCode(200).<br>           body(&quot;data[4].first_name&quot;, equalTo(&quot;George&quot;)).<br>           body(&quot;data.first_name&quot;, hasItems(&quot;George&quot;, &quot;Rachel&quot;));<br>    }<br>}</pre><p>Here, I used a new variable called “baseURI” to assign the base URI of the application. I can directly assign it because I have imported the RestAssured statically (since it is a static field of RestAssured class). If not, I have to write the code like this:</p><pre>RestAssured.baseURI = &quot;https://reqres.in/api&quot;;</pre><p>So here, the full URL of the application is “<a href="https://reqres.in/api/users?page=2">https://reqres.in/api/users?page=2</a>” but here we use “https://reqres.in/api” part only.</p><p>Actually why we use this baseURI? If we don’t set it, we have to write the full URL in each and every request which is repetitive and harder to maintain.</p><pre>given().<br>   get(&quot;https://reqres.in/api/users?page=2&quot;).<br>then().<br>   statusCode(200);</pre><p>Think if the API base changes, we have to change each and every place we used it in the code or project. Therefore, RestAssured has provided a baseURI which is a public static variable, to set a<strong> </strong>common base address for all API calls.</p><p>Now, I set up the request. Here I have used the BDD (Behavioural Data Driven) format using keywords like “given, then” etc.</p><p>given() : Start of a RestAssured request specification. (Used to set up things like headers, params, body, etc.)</p><p>when() : Marks the action step in the BDD flow to indicates <em>when</em> the actual HTTP request is sent. (Comes after given() (request setup) and is followed by the HTTP method like get(), post(), put(), or delete().)</p><p>then() : Switches to response validation mode. (After this, we can write assertions on the response.)</p><p>These keywords actually say something like this:</p><p><strong><em>Given</em></strong><em> some preconditions,<br></em><strong><em>When</em></strong><em> I send a GET request,<br></em><strong><em>Then</em></strong><em> I expect this result (ex: I expect the status code should be 200).</em></p><p>So we can write the above code, more elaborately, to well understand like this too:</p><pre>@Test<br>public void testGet(){<br>    baseURI = &quot;https://reqres.in/api&quot;;<br><br>    given().<br>        headers(&quot;Content-Type&quot;, &quot;application/json&quot;).<br>        accept(ContentType.JSON).<br>    when().<br>       get(&quot;/users?page=2&quot;).<br>    then().<br>       statusCode(200).<br>       body(&quot;data[4].first_name&quot;, equalTo(&quot;George&quot;)).<br>       body(&quot;data.first_name&quot;, hasItems(&quot;George&quot;, &quot;Rachel&quot;));<br><br>}</pre><p>Here we gave the preconditions, sent the request method and mentioned the expected results.</p><p>Now let’s go to then() part. Here we expects 3 things:</p><ol><li>Status code should be 200</li><li>First name of the 5th element should equals to “George”</li><li>In the element set’s first name should be included these 2 names : “George” and “Rachel”. Here we use “hasItems” keyword to include all the data items.</li></ol><p>Here I used “JSON Path Finder” online too to convert this code more user friendly way. We have to click on “Beautify” button only!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PtJ-XVpZOpYVqXyUQofSrw.png" /></figure><p>It gives the data of the array data[] like this. So we can clearly see the 5th element has the first name “George” so we want to retrieve it. We can get the path as “data[4].first_name” from the path in the top of the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Moaw6ONrie5ck5I3_oNK8g.png" /></figure><p>Let’s run the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2p2fKHH1eyAhZe1EViHhZw.png" /></figure><p>The test is passed!</p><p>Let’s give one of the name incorrectly in first name item list.</p><pre>body(&quot;data.first_name&quot;, hasItems(&quot;George&quot;, &quot;Racheal&quot;));  // It should be &quot;Rachel&quot;</pre><p>And it points out the error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xEcKvfe95EjKPIHuxW-O1A.png" /></figure><p>The expected results do not match with the actual result. So the test is failed!</p><p>Now let’s see how to create a POST request using RestAssured!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*87UyQ7zPoMzZ9ArgVVB6AQ.png" /></figure><p>This is not JSON response. JSON response should be like this:</p><pre>{<br>    &quot;name&quot;: &quot;Anne&quot;,<br>    &quot;job&quot;: &quot;Doctor&quot;<br>}</pre><p>To convert to a JSON format we have to do insert backslashes like this. But this will be time consuming and not the correct way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xZRZw9DQYoVM0S48s4TUvA.png" /></figure><p>To do that, I have added the following JSON.simple dependency from Google to my pom.xml file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffd_TPVv_eRj1u4r7AN4Ug.png" /></figure><p>So now I create a object for JSONObject which comes from “org.json.simple”, using the reference variable called “request”, and put the “map” which we created before, inside the object. And then print the “request”.</p><pre>JSONObject request = new JSONObject(map);<br><br>System.out.println(request);</pre><p>Let’s run the project and see the results:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8EuLHMrx8P7eBMRy0V7gTg.png" /></figure><p>I can use this “toJSONString()” for validating, so I can make sure that request is converted to a JSON string.</p><pre>System.out.println(request.toJSONString());</pre><p>Since I have used the JSON object, I can directly use it without using map. When we use the created reference variable “request.” it is provided several methods that we can use with. And there is a method called “put(Object key, Object value)” which is similar to the map we used before. Let’s use this to add the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/391/1*dtc5-Oek5JHDrVgarYPWpw.png" /></figure><p>And I have created the code like this:</p><pre>JSONObject request = new JSONObject();<br><br>request.put(&quot;name&quot;, &quot;Anne&quot;);<br>request.put(&quot;job&quot;, &quot;doctor&quot;);<br>System.out.println(&quot;After using JSONObject:&quot;);<br>System.out.println(request.toJSONString());</pre><p>Now let’s run the code and see the output. It gives the response in JSON format!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TA8IgiMuUBR3vFwQvZ1r3w.png" /></figure><p>Let’s use the base URL and create a POST request!</p><p>Before that, we can see the URL and the status code for POST request which has been given in the reqres website.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uPUgMdzVnXMKzCAAUGnYDQ.png" /></figure><p>So I have created my POST request like this:</p><pre>JSONObject request = new JSONObject();<br><br>request.put(&quot;name&quot;, &quot;Anne&quot;);<br>request.put(&quot;job&quot;, &quot;doctor&quot;);<br><br>System.out.println(&quot;After using JSONObject:&quot;);<br>System.out.println(request.toJSONString());<br><br>baseURI = &quot;https://reqres.in/api&quot;;<br><br>given().<br>   body(request.toJSONString()).<br>when().<br>   post(&quot;/users&quot;).<br>then().<br>   statusCode(201).<br>   log().all();</pre><p>When run the code, I have faced to this error. It give some authentication error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JXQcX20sSYtHlt0mMSNy5w.png" /></figure><p>So I have to include “header(“x-api-key”, “reqres-free-v1”)” to the code because that API requires authentication like maybe a token, API key, or basic auth. So I get the free API key from the same site and add it to the code like this inside a header():</p><pre>given().<br>   header(&quot;x-api-key&quot;, &quot;reqres-free-v1&quot;).<br>   body(request.toJSONString()).<br>when().<br>   post(&quot;/users&quot;).<br>then().<br>   statusCode(201).<br>   log().all();</pre><p>And now the test is passed as it responsed with “201 Created” and give the response body as :</p><p><em>{<br> “id”: “649”,<br> “createdAt”: “2025–09–23T05:52:16.334Z”<br>}</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p2gd_eMk8SpLiOpqy9f1Qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VawF8xKYVXWHZMCS7UB-IA.png" /></figure><p>For the given() method, we can add some headers like this:</p><pre>given().<br>   header(&quot;Content-Type&quot;, &quot;application/JSON&quot;). //Manually adds a request header named Content-Type with value application/JSON.<br>                                               //Tells the server: “I am sending JSON data in my request body.”<br>   contentType(ContentType.JSON). //A RestAssured shortcut that sets the same header automatically:<br>   accept(ContentType.JSON).  //Tells the server: “I expect the response back in JSON format.” (Without this, some APIs might default to XML, HTML, or another format.)</pre><p>These headers affect the HTTP <strong>request</strong>:</p><ul><li><strong>Content-Type</strong> → What <em>we send</em> (request body format).</li><li><strong>Accept</strong> → What <em>we want back</em> (response format).</li></ul><p>Let’s run the full code with the newly added headers and the test is passed and give this response body:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IdBTAZJEzma3GBVpnl0uWg.png" /></figure><p>Here, since we told the server clearly that we are sending JSON and expecting JSON back, so the server echoed our data (name, job) along with id and createdAt.</p><p>So this is how we can create a simple POST request using REST Assured!</p><p>Let’s create PUT request!</p><p>First let’s see what is the relavant URL and the status code for PATCH.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZOWj4bf13qZ4KH6sMyrtyw.png" /></figure><p>It says “200 OK” should be the status code and given the request, response bodies as well.</p><pre>import io.restassured.http.ContentType;<br>import org.json.simple.JSONObject;<br>import org.testng.annotations.Test;<br><br>import static io.restassured.RestAssured.baseURI;<br>import static io.restassured.RestAssured.given;<br><br>public class PutPatchAndDeleteExamples {<br><br>    @Test<br>    public void testPut(){<br>        JSONObject requestPut = new JSONObject();<br><br>        requestPut.put(&quot;name&quot;, &quot;Anne&quot;);<br>        requestPut.put(&quot;job&quot;, &quot;Dentist&quot;);<br><br>        System.out.println(requestPut.toJSONString());<br><br>        baseURI = &quot;https://reqres.in/api&quot;;<br><br>        given().<br>           headers(&quot;Content-Type&quot;, &quot;application/JSON&quot;).<br>           header(&quot;x-api-key&quot;, &quot;reqres-free-v1&quot;).<br>           contentType(ContentType.JSON).<br>           accept(ContentType.JSON).<br>           body(requestPut.toJSONString()).<br>        when().<br>           put(&quot;/users/2&quot;).<br>        then().<br>           statusCode(200).<br>           log().all();<br><br>    }<br>}</pre><p>I created a new class to use all 3 test cases for PUT, PATCH and DELETE methods. This is the complete code for PUT request. Here, I want to update the job of Anne as a Dentist.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B4lb828iKq-hWKtwv1-WoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gIYEJMa2-xV7F_JpOErdYg.png" /></figure><p>The test has been successfully passed with “200 OK” status code and response body says that it was updated as well.</p><p>Let’s do the PATCH request as well. It has the similar structure to PUT request so we have to change only the method name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ztw9xv2SJeBZPnzPER0EQ.png" /></figure><p>This is the test case I have created.</p><pre>@Test<br>public void testPatch(){<br>    JSONObject requestPut = new JSONObject();<br><br>    requestPut.put(&quot;name&quot;, &quot;Anne Perera&quot;);<br>    requestPut.put(&quot;job&quot;, &quot;Dentist&quot;);<br><br>    System.out.println(requestPut.toJSONString());<br><br>    baseURI = &quot;https://reqres.in/api&quot;;<br><br>    given().<br>       headers(&quot;Content-Type&quot;, &quot;application/JSON&quot;).<br>       header(&quot;x-api-key&quot;, &quot;reqres-free-v1&quot;).<br>       contentType(ContentType.JSON).<br>       accept(ContentType.JSON).<br>       body(requestPut.toJSONString()).<br>    when().<br>       patch(&quot;/users/2&quot;).<br>    then().<br>       statusCode(200).<br>       log().all();<br>}</pre><p>It was successfully passed!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uo86arO49QFwpMDCix1k2w.png" /></figure><p>Now let’s see how the DELETE method will work!</p><p>This is the request URL and the status code which is “204” to say no content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQPhqVs-WVwHkFklHk0dRA.png" /></figure><p>And I created the test case like this:</p><pre>@Test<br>public void testDelete(){<br><br>    baseURI = &quot;https://reqres.in/api&quot;;<br><br>    given().<br>      header(&quot;x-api-key&quot;, &quot;reqres-free-v1&quot;).<br>    when().<br>       delete(&quot;/users/2&quot;).<br>    then().<br>       statusCode(204).<br>       log().all();<br>}</pre><p>So the output has been given like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*St83vpuw7mbXbTQ-5d03GA.png" /></figure><p>The test is passed!</p><p>So this is how we can test the different RESTFul APIs using REST Assured library very easily.</p><p>In this article, we explored how to perform GET, POST, PUT, PATCH, and DELETE requests using Rest Assured. We saw how to simplify API testing with features like baseURI, headers, request bodies, and assertions for response validation. With just a few lines of code, Rest Assured makes API testing readable, maintainable, and powerful.</p><p>The biggest advantage of Rest Assured is its <strong>simplicity and readability</strong>. It allows us to write tests in a BDD-style format that not only works efficiently but is also easy to maintain as APIs evolve. Whether we’re testing a small service or a large enterprise-level application, Rest Assured gives us the flexibility and power to automate API validation with confidence!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e16f95ff8a13" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Testing with REST Assured: Concepts, Setup, and Implementation]]></title>
            <link>https://medium.com/@uthpalanp/api-testing-with-rest-assured-concepts-setup-and-implementation-59de590c64a6?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/59de590c64a6</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Wed, 17 Sep 2025 07:37:27 GMT</pubDate>
            <atom:updated>2025-09-17T07:37:27.462Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FdL9p3VSUfs4Zli3.jpg" /></figure><p>API (Application Programming Interface) is an application which runs on the server, enabling other applications to get the data from the server is an easy to use format. This helps to return the data in format(such as XML/JSON) that computer can easily understand.</p><p>Let’s get an simple day-to-day life scenario to understand more about this APIs. Think about the process of a restaurant. There are mainly 3 categories. Customers, Waiters, Kitchen. When customer select the food item from the menu, waiter gets that order and passes to the kitchen. After prepared the order, again waiter gets the prepared food order and return to the customer. This is very simple process that we all know.</p><p>This is exactly how the APIs are working. When client computer/frontend requests something, API delivers that to the server computer/backend, and then API returns the response from the server to client. Relevant to the above restaurant scenario, the customer acts as the client (ex: browser, web/mobile app), waiter acts as the API and kitchen acts as the server (ex: backend where the process happens).</p><p><strong>What are the REST APIs?</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ValmIrvN6FopnCgq1ZX3dA.png" /></figure><p>REST (Representational State Transfer) APIs allows communication between different systems over the internet. They are worked by sending requests and receiving responses, typically in JSON format, between the client and server. <br>Following are the common REST APIs:</p><ul><li>GET: Retrieve data.</li><li>POST: Create new data.</li><li>PUT: Fully update exiting data.</li><li>PATCH: Partially update existing data.</li><li>DELETE: Remove data.</li></ul><p><strong>Introduction to API Testing</strong></p><p>API testing is a testing type which focuses on the testing of individual API methods and the interactions between different APIs. This is typically performed after unit testing, at the integration level and before UI testing begins. The main purpose of this testing is to validate that the certain API behaves correctly and it meets the specified requirements of the system.</p><p>Following are the key aspects that we test in an API:</p><ol><li>Correctness: Check whether the API returns the correct response for a valid request.</li><li>Reliability: Check whether the API consistently available and stable.</li><li>Error Handling: Check whether it gives and correct error message and error code for invalid or bad request.</li><li>Data Integrity: Check whether the data in response body is accurate, well-structured and complete?</li><li>Security: Check whether the authentication and authorization mechanisms are working correctly.</li><li>Performance: Check how quickly does the API respond under load?</li></ol><p>And let’s see why this API testing is important.</p><ul><li>It helps for early testing to catch bugs earlier before the UI is developed.</li><li>Comparing UI tests, API testing is more faster and stable which gives the faster feedback and lower the maintenance costs.</li><li>API act as the core of the application which gives the broader test coverage.</li></ul><p><strong>What is REST Assured?</strong></p><p>REST Assured is an open-source Java library for testing RESTful web services. . It provides domain-specific language (DSL) for writing powerful and easy-to-maintain tests for RESTful APIs. It can be used to test XML as well as JSON based web services.</p><p>REST Assured supports POST, GET, PUT, DELETE, OPTIONS, PATCH &amp; HEAD requests and can be used to validate &amp; verify the responses of those requests. It also can be integrated with testing frameworks such as JUnit, TestNG etc. and implemented in Groovy.</p><p>One of the key point is, it uses BDD style for testing, with the use of keywords like “Given, When, Then” etc.</p><p><strong>Key features &amp; advantages</strong></p><ul><li>Easy data handling: REST Assured automatically reads and extracts the data from JSON/XML responses. No complex parsing needed.</li><li>Authentication Support: It secure APIs easily with built-in support for tokens, passwords (OAuth2, Basic Auth).</li><li>Session and Cookies Handling: It automatically handles cookies by letting user to test multi-step user workflows seamlessly.</li><li>File Uploads/Downloads: This allows upload and download files to and APIs and verify them in our tests. (ex: login -&gt; action)</li><li>Flexible Validation: It performs assertions using our preferred testing framework like JUnit, TestNG and assertion libraries like Hamcrest, AssertJ.</li></ul><p><strong>Prerequisites (Java, Maven/Gradle, IDE)</strong></p><p>To start working with Rest Assured, we need following prerequisites:</p><ol><li>Java JDK (Version 8 or higher)</li><li>IDE (Eclipse, IntelliJ)</li><li>Build tool (Maven or Gradle)</li><li>Testing framework (TestNG or JUnit)</li></ol><p><strong>Setting up the project (Maven Dependency)</strong></p><p>Step 1: We have to create a Maven project in our IDE. I used IntelliJ IDE.</p><p>Step 2: Then we should add the following dependencies to the pom.xml file.</p><ol><li>REST Assured core dependency</li><li>TestNG for test execution and assertions</li></ol><p>All these dependencies can be copied from “Maven Repository” official website. (Link: <a href="https://mvnrepository.com/"><em>https://mvnrepository.com/</em></a>)</p><pre>&lt;dependencies&gt;<br>    &lt;!-- https://mvnrepository.com/artifact/io.rest-assured/rest-assured --&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;io.rest-assured&lt;/groupId&gt;<br>        &lt;artifactId&gt;rest-assured&lt;/artifactId&gt;<br>        &lt;version&gt;5.5.6&lt;/version&gt;<br>        &lt;scope&gt;test&lt;/scope&gt;<br>    &lt;/dependency&gt;<br>    &lt;!-- https://mvnrepository.com/artifact/org.testng/testng --&gt;<br>    &lt;dependency&gt;<br>        &lt;groupId&gt;org.testng&lt;/groupId&gt;<br>        &lt;artifactId&gt;testng&lt;/artifactId&gt;<br>        &lt;version&gt;7.11.0&lt;/version&gt;<br>        &lt;scope&gt;test&lt;/scope&gt;<br>    &lt;/dependency&gt;<br>&lt;/dependencies&gt;</pre><p>Step 3: Write the Test</p><p>For this project, I used “<em>Reqres.com”</em> website (Link:<em> </em><a href="https://reqres.in/"><em>https://reqres.in/</em></a>) which we can get more sample APIs for testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kk32sPOvwAs7SlpRx6COmQ.png" /></figure><p>Here, I used non-BDD syntax since this is the first project. I created a java class as “APITests.java” under the src/test/java folder.</p><p>Let’s learn some basics of how to use REST Assured in our project!</p><pre>import io.restassured.RestAssured;<br>import io.restassured.response.Response;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;<br><br>public class APITests {<br><br>    @Test<br>    void test1(){<br>        Response response = RestAssured.get(&quot;https://reqres.in/api/users?page=2&quot;);<br><br>        System.out.println(&quot;Response : &quot;+response.asString());<br>        System.out.println(&quot;Status code : &quot;+response.getStatusCode());<br>        System.out.println(&quot;Body : &quot;+response.getBody().asString());<br>        System.out.println(&quot;Time taken : &quot;+response.getTime());<br>        System.out.println(&quot;header : &quot;+response.getHeader(&quot;content-type&quot;));<br><br>    }<br><br>}</pre><p>This is the code that I created.</p><p>Here I created a method called test1() with void return type, and convert it into a test, using “@Test” annotation from org.testng.annotations.</p><p>Now I have created GET method using REST Assured as “RestAssured.get(“https://reqres.in/api/users?page=2&quot;);” to request to get data. So if I want to store the response in some variable, I can use the “Response” class which comes from REST Assured and created a reference variable as “response”.</p><pre>Response response = RestAssured.get(&quot;https://reqres.in/api/users?page=2&quot;);</pre><p>Meanwhile, we have to import the relevant classes to the project when they are needed. As you can see, I have only imported the classes from TestNG and REST Assured:</p><pre>import io.restassured.RestAssured;<br>import io.restassured.response.Response;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;</pre><p>So now I can get the details like status code, response body, time, header etc. using this “response” reference variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*IYKeQThUOH81dLwz7fbK7A.png" /></figure><p>As an example, let’s get some data as following:</p><pre>response.getStatusCode();<br>response.getBody();<br>response.getTime();</pre><p>Since I want to print these data in my console, I put those inside the print statement for better readability and understanding the output.</p><pre>System.out.println(&quot;Response : &quot;+response.asString()); //to get the entire response in string form (JSON in this case)<br>System.out.println(&quot;Status code : &quot;+response.getStatusCode()); //Prints the HTTP status code (expected: 200)<br>System.out.println(&quot;Body : &quot;+response.getBody().asString()); // Prints just the response body.<br>System.out.println(&quot;Time taken : &quot;+response.getTime()); //Prints how long the request took (in milliseconds).<br>System.out.println(&quot;header : &quot;+response.getHeader(&quot;content-type&quot;)); //Prints the Content-Type header (expected: application/json; charset=utf-8).</pre><p>And let’s run the test and here the output we got.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tVFKpQFkgm8I5Rb83Xt3dg.png" /></figure><p>It gives the details that we required to print on the console and the TestNG report as following. And the process has been finished without any errors as it “exits code 0”.</p><p>This is clear and simple project, but we should validate the response using assertions.</p><p>So let’s see how to validate the status code using <em>assertEquals</em> to 200. We can simply write the code as following:</p><pre>Assert.assertEquals(response.getStatusCode(), 200);</pre><p>For better readability and reusability, I have written it by storing a variable “statusCode”.</p><pre>int statusCode = response.getStatusCode();<br>Assert.assertEquals(statusCode, 200);</pre><p>Since this is a GET method and the success response should give the 200 code, we equaled it to the 200. And lets see the output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*otxWcUKmfxrmvOGjDl94EQ.png" /></figure><p>The test has been passed!</p><p>Now let’s see what would happen when we equal a wrong status code here. I used 201 as the expected code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PixR28y3A-TfoVoSza4kOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RkOSuqDyU1oIypVMKXJQLQ.png" /></figure><p>The test was failed!</p><p>It gives a <strong>java.lang.AssertionError</strong> by explaining that expected status code should be 201, which we gave in the test, but it retrieves the status code 200. So the actual code is not equal to the expected one.</p><p>And it gives also which code line has the error. Here, code line 19 is the reason for this error. So we can easily resolve that error.</p><p>And if we want to import all the things in REST Assured library to this code, we can simply import it like this:</p><pre>import static io.restassured.RestAssured.*;</pre><p>Then we no need to write the <em>RestAssured.get(“https://reqres.in/api/users?page=2&quot;);</em> here so we can directly write it as:</p><pre>Response response = get(&quot;https://reqres.in/api/users?page=2&quot;);</pre><p>And, instead of using several code lines to get the status code, we can write it just using a one line. For that, I created another test as “test2()” in this same Java class.</p><pre>@Test<br>void test2(){<br><br>    given().get(&quot;https://reqres.in/api/users?page=2&quot;).then().statusCode(200);<br>}</pre><p>This is from BDD (Behavioural Data Driven) style. We can use this easily because we have imported all the things of the REST Assured class to the project. And my final project is like this:</p><pre>import static io.restassured.RestAssured.*;<br>import io.restassured.response.Response;<br>import org.testng.Assert;<br>import org.testng.annotations.Test;<br><br>public class APITests {<br><br>    @Test<br>    void test1(){<br>        Response response = get(&quot;https://reqres.in/api/users?page=2&quot;);<br><br>        System.out.println(&quot;Response : &quot;+response.asString());<br>        System.out.println(&quot;Status code : &quot;+response.getStatusCode());<br>        System.out.println(&quot;Body : &quot;+response.getBody().asString());<br>        System.out.println(&quot;Time taken : &quot;+response.getTime());<br>        System.out.println(&quot;header : &quot;+response.getHeader(&quot;content-type&quot;));<br><br>        int statusCode = response.getStatusCode();<br>        Assert.assertEquals(statusCode, 200);<br><br>    }<br><br>    @Test<br>    void test2(){<br><br>        given().get(&quot;https://reqres.in/api/users?page=2&quot;).<br>        then().<br>        statusCode(200);<br>    }<br><br>}</pre><p>Let’s run the project and this is the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jN8gnUFZ2B8iW3SPh0kqGQ.png" /></figure><p>It says both tests have been passed!</p><p>So this is how we can create a simple project to retrieve the specific data from using GET method in REST Assured!</p><p>In this first article, I explained the fundamentals of API, REST principles and the importance of API testing in modern software development. I also guided you to build a simple Maven project with REST Assured, execute GET requests, analyze responses, and validate them using assertions in both non-BDD and BDD styles. Let’s see how we can elaborate this knowledge to other Rest API methods as well as using BDD format in next article!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59de590c64a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Advanced XPath Techniques: How to Use Axes for Smarter Element Selection]]></title>
            <link>https://medium.com/@uthpalanp/advanced-xpath-techniques-how-to-use-axes-for-smarter-element-selection-02b0283887e3?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/02b0283887e3</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Thu, 28 Aug 2025 06:38:39 GMT</pubDate>
            <atom:updated>2025-08-28T06:38:39.941Z</atom:updated>
            <content:encoded><![CDATA[<p>In the first blog, I talked about what is XPath and what are the benefits and best practices of using it. And with strategies and syntaxes, the types of XPaths were explained using examples. In this second article, let’s talk about advance xpath technique called “XPath Axes”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mf31ggorD5p1WHUwZ1SjAQ.png" /></figure><p><strong>What are XPath Axes?</strong></p><p>XPath axes are some advance techniques that we use to write an xpath to represent the relationships between the nodes/elements in an XML or HTML documents. This allows us to navigate and select the elements relative to a “context node”.</p><p>As I mentioned in the first article, we can write xpaths using bidirecational navigation as going forward and backward. And it is called xpath axes. For this, we can write using following ways.</p><ol><li>Locating a parent element</li><li>Locating a child element</li><li>Locating descendant elements</li><li>Locating ancestor elements</li><li>Locating following elements</li><li>Locating preceding elements</li><li>Locating following sibling</li><li>Locating preceding sibling</li></ol><p>Let’s see how can use those methods one by one.</p><ol><li><strong>Locating a parent element</strong></li></ol><p>Here, we find the node which is directly about the current node/element. And there will be only one parent element.</p><p><em>Syntax: //&lt;known path&gt;/parent::tagname</em></p><p>ex: //div[@class=’passWord labelIcon’]/parent::div</p><p><em>Note: If we don’t know the tagname, we can use * mark.</em></p><p><em>ex: //div[@class=’passWord labelIcon’]/parent::*</em></p><p><strong>2. Locating a child element</strong></p><p>Here, we find the elements directly inside the current element. The child axes contains the “direct children” of the context node.</p><p>As one parent can have many children, there can be multiple direct children in child axes.</p><p>Syntax:</p><p><em>//known path of Element/Child::tagName</em></p><p><em>//xpath known element/tagName</em></p><p>ex:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y7ZcOCpyLWrHsihCo4lkrQ.png" /></figure><p>// div [@class = ‘passWord labelIcon’] / child :: *</p><p>As you can see the above image, when I use the xpath, it gives matching 5 elements. It means, there are 5 direct children under that particular element. (elements with rectangles are the child elements)</p><p>ex: // div [@class = ‘passWord labelIcon’] / Input</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rC__PSR-LAhYfE2qs3gCrw.png" /></figure><p>Since we use the known tag name as the “Input”, it matches with that particular element only.</p><p><strong>3. Locating descendant elements (all the element)</strong></p><p>This consists of the children elements of the known elements and those children’s children and so on.</p><p><em>Syntax: //xpathOfKnownElement/decendent::tagName</em></p><p>ex: //div[@class=’passWord labelIcon’]/descendant::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zjZq2q5KMl-lTafZdUXQkg.png" /></figure><p>Here, we can see there are 2 new children as &lt;ul&gt; and &lt;li&gt;.</p><p>&lt;ul&gt; is the direct child of &lt;div&gt; and &lt;li&gt; is the direct child of &lt;ul&gt;. So in this axes, those children are also counted since they are descendants of the particular &lt;div&gt; element.</p><p><strong>4. Locating ancestors of a known elements</strong></p><p>This is the oposite of the above descendent axes. It counts all the parents of the particular elements. (parents of parents and so on)</p><p><em>Syntax:</em></p><p><em>//xpath of known element/ancestor::tagName</em></p><p><em>//xpath of known element/ancestor::*</em></p><p>ex:</p><p>//input[@name=’password’]/ancestor::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emn6n-CcvVaabdgu9_F3xg.png" /></figure><p>As we can see this image, that above xpath using ancensors axes, gives 15 matching elements. Which means, there are 15 parent elements available of the particular element.</p><p><em>Tip: All the parent tags are staring with down arrow, so it is easy to recognize the parent element tags.</em></p><p>ex:</p><p>//input[@name=’password’]/ancestor::div</p><p>This gives only parent elements which includes &lt;div&gt; tag.</p><p><em>Note:</em></p><p><em>If we aim to locate the 2nd div ancestor element we can just write the xpath as : //input[@name=’password’]/ancestor::div[2]. But this is not recommended way. So we can write this another way like following:</em></p><p><em>//input[@name=’password’]/ancestor::div[@class=’zcrm_spRht_inner’]</em></p><p><strong>5. Locating following elements</strong></p><p>Using this, we can select all the nodes after the closing tag of the current node.</p><p><em>Syntax: //xpath of known element/following::tagname</em></p><p>ex:</p><p>//input[@id=’mobile’]/following::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YUie_iMvLunDdMhasTg2og.png" /></figure><p>There are 688 matching elements available after the particular element.</p><p>ex:</p><p>If we want to select all the following elements with &lt;input&gt; tag, we can write the xpath like this:</p><p>//input[@id=’mobile’]/following::input</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MSDf0BfkCYIfpGhhtpTLNw.png" /></figure><p>And it gives there are 14 matching elements are avialble.</p><p><strong>6. Locating preceding elements</strong></p><p>Here, we can select all the elements which appear before the current node in the document, <strong>except ancestors</strong>.</p><p><em>Syntax: //xpath of known element/preceding::tagName</em></p><p>ex:</p><p>//input[@id=’namefield’]/preceding::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i3d1hHlHqW3Jf2GwC5D13g.png" /></figure><p>Here, it gives 92 matching elements, except ancestors.</p><p><em>Tip: All the elements before the current node with right arrow, can be selected as the preceding elements.</em></p><p><strong>7. Locating following-sibling</strong></p><p>We can select all siblings after the current element within the same HTMl hierarchy.</p><p><em>Syntax: //xpath of known element/following-sibling::tagname</em></p><p>ex:</p><p>//input[@name=’password’]/following-sibling::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nA0jMSyZZbNw5zZecnlGcQ.png" /></figure><p>Within this main div tag, there are 6 elements. And there are 4 elements which acts as the following-sibling to the particular element.</p><p><em>Note: It’s like younger siblings of a student whom have the same parents.</em></p><p><strong>8. Locating preceding sibling</strong></p><p>Opposite of the following-sibling axes. Here we can select all the siblings before the current element with the same HTML hierarchy.</p><p><em>Syntax: //xpath of known element/preceding-sibling::tagname</em></p><p>ex:</p><p>//input[@name=’password’]/preceding-sibling::*</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zDkjznJKTnIrrAFjLkpCjw.png" /></figure><p>This is the same example element, and we can see now there are only 1 preceding element for that particular element.</p><p><em>Note: It’s like elder siblings of a student whom have the same parents.</em></p><p>These are the main xpath axes that we can use to locate elements easily in HTML and XML documents. Other than these, we can use 2 axes similar to these which can write using “self” keyword and there is only one difference:<br> 1. ancestor-or-self : Selects the context node itself and all of its ancestor nodes.</p><p>2. descendent-or-self: Selects the context node itself and all of its descendant nodes.</p><p><strong>Common xpath problems and solutions:</strong></p><p>There are some common problems that we may face during workig with xpaths.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xUlw_KvjF7xuAdsSBELuTg.png" /><figcaption>Common xpath problems and solutions</figcaption></figure><p>In this article, we explored the power of XPath Axes to navigate elements in XML and HTML documents more effectively. By understanding these advanced techniques — such as locating parents, children, ancestors, descendants, and siblings — we can craft highly precise and flexible XPath expressions. These methods allow us to move both forward and backward within the DOM, making element selection more reliable and adaptable for dynamic web applications.</p><p>By combining the concepts from both articles, we are now equipped to create precise and flexible XPaths — from fundamental techniques to advanced axes — making test automation and web scraping processes more reliable, adaptable, and future-proof.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02b0283887e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[XPath Fundamentals — First Steps with XPath (Basic Strategies, Syntax, and Best Practices)]]></title>
            <link>https://medium.com/@uthpalanp/xpath-fundamentals-first-steps-with-xpath-basic-strategies-syntax-and-best-practices-868978677a4a?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/868978677a4a</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Fri, 15 Aug 2025 06:52:48 GMT</pubDate>
            <atom:updated>2025-08-21T07:18:57.497Z</atom:updated>
            <content:encoded><![CDATA[<h3>XPath Fundamentals — First Steps with XPath (Basic Strategies, Syntax, and Best Practices)</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DK5NHl7I2g3x30Rh.jpg" /></figure><p><strong>What is XPath?</strong></p><p>XPath (XML Path Language) is an expression language which is used to support query or navigate nodes within HTML pages or XML documents. It allows users to locate elements by specifying their path using hierarchical structure of the documents. This strategy is widely used in web application development, particularly in automated testing frameworks such as Selenium.</p><p>Simply, xpath can be used to locate an element on a web page as it is one of the most flexible and strongest location strategy.</p><p><strong>Limitations of other locators</strong></p><p>We can use several other elements to locate elements without using xpath. Those locators are:</p><ol><li>ID</li><li>Name</li><li>Class Name</li><li>Link test</li><li>Partial link</li><li>CSS selector</li></ol><p>But there are some limitations of using these elements.</p><p>ID : Some times the IDs are not mentioned and if we use an ID, it should be unique and static. But modern dynamic pages generate changing or random IDs each time after refresh the page. And some times multiple elements uses the same IDs.</p><p>Name and class name: Same name/class name can be used for several elements and some elements may not have a name/class name attribute at all.</p><p>Link test/partial link test : These are worked only with &lt;a&gt; tag elements. And the texts are case sensitive. Another problem is if there are similar or common texts, it can return multiple matches.</p><p>CSS selector : Cannot directly search based on text content and syntax can be tricky for deeply nested or dynamic elements.</p><p><strong>Benefits of using XPaths</strong></p><ul><li>Ability to locate elements easily based on their position on the page.</li><li>Easier to navigate nested elements.</li><li>Works with both XML and HTML.</li><li>Increased flexibility.</li><li>Improved reliability and robustness.</li><li>Dynamic elements can be handled using functions like contains(), starts-with() etc.</li><li>Ability to filter the nodes with conditions such as and, or, not().</li><li>Very useful in automation testing with tools like Selenium.</li></ul><p><strong>Types of XPath</strong></p><p>There are 2 types of XPaths:</p><ol><li>Absolute XPath</li><li>Relative XPath</li></ol><p><strong>Difference between Absolute and Relative XPaths</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*AnIV9X6IEHJTJg4LOkXtXw.png" /><figcaption>Difference between Absolute and Relative XPaths</figcaption></figure><p><strong>Basic XPath syntax</strong></p><p>The most common and fundamental syntax for locating elements is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/337/1*iXeui2rCaPJy_x2S-cOMfg.png" /><figcaption>Basic XPath syntax</figcaption></figure><p><em>tagname:</em> Represents the HTML tag names of the certain elements (ex: a, button, span, input, div etc.)</p><p><em>attribute:</em> Represents the name of the attribute (ex: id, name, class, type etc.)</p><p><em>value:</em> Represents the specific value of the attribute</p><p>Ex: Let’s write the xpath for following element.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*N0wQcW937OtJWtZYqA9STw.png" /></figure><p>xpath = //button[@type=’button’]</p><p><strong>Strategies to write an XPath</strong></p><ol><li><strong>Using unique attributes</strong></li></ol><p>We can write xpaths using unique attributes such as id, name, class etc. of the particular locator.</p><p>Here we can write the xpaths with known attributes, even when we don’t know the tag name. We can use * mark for this:</p><p><em>Syntax: //*[@attributeName=’value’]</em></p><p>ex: //*[@name=’username’]</p><p>If we know the both tagname and attributes, then we can use following:</p><p><em>Syntax: //tagname[@attributeName=’value’]</em></p><p>ex: //input[@name=’username’]</p><p><strong>2. Using multiple attributes</strong></p><p>We can use multiple attributes to locate the excat element.</p><p><em>Syntax:</em></p><p><em>//*[@attribute1=’value’][[@attribute2=’value’][@attribute3=’value’]…..[@attributeN=’value’]</em></p><p>ex: //*[@id=’j32_ert1’][@name=’username’][@class=username”]</p><p><strong>3. Using XPath functions</strong></p><p>We can write xpaths using functions like text(), normalize-space(), contains(), starts-with().</p><p>For these functions, let’s use the following example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*R_P8nVz4OB7RRk45i5iFYQ.png" /></figure><p>Using text(), we can locate elements with known visible inner text.</p><p><em>Syntax: //tagname[text()=’exact text’]</em></p><p>ex: //a[text()=’OrangeHRM, Inc’]</p><p>But if we have white spaces in inner text before or after to the text, we can write the xpath using normalize-space() function.</p><p><em>Syntax:</em></p><p><em>Option 1: //tagname[normalize-space()=’xact text’]</em></p><p><em>Option 2: //tagname[normalize-space(text())=’exact text’]</em></p><p>ex: //a[normalize-space()=’OrangeHRM, Inc’]</p><p>And if there is only part of the visible inner text is known, we can use contains() function to write the xpath.</p><p><em>Syntax: //tagname[contains(text(), ‘part of the text’)]</em></p><p>ex: //a[contains(text(), ‘OrangeHRM’)]</p><p>When the starting visble inner text is known, we write the xpath using starts-with() function.</p><p><em>Syntax: //tagname[starts-with(text(), ‘starting text’)]</em></p><p>ex: //*[starts-with(text(), ‘OrangeHRM’)]</p><p><strong>4. Handling dynamic attributes</strong></p><p>When there are dynamic elements, every time we refresh the page, the values are changes. In these situations, we can locate the elements as following.</p><p><em>Syntax:</em></p><p><em>//tagname[contains (@attributeName, ‘part of the value’)]</em></p><p><em>//tagname[starts-with (@attributeName, ‘fixed prefix of the value’)]</em></p><p>ex:</p><p>//*[contains(@type, ‘bmi’)]</p><p>//*[starts-with(@type, ‘sub’)]</p><p><strong>5. Combining multiple attributes</strong></p><p>We can write the xpaths using “and”, “or” operations to combine the mutiple attributes.</p><p>ex:</p><p>//input[@name=’username’ and @placeholder=’Username’]</p><p>//a[@target=’_blank’ or text()=’OrangeHRM, Inc’]</p><p><strong>6. Using indexing (chained xpath)</strong></p><p>We can write the xpaths as following too.</p><p>ex:</p><p>//div[@class=’orangehrm-login-footer’]//p[2]/a</p><p>//div[@class=’orangehrm-login-footer’]//a</p><p><strong>7. Using bidirectional navigation</strong></p><p>We can write xpaths using bidirecational navigation as going forward and backward. For this, we can write using following ways.</p><ul><li>Locating a parent element</li><li>Locating a child element</li><li>Locating ancestors of a known elements</li><li>Locating following elements</li><li>Locating following sibling</li><li>Locating preceding sibling</li><li>Locating descendant elements</li><li>Locating proceeding elements</li></ul><p>This method is called as <strong>XPath Axes</strong>.</p><p><strong>Best Practices for using XPath</strong></p><ol><li>Use relative xpaths.</li><li>Keep it simple and specific. Avoid overly long and unnecessary complexity xpaths.</li><li>Use unique attributes.</li><li>Use logical operations like and, or to combine multiple conditions in single xpath.</li><li>Avoid using indexes.</li><li>Use functions like “contains” or “starts-with”.</li><li>Use xpath axes.</li></ol><p>With these basic strategies, we can easily locate elements in a web page. But there are some advanced technique that we have to learn — xpath axes. Let’s talk about it deeply in the next article.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=868978677a4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DashDine: Building the User Dashboard]]></title>
            <link>https://medium.com/@uthpalanp/dashdine-building-the-user-dashboard-ebc832bd137e?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/ebc832bd137e</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Sun, 18 May 2025 06:10:06 GMT</pubDate>
            <atom:updated>2025-05-18T06:11:45.781Z</atom:updated>
            <content:encoded><![CDATA[<p>The <strong>User Dashboard</strong> in our project <em>DashDine</em> was designed to offer users a centralized, intuitive, and interactive experience to manage their profiles, reviews, favorite vendors, and more. It acts as a personalized hub, improving user engagement while streamlining profile-related activities.</p><p><strong>Navigation and Layout</strong></p><p>The dashboard is split into two main sections:</p><ul><li>A <strong>left sidebar</strong> for navigation.</li><li>A <strong>main content area</strong> where each section’s details are rendered.</li></ul><p>The sidebar includes buttons to navigate to:</p><ul><li><strong>Profile</strong>: View and edit personal information.</li><li><strong>Favorite Vendors</strong>: A quick list of vendors the user likes.</li><li><strong>Recently Viewed Vendors</strong>: To revisit previously explored vendors.</li><li><strong>Reviews</strong>: All the reviews submitted by the user.</li><li><strong>Back to Home</strong> and <strong>Logout</strong>: Quick access and session management.</li></ul><p>Each navigation item is accompanied by an icon (from react-icons/fa) for a clean, modern look.</p><ol><li><strong>Profile Section</strong></li></ol><p>The profile section allows users to:</p><ul><li>View and <strong>edit personal information</strong>, including name, email, phone number, and address.</li><li>Upload or change their <strong>profile picture</strong> using image upload via a backend API.</li><li>All data is stored locally for a seamless experience across sessions.</li></ul><p>When editing:</p><ul><li>A form appears pre-filled with the user’s current data.</li><li>Upon saving, the updated info is saved to localStorage and the UI updates in real-time.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HNvQ2O1-uX51zafNPvzcJw.png" /><figcaption>Profile Section</figcaption></figure><p><strong>2. Favorite and Recently Viewed Vendors</strong></p><p>Although currently based on static arrays, these sections are built to be:</p><ul><li><strong>Searchable</strong>: Users can filter through vendors by name.</li><li><strong>Clickable</strong>: Each vendor item links to a detailed vendor profile.</li></ul><p>These lists aim to give users quick access to the vendors they care about most.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*5gs3gsWJrMEVPAEsp_o6nA.png" /><figcaption>Favourite Vendors Section</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*g5k0tTahcPbUZ35gpSg-Mg.png" /><figcaption>Recently Viewed Vendors Section</figcaption></figure><p><strong>3. Review Section</strong></p><p>One of the more dynamic features of the dashboard is the <strong>“Your Reviews”</strong> section. It:</p><ul><li>Fetches and displays all reviews submitted by the logged-in user using their stored userId.</li><li>Dynamically pulls vendor names from the backend based on each review’s vendorId.</li><li>Visually represents ratings with star icons, showing full, half, and empty stars based on decimal values.</li></ul><p>This gives users a comprehensive view of their feedback and helps reinforce a sense of contribution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*J0OxmSbla3UGvzI0O03Dew.png" /><figcaption>Review Section</figcaption></figure><p><strong>Session Control</strong></p><p>User sessions are managed with localStorage:</p><ul><li>Logging out clears all session data and redirects the user to the login page.</li><li>User info and ID are persisted during a session to prevent unnecessary backend calls.</li></ul><p><strong>Search Bar and Utility Features</strong></p><p>At the top of the main content:</p><ul><li>A <strong>search bar</strong> lets users filter their favorite and recently viewed vendors.</li><li>The <strong>profile picture</strong> is always visible, helping users visually stay connected with their identity on the platform.</li></ul><p><strong>Technologies Used</strong></p><ul><li><strong>React</strong> for UI rendering and state management.</li><li><strong>React Router</strong> for navigation.</li><li><strong>Axios</strong> for API communication.</li><li><strong>LocalStorage</strong> for temporary persistence.</li><li><strong>FontAwesome icons</strong> for consistent UI aesthetics.</li></ul><p><strong>Conclusion</strong></p><p>The <strong>User Dashboard</strong> of DashDine is a core part of enhancing user personalization. While the current version uses some hardcoded data (like favorite vendors), it’s fully structured to integrate with backend APIs and expand into a more dynamic, data-driven experience. From profile editing to reviewing vendors, the dashboard brings usability and design together in one smooth interface.</p><p>Lets meet with another interesting feature of DashDine. Stay tuned for more updates!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ebc832bd137e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DashDine: Authentication System]]></title>
            <link>https://medium.com/@uthpalanp/dashdine-authentication-system-6a2db1c5fd4a?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/6a2db1c5fd4a</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Sun, 18 May 2025 06:04:24 GMT</pubDate>
            <atom:updated>2025-05-18T06:04:24.922Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dPLMspzxHV4sFv5l.jpg" /></figure><p>DashDine provides a streamlined and secure authentication system that supports <strong>both users and vendors</strong>. The platform distinguishes between regular customers and vendors, allowing each to register and log in through a tab-based interface. Here’s an overview of how authentication works on both ends:</p><p>Here we talk about two main functionalities:</p><p>1. Sign Up</p><p>2. Log In</p><p><strong>1. Sign Up Functionality</strong></p><p><strong>Dual Registration Tabs</strong></p><p>The sign-up page offers two distinct tabs:</p><ul><li><strong>User Registration</strong>: For regular users looking to explore and review vendors.</li><li><strong>Vendor Registration</strong>: For businesses that want to list their services on DashDine.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/502/1*8urYPLKX7P60-mvxLXLUVQ.png" /><figcaption>User Registration (User Sign Up) Feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*YZ7QEKx7H_dzgSzAxZb60Q.png" /><figcaption>Vendor Registration (Vendor Sign Up) Feature</figcaption></figure><p><strong>Input Fields</strong></p><ul><li><strong>Users</strong> must provide:</li><li>Username</li><li>Email</li><li>Password</li><li><strong>Vendors</strong> must provide:</li><li>Business Name</li><li>Business Location</li><li>Email</li><li>Password</li></ul><p><strong>Features</strong></p><ul><li>Dynamic form display based on selected role.</li><li>Real-time validation to ensure all fields are filled.</li><li>Appropriate API routes are called based on the role:</li><li>POST /api/auth/register-user</li><li>POST /api/auth/register-vendor</li><li>Upon successful registration, the user is redirected to the login page.</li></ul><p><strong>2. Login Functionality</strong></p><p><strong>Role-Specific Login</strong></p><p>Similar to registration, the login page offers two tabs:</p><ul><li><strong>User Login</strong></li><li><strong>Vendor Login</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*3HwN2YJ937-Eye7CZk8g6g.png" /><figcaption>User Login Feature</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/1*CjaGpSwkSfbpJTEHu1sEHw.png" /><figcaption>Vendor Login Feature</figcaption></figure><p><strong>Input Fields</strong></p><ul><li>Email or username (depending on the role)</li><li>Password</li></ul><p><strong>Backend Integration</strong></p><ul><li>Sends a POST request to:<br> POST /api/auth/login<br> with a role field (user or vendor) to distinguish authentication logic.</li></ul><p><strong>Login Logic</strong></p><ul><li>On successful authentication:</li><li>A JWT token is stored in localStorage.</li><li>Username and user ID are also stored locally.</li><li>Redirects are role-specific:</li><li>Vendors go to /vendor-dashboard</li><li>Users go to /user-dashboard or a previously intended route (if set)</li></ul><p><strong>Error Handling</strong></p><ul><li>Frontend provides user feedback for missing fields, incorrect credentials, or server errors.</li></ul><p><strong>Notable Implementation Details</strong></p><ul><li><strong>State Management</strong>: Controlled form inputs using useState hooks.</li><li><strong>URL Parameters</strong>: ?type=vendor in the URL automatically pre-selects the vendor tab on SignUp.</li><li><strong>LocalStorage Usage</strong>: Stores session tokens and user metadata to persist login state.</li><li><strong>Navigation</strong>: react-router-dom is used to handle redirects based on login success.</li></ul><p><strong>Future Enhancements</strong></p><ul><li>Password strength validation and visibility toggle.</li><li>Forgot Password flow.</li><li>OAuth integration for social logins.</li><li>Token expiry handling and auto logout.</li></ul><h3>✅ Conclusion</h3><p>The authentication system in DashDine ensures a smooth and role-specific experience for both users and vendors. With clear separation between registration and login processes, responsive form validation, and secure token-based session management, it lays a solid foundation for protecting user data and managing access across the platform. This system not only enhances usability but also supports scalability as the application grows.</p><p>Let’s meet with another update from DashDine. Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6a2db1c5fd4a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DashDine: The Tech Stack To Build A Modern Review Platform]]></title>
            <link>https://medium.com/@uthpalanp/dashdine-the-tech-stack-to-build-a-modern-review-platform-a6cebc070c89?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6cebc070c89</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Sun, 18 May 2025 05:53:32 GMT</pubDate>
            <atom:updated>2025-05-18T05:53:32.703Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m3Wzu78jUCT0V1XgRueReA.png" /></figure><p>When creating <strong>DashDine</strong>, our goal was to develop a responsive, user-friendly, and scalable web application that connects users with local food vendors through reviews, geolocation, and intuitive dashboards. Achieving that meant choosing the right technology stack — a set of tools that enables efficient development and future growth.</p><p>In this article, we’ll take you behind the scenes to explore the technologies powering DashDine and why we chose each of them.</p><p><strong>1. Why JavaScript Full Stack?</strong></p><p>We adopted a <strong>JavaScript full-stack architecture</strong> to streamline both frontend and backend development. Using JavaScript across the stack allows for:</p><ul><li>A unified development language (less context switching)</li><li>Easier code sharing between client and server</li><li>A rich ecosystem of libraries and tools</li></ul><p><strong>2. Frontend Technologies</strong></p><p>The frontend of DashDine is crafted to provide a smooth, responsive experience for both users and vendors.</p><ul><li><strong>React.js</strong><br> We chose React for its component-based architecture, which makes the UI modular, reusable, and easy to manage. React also handles dynamic state changes efficiently, which is crucial for interactive features like dashboards and real-time updates.</li><li><strong>CSS3 &amp; HTML5</strong><br> These foundational technologies power the structure and style of our pages, enabling responsive layouts across devices.</li><li><strong>React Icons</strong><br> To enhance usability and aesthetic appeal, we integrated icon libraries via React Icons. It helps users quickly identify buttons, tabs, and sections throughout the app.</li></ul><p><strong>3. Backend Technologies</strong></p><p>On the server side, we kept things lightweight and scalable:</p><ul><li><strong>Node.js</strong><br> As an event-driven, non-blocking runtime, Node.js is perfect for handling multiple requests efficiently. It serves as the backbone for our RESTful APIs, user authentication, and vendor data management.</li></ul><p><strong>4. Database</strong></p><ul><li><strong>MongoDB</strong><br> We use MongoDB, a flexible NoSQL database, to store structured and semi-structured data. It handles user information, vendor profiles, menus, and user reviews. Its schema-less nature made it easier to adapt the data models as the project evolved.</li></ul><p><strong>5. APIs and Integrations</strong></p><ul><li><strong>Leaflet.js</strong><br> One of the standout features of DashDine is the interactive map that shows nearby vendors. We used Leaflet, an open-source JavaScript library, to render map tiles and enable geolocation search. It’s lightweight yet powerful for our needs.</li></ul><p><strong>6. Development Tools</strong></p><ul><li><strong>Visual Studio Code (VS Code)</strong><br> Our go-to editor throughout development. With support for JavaScript, JSX, debugging, and Git integration, VS Code kept us productive and organized.</li><li><strong>Git &amp; GitHub</strong><br> Version control was crucial, especially when working as a team. Git helped us track changes, and GitHub made collaboration, issue tracking, and code reviews seamless.</li></ul><p><strong>Conclusion</strong></p><p>By carefully selecting a modern and cohesive tech stack, we were able to build DashDine efficiently without compromising on user experience or performance. From React on the frontend to MongoDB on the backend, each tool played a critical role in bringing our vision to life.</p><p>As DashDine continues to grow, our chosen stack offers the flexibility and scalability to support new features, larger datasets, and more users. <br> <br>Let’s meet with another interesting article about DashDine! Stay Tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6cebc070c89" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Layered architecture: The Foundation of Modern Software Design]]></title>
            <link>https://medium.com/@uthpalanp/layered-architecture-the-foundation-of-modern-software-design-d2a98ec06f45?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/d2a98ec06f45</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Tue, 04 Feb 2025 11:04:54 GMT</pubDate>
            <atom:updated>2025-02-04T11:04:54.817Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*qvKUZ4W-sMOGMSU-cpuiiA.png" /><figcaption>Figure 01: Layered Architecture High Level Diagram</figcaption></figure><p>Layered architecture, aka n-tier architecture, is one of the most common architecture patterns in the software architecture stream. Most of the software is designed using this traditional method, which is meant to be self-independent. The architecture is referred as “layered” because it has the appearance of a layered cake, with each layer building upon the others to create a comprehensive and integrated application.</p><p>Numerous different architectural designs have been affected by this particular architecture pattern, including Clean Architecture, Onion Architecture, and Hexagonal Architecture.</p><p><strong>Key components</strong></p><p>The layered architecture consists of different layers, where each layer performs a specific role itself, which is organized in a horizontal way. Each layer services the layer below it and offers services to the layer above it and has limited communication with other layers. This facilitates better separation of concerns and enhances modularity. The number and the types of layers are varied, while mostly there are four standard layers that can be introduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/461/1*tc2kCqz2xDk8uZexghHGcQ.png" /><figcaption>Figure 02: Layered architecture with four standard layers</figcaption></figure><p>1. <strong>Presentation layer:</strong> Responsible for handling all user interface and browser communication logic.</p><p>2. <strong>Business layer:</strong> Responsible for executing specific business functions/rules associated with the request.</p><p>3. <strong>Persistence layer:</strong> Responsible for holding objects that require long-term data retention.</p><p>4. <strong>Database layer:</strong> Responsible for handling storage for internal state data of the application.</p><p>Other than these, there can be a data access layer, a service layer, or an application layer, etc. In smaller applications, it may include only three layers, and larger and more complex applications may consist of more than four layers.</p><p><strong>Pros and cons of layered architecture pattern</strong></p><p><strong>Pros:</strong></p><ul><li><strong>Reusability:</strong> Multiple applications can reuse the components.</li><li><strong>Flexibility, Maintainability, Scalability:</strong> Separating the layers makes the system more flexible, easier to maintain, and scalable.</li><li><strong>Separation of concerns:</strong> Layers in a code structure are responsible for specific tasks, ensuring clear separation of concerns and enabling better scalability. It allows for easier testing and debugging.</li><li><strong>Security: </strong>Different components can be provided different levels of security, enabling some to be available online and others to be protected behind a firewall.</li><li><strong>Independent deployment</strong>: Different components can be deployed, updated, and maintained independently on various schedules.</li><li><strong>Parallel development: </strong>Teams can work simultaneously on different parts of the system with <strong>minimal</strong> dependencies.</li><li><strong>Loose coupling: </strong>Layered architecture promotes loosely coupled systems, which makes the application easier to manage.</li></ul><p><strong>Cons:</strong></p><ul><li><strong>Performance overhead: </strong>Compared to direct component calls, passing through several levels can cause performance to slow.</li><li><strong>Cascading changes: </strong>Layering might make programs that need direct database interaction from the user interface more difficult to design.</li><li><strong>Longer development for UI-intensive apps: </strong>Changes in lower-level layers, can affect higher-level layers especially if a relaxed layered approach is used.</li></ul><p><strong>When to use</strong></p><ul><li>It is suitable when the time is limited and if the product is needed to be released quickly for feedback.</li><li>It is suitable for business applications that require traditional IT processes and departments.</li><li>It is a great choice for the beginners who are not much familiar with software architecture patterns.</li><li>It is a great choice when simplicity is prioritized.</li><li>It is perfect for applications with high maintenance and testing requirements.</li></ul><p><strong>Real world examples</strong></p><p>There are several real-world examples available about various organizations that successfully implemented layered architecture. <em>Netflix, Apache Struts framework, Sprint framework</em> are some of them.</p><p><strong>Netflix: </strong>Netflix, a global streaming titan with over 200 million subscribers, uses the layered architecture pattern to ensure a smooth and user-friendly platform. This architecture pattern allows for modifications or updates to one layer without affecting others, allowing users to continue browsing without system changes. It enables Netflix to scale its services efficiently, managing growing loads without affecting presentation or business layers.</p><p><strong>Apache Struts framework: </strong>The Apache Struts framework is widely used for building Java-based web applications. It uses 3-layer architecture, simplifying maintenance, extension, and customization to meet specific business requirements.</p><p><strong>Spring framework:</strong> The Spring framework is a Java-based web application that employs a 4-layered architecture, enabling developers to create scalable, robust, and flexible applications capable of handling large traffic volumes.</p><p><strong>Conclusion</strong></p><p>Layered architecture is a popular pattern in software architecture for scalable, secure, and maintainable applications. It enhances modularity, promotes reusability, and is ideal for projects prioritizing simplicity, rapid and independent development. Either for a small application or a large-scale enterprise solution, layered architecture provides a solid foundation for creating robust and future-proof software.</p><p>[1] M. Richards, “Software Architecture Patterns,” <em>O’Reilly | Safari</em>, 2019. <a href="https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch01.html">https://www.oreilly.com/library/view/software-architecture-patterns/9781491971437/ch01.html</a></p><p>‌[2] “Redirecting you — Medium,” <em>Medium.com</em>, 2025. <a href="https://medium.com/r?url=https%3A%2F%2Fwww.techtarget.com%2Fsearchapparchitecture%2Ftip%2FThe-pros-and-cons-of-a-layered-architecture-pattern">https://medium.com/r?url=https%3A%2F%2Fwww.techtarget.com%2Fsearchapparchitecture%2Ftip%2FThe-pros-and-cons-of-a-layered-architecture-pattern</a> (accessed Feb. 04, 2025).</p><p>‌[3] “The pros and cons of a layered architecture pattern | TechTarget,” <em>App Architecture</em>. <a href="https://www.techtarget.com/searchapparchitecture/tip/The-pros-and-cons-of-a-layered-architecture-pattern">https://www.techtarget.com/searchapparchitecture/tip/The-pros-and-cons-of-a-layered-architecture-pattern</a></p><p>[4] “Sign in — Google Accounts,” <em>Medium.com</em>, 2025. <a href="https://medium.com/@nikhiljain1203/delving-into-the-layered-architecture-pattern-a-comprehensive-study-using-netflixs-infrastructure-e9d26eb39234">https://medium.com/@nikhiljain1203/delving-into-the-layered-architecture-pattern-a-comprehensive-study-using-netflixs-infrastructure-e9d26eb39234</a></p><p>‌‌[5] “Layered Architecture: Building Scalable &amp; Maintainable Software Systems | Bitloops Docs,” <em>bitloops.com</em>. <a href="https://bitloops.com/docs/bitloops-language/learning/software-architecture/layered-architecture">https://bitloops.com/docs/bitloops-language/learning/software-architecture/layered-architecture</a></p><p>[6] “11 Software Architecture Patterns You Must Know About,” <em>eSparkBiz Technologies Pvt Ltd</em>, Sep. 19, 2023. <a href="https://www.esparkinfo.com/blog/software-architecture-patterns.html">https://www.esparkinfo.com/blog/software-architecture-patterns.html</a></p><p>‌</p><p>‌</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d2a98ec06f45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DashDine: Unveiling the Essence of Sri Lankan Street Food Culture]]></title>
            <link>https://medium.com/@uthpalanp/dashdine-unveiling-the-essence-of-sri-lankan-street-food-culture-a2d83e19c624?source=rss-4ad9acc29e09------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2d83e19c624</guid>
            <dc:creator><![CDATA[Uthpala Pathirana]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 05:49:40 GMT</pubDate>
            <atom:updated>2025-01-27T05:49:40.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*F_4Yon_CcSM13hSCTjtKaQ.jpeg" /><figcaption>Figure 01: Sri Lankan street foods</figcaption></figure><p>Street foods have become really popular around the world by revealing the rich diversity of food culture. With the huge influence of social media, it has become one of the major events in the tourism industry too. Many tourists now tend to explore new experiences of street foods, and there are some people who travel to different countries to experience street foods only, because street food is one of the valuable aspects that emphasizes the culture of each country itself.</p><p>With a history of over 2000 years, Sri Lanka is famous for its unique cultural aspect, which is a rich blend of religious, native and colonial influences. The country became the leader of cultivating and exporting spices in the world for decades; Sri Lankans use their seasoning with special care. The specialty of street foods in Sri Lanka is the way of preparing them and the ingredients that are used, since most of them are rich with handpicked masalas, slow-cooked vegetables, and thick, flavorful meat.</p><p><strong>Importance of this platform</strong></p><p>There are some significant challenges in the Sri Lankan street food industry that both vendors and customers are facing.</p><ul><li>Since the popularity of it, many Sri Lankan vendors tend to enter the street food industry, but mainly due to the investment cost, most of the vendors have faced the challenge of promoting their products and innovations.</li><li>Food lovers also find it hard to find all the street food stalls, even within a city, and their products in one platform to select the best stalls and foods.</li><li>Some foreign tourists love the foods with an interesting historical background, but the knowledge sources are limited.</li></ul><p>“<em>DashDine</em>” is a user-friendly street food stalls discovery website that gives a solution to those challengers by providing the facility to customers to interact with the street food vendors in an easy manner.</p><p><strong>Target audience</strong></p><p>There are mainly 2 types of users who can engage with the website.</p><p><strong>1. Street food vendors: </strong>Who aim to reach a wider audience to promote their products and innovations.</p><p><strong>2. Food enthusiasts:</strong> Individuals (ex: local and foreign tourists) who love to explore the new cultural food experiences.</p><p><strong>Core features of the website</strong></p><p><strong>1. Vendor profiles: </strong>The vendor profile contains the detailed information about each vendor, including their name, profile picture, location, menu, opening hours and days, specialties, etc.</p><p><strong>2. Interactive map: </strong>With the help of the map, customers can search and find the current location of each street food stall very easily.</p><p><strong>3. User ratings and reviews: </strong>The facility is given to the customers to share their food experiences with other users by rating each vendor and giving their feedback, which helps other food lovers to find the best out of them, and it will be a motivation to the other vendors to enhance their products too.</p><p><strong>4. Dish origin information: </strong>The detailed information about the ingredients of each dish and their nutritional benefits are included in this feature. And most importantly, the cultural significance of each dish will be included in this feature. As an example, which region is popular for this dish, and if there is any historical background, it can be mentioned here to explore its specialty.</p><p><strong>Architecture Pattern</strong></p><p>We use <strong>Layered architecture pattern </strong>to implement the website.</p><p>Layered architecture, <em>a.k.a. n-tier architecture pattern</em>, is one of the common architecture pattern. It’s components consist with horizontal layers, and each layer performs a specific role in the application. It is used for websites because it gives facility to organize the code into distinct layers which is making the system easier to maintain, test, scale and develop. So the teams can work independently without stepping on each others toes.</p><p>Here, we use four distinct layers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/261/1*yKTIrbMS4Yp1XfIW0TyLlw.png" /><figcaption>Figure 02: Layered Architecture</figcaption></figure><ol><li><strong>Presentation layer:</strong> To handle user interface and user interactions</li><li><strong>Business Logic layer:</strong> To implement core functionalities and business rules</li><li><strong>Data Access layer:</strong> To manage database interactions</li><li><strong>Database layer: </strong>To store all application data</li></ol><p><strong>Conclusion</strong></p><p>“<em>DashDine</em>” severs as a bridge between customers and street food vendors by addressing those challenges faced by both parties. Features like vendor profile, interactive map, reviews and ratings and dish origin information offer detailed information about various street food vendors and their services which is useful for food enthusiastic who seek for best products and vendors who reach wider range of audience. The website use layered architecture pattern which can be organized code into four distinct layers as presentation layer, business logic layer, data access layer and database layer by making the system easier to develop and maintain.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2d83e19c624" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>