<?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 Isuru Piyarathna on Medium]]></title>
        <description><![CDATA[Stories by Isuru Piyarathna on Medium]]></description>
        <link>https://medium.com/@isurutestng?source=rss-6dd68c6bb868------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*eMGFZ6ZGf2gj-BNtuwq6zA.jpeg</url>
            <title>Stories by Isuru Piyarathna on Medium</title>
            <link>https://medium.com/@isurutestng?source=rss-6dd68c6bb868------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 11:12:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@isurutestng/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[Issues with Playwright MCP]]></title>
            <link>https://medium.com/@isurutestng/issues-with-playwright-mcp-c9beb8abba33?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9beb8abba33</guid>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[playwrights]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[playwright-mcp]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Sun, 26 Oct 2025 08:28:46 GMT</pubDate>
            <atom:updated>2025-10-26T08:28:46.492Z</atom:updated>
            <content:encoded><![CDATA[<p>Before we start let’s look at what is MCP?</p><p>Model Context Protocol (MCP) that allows AI models to <strong>connect securely and dynamically to external data, tools, and systems</strong>. It defines how AI models (Claude or ChatGPT) talk to external sources — e.g : databases, APIs, or local files — in a standardized, structured, and secure way.</p><p><strong>What is Playwright MCP?</strong></p><p>Server that provides browser automation capabilities using <a href="https://playwright.dev/">Playwright</a>. This server enables LLMs to interact with web pages through structured accessibility snapshots, bypassing the need for screenshots or visually-tuned models.</p><p><em>Now let’s look at the issues I found when using Playwright MCP</em></p><ol><li>It skips given instructions and behave on its own.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/475/1*k_LLcDkNh9cAw4qyaQw1uQ.png" /></figure><p>2. It’s unable to read file paths correctly. It will work if we give only relative path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*vwUfFaB3Qko6FMvEN2aKeg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/741/1*uRBIl9vOyI3yctVkje8EOQ.png" /></figure><p>3. Even though it’s been given instructions to forbid some data. It still uses the same</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/758/1*osm7v2GLSxxsQZMCIWu88A.png" /></figure><p>4. It opens up few browser tabs when navigates to a specific URL. This results in failing the test.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1016/1*YpHdTD7AlbJLgCCRVfyBDA.png" /></figure><p>5. It completely ignores the instructions and asking the user to execute.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*6Q87bknaIEZRnjbvAipUyQ.png" /></figure><p>6. Sometimes it navigates to the localhost before actual given URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*-gtWbQx2T212xH1f9ziPng.png" /></figure><p>7. It Stops in the middle and asks for user permission instead executing instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*blFnHuGUsP5OzLvf8sBwMQ.png" /></figure><p>8. It is unable to create files with the content created by itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*JI4IzqCgG-Wdv6vl2kSFmg.png" /></figure><p>9. Unable to execute the instructions at once. It breaks in the middle. (This is more of a GitHub Copilot issue)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*jmyOiO898-fw_AILFyeAKA.png" /></figure><p>These are the issues I found when experimenting Playwright MCP as of now. They will fix these issues in future hopefully.</p><p>To be honest Playwright MCP server is a super cool feature for Test Automation and it is definitely next level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/347/1*DhEAzs-DKGT-d6rXeTEa7Q.jpeg" /></figure><p><em>References</em></p><p><a href="https://github.com/microsoft/playwright-mcp?tab=readme-ov-file">https://github.com/microsoft/playwright-mcp?tab=readme-ov-file</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9beb8abba33" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[E2E Code coverage with Cypress Code Coverage]]></title>
            <link>https://medium.com/@isurutestng/e2e-code-coverage-with-cypress-code-coverage-0905488aeb9a?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/0905488aeb9a</guid>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[automation-testing]]></category>
            <category><![CDATA[cypress-automation]]></category>
            <category><![CDATA[code-coverage]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Wed, 18 Dec 2024 06:51:47 GMT</pubDate>
            <atom:updated>2024-12-18T06:51:47.556Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8CcFfBGma6q-rXfY.jpeg" /></figure><p>In modern web application development, End-to-End (E2E) testing plays a vital role in verifying that your application works seamlessly from the user’s perspective.</p><p><strong>Why Code coverage is important in UI automation?<br></strong>It is because it helps to understand how much of your code is being tested rather than just writing and running E2E tests. Code coverage gives you insights into potential gaps and untested areas.</p><p><strong>Let’s Get started</strong></p><p>Following are the commands you need to execute in order to install cypress code coverage and get it up and running. I have used a react app in my case.</p><ol><li><em>npm install — save-dev @cypress/code-coverage<br></em><strong>Installs the </strong><strong>@cypress/code-coverage plugin</strong> as a development dependency (--save-dev) in your project.<br>The @cypress/code-coverage plugin helps Cypress tests collect and report <strong>code coverage</strong> during test runs.</li><li><em>Add Code Coverage Support in Cypress Plugins</em></li></ol><pre>  module.exports = (on, config) =&gt; {<br> require(‘@cypress/code-coverage/task’)(on, config);<br> return config;<br>}; <br></pre><p>Add above code in cypress.config.ts if using TypeScript.</p><p>3. <em>Import Code Coverage Support in e2e.ts file. This file resides in cypress supports folder.</em><br><strong> import ‘@cypress/code-coverage/support’;</strong></p><p>4. <em>Update the package.json file with following code.</em></p><p>“scripts”: {<br>“cy:coverage”: “nyc report — reporter=text-summary — reporter=lcov”,<br>}</p><p>All of these setup is done inside the e2e test repo. In my case react repo (Front end code) reside in a different repo. I will refer is as console hear after. Following steps are done in console repo.</p><p>5. <em>Install Babel Packages.</em></p><p><strong>npm install — save-dev @babel/core @babel/preset-env @babel/preset-typescript</strong></p><p>6. <em>Install nyc<br></em><strong>npm install — save-dev nyc.</strong></p><p>these two can be needed. <strong><br></strong>yarn add @cypress/instrument-cra<br>npm i -D @cypress/code-coverage nyc istanbul-lib-coverage</p><p>7. <em>Instrument the code</em><br>Now I’m going to instrument my code. In order to that I need to first locally up and running my code. We are using react with vite. I’m opening console in my localhost port 3000 using below command</p><p><strong>npx vite preview — port 3000 — no-open &amp; </strong>or <strong><br>npm start</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jle7Zv46zIwQ_sweS9vIoQ.png" /><figcaption>instrumented console</figcaption></figure><p>As you can see console is now instrumented now. In order to see this you nee to type window._coverage in your browser console. Since it’s correctly instrumented you will see<br><strong>branchMap</strong>, <strong>fnMap</strong> and <strong>inputSourceMap</strong> generated.</p><p>Now we have the instrumented code and we are going to run our e2e test against the instrumented codebase.In our case we run our e2e tests against the console.</p><p><strong>prerequisite<br></strong>You need to configure your loginURL and baseUrl and other relevant url to localhost 3000 (in my case) like below in cypress.env.json since we are pointing to localhost.</p><ul><li>baseUrl: &quot;https://localhost:3000&quot;</li></ul><p>8. <em>Run Cypress Tests<br></em><strong>npx cypress open.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*itL_mB7xzwgbo98SZ5piiA.png" /><figcaption>.nyc_output</figcaption></figure><p>This will run the<em> </em>cypress spec and generate .nyc_output folder. Coverage data will be collected and saved in the .nyc_output folder.</p><p>9. <em>Generate Coverage Report</em></p><p>There are many commands to generate different types of reports. Below command is to generate basic html report.</p><p><strong>npx nyc report — reporter=text-summary — reporter=html</strong></p><p>This is a view of the html report showing <strong>Statements</strong>, <strong>Branches</strong>, <strong>Functions</strong>, and <strong>Lines</strong> coverage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zXVEis0IGnWdB5bXIfo0qw.png" /><figcaption>coverage</figcaption></figure><p>That’s it. Hope you enjoyed. Don’t forget to give a clap ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0905488aeb9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[API Mocking with Wiremock standalone]]></title>
            <link>https://medium.com/@isurutestng/api-mocking-with-wiremock-standalone-9ab915e4e8c6?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ab915e4e8c6</guid>
            <category><![CDATA[wiremock]]></category>
            <category><![CDATA[mocking]]></category>
            <category><![CDATA[mock-api]]></category>
            <category><![CDATA[stubbing]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Tue, 23 Jul 2024 11:00:04 GMT</pubDate>
            <atom:updated>2024-07-23T11:00:04.487Z</atom:updated>
            <content:encoded><![CDATA[<p>Mocking and service virtualization are essential techniques in modern QAOps. They allow developers and testers to simulate the behavior of components or services that are difficult to access or not yet available. By creating these virtual stand-ins, teams can ensure their systems are robust and reliable, even when real-world testing conditions are not ideal. This approach helps streamline the development process, reduce costs, and enhance overall software quality. In this article, I’ll explain how the Wiremock standalone tool can be utilized for API mocking.</p><p><strong>What is a mock service?</strong> It involves creating a virtual version of a service that mimics the behavior of a real service. <br><strong>Example:</strong> If your application interacts with a third-party API, you can create a virtual service that mimics the API’s behavior. This allows you to test how your application handles various responses from the API without relying on the actual third-party service.</p><p><strong>What is API mocking? </strong>It<strong> </strong>involves creating a simple simulation of an API, accepting the same types of requests, and returning identically structured responses as the real API.</p><p><strong>When do you need to mock APIs?</strong> Typically used during development and testing as it allows you to build your app without worrying about 3rd party APIs or sandboxes breaking. It can also be used to rapidly prototype APIs that don’t exist yet.</p><p>WireMock is available as a Java library and docker as well. Try it here if you want. <a href="https://wiremock.org/">https://wiremock.org/</a>. But today I’m going to try standalone version.</p><p>Following are steps</p><ol><li>Download the jar file from above link under <a href="https://repo1.maven.org/maven2/org/wiremock/wiremock-standalone/3.8.0/wiremock-standalone-3.8.0.jar">latest standalone JAR</a></li><li>Execute the command in a terminaljava -jar wiremock-standalone-3.8.0.jar</li></ol><p>you need to run the command in the same location as jar file. It will show something like this. My version is 3.7 though.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ty8p815M_1gZg0NX0Ox9_A.png" /><figcaption>execute jar file command</figcaption></figure><p>3. Now open a browser at <a href="http://localhost:8080/__admin/">http://localhost:8080/__admin/</a>. You will see something like below by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*Lzx9QqwHdNjJlDvViNMJ4A.png" /><figcaption>localhost default</figcaption></figure><p>4. Send curl request to update/Post deposit — this is my scenario. It depends. I have attached my Github repo which I have used for this at the end of the article for your reference.</p><p>curl -X POST <a href="http://localhost:8080/__admin/mappings">http://localhost:8080/__admin/mappings</a> -H “Content-Type: application/json” -d @deposit.json</p><p>Once the request is sent and refreshed the localhost now see below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KKg45GXkujF_JJHZFpVzkA.png" /><figcaption>changed result</figcaption></figure><p>That’s it. Happy mocking !.</p><p>Github repo <a href="https://github.com/Isurunc/wiremock_standalone">https://github.com/Isurunc/wiremock_standalone</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ab915e4e8c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI Performance testing with Cypress]]></title>
            <link>https://medium.com/@isurutestng/performance-testing-with-cypress-5dee516652d2?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dee516652d2</guid>
            <category><![CDATA[cypress-testing]]></category>
            <category><![CDATA[ui-performance]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[cypressio]]></category>
            <category><![CDATA[load-testing]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Mon, 20 May 2024 09:49:41 GMT</pubDate>
            <atom:updated>2024-06-10T05:11:56.488Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*su8eGl3pcE2ESfjXHy491g.jpeg" /></figure><p>Yes, you read right. You might be wondering how we can use Cypress for performance testing because as you all know Cypress is not a performance testing tool. I’m going to share my special experience with you all about how I have used Cypress for load testing and achieved my project requirement.</p><p><strong>Problem: UI Load test for 300 concurrent users.</strong></p><p><strong>Solution: Cypress <br></strong>We have already used Jmeter and achieved our performance benchmarks. We wanted to go the extra mile and simulate end-user behavior as it is using a front-end automation tool.</p><p>So let’s dive deep into how I have achieved it.</p><p>We are already using Cypress for our e2e test framework. Therefore I could easily use reusable functions from the existing framework. Here’s one of my use cases.</p><ol><li>User log into the system using email option</li><li>Create a project</li><li>Create a service component</li><li>Build the service</li><li>Deploy the service</li></ol><p>I started the above scenario with 50 users and gradually increased it to 300 concurrent users. There were so many ways to launch the browser sequentially but the challenge was to launch the browser at the same time for all the users.</p><p>I created a node.js script to run my Cypress spec. Below is my node.js script. I will briefly explain what I have done there.</p><pre>const cypress = require(&#39;cypress&#39;);<br>const { exec } = require(&#39;child_process&#39;);<br>const usersCount = 50;<br>const startingNumber = 6000;<br>const usernamePrefix = &#39;TestAdmin&#39;;<br>// Define test spec<br>const testMethods = [<br>{spec: &#39;cypress/e2e-stable/perf/0.1-con-perf-test.ts&#39;}<br>];<br>// Function to run Cypress tests for a specific user and test methods<br>async function runTests(username) {<br>console.log(&#39;Username:&#39;, username);<br>const results = {};<br>// Run each test method<br>for (const { name, spec } of testMethods) {<br>try {<br>const testResults = await cypress.run({<br>headless: true,<br>parallel: false,<br>spec: [spec],<br>env: {<br>perfUsername: username<br>},<br>exit: true,<br>name: name<br>});<br>console.log(`${name} tests completed for user ${username}`);<br>results[name] = testResults.totalFailed === 0 ? &#39;Pass&#39; : &#39;Fail&#39;;<br>} catch (error) {console.error(`Error running ${name} tests for user ${username}:`, error);<br>results[name] = &#39;Error&#39;;}<br>}<br>}<br>// Loop through users and run tests for each<br>async function runTestsAsync() {<br>for (let i = startingNumber; i &lt; startingNumber + usersCount; i++) {<br>console.log(`Running tests for user ${i}`);<br>const username = `${usernamePrefix}${i}@wso2.com`;<br>runTests(username);<br>}<br>}<br>// Run tests for each user<br>runTestsAsync();</pre><ul><li>usersCount = concurrent users</li><li>startingNumber = starting user # (we need to have a predefined user count)</li><li>usernamePrefix = is the common prefix for all the users</li><li>testMethods = this is where I have given the path to my spec file. Which I haven&#39;t shared here.</li><li>Rest is the code to run the Cypress spec.</li></ul><p>Above node.js code will launch 50 browser instances parallel and run at once.<br><em>Note : You can&#39;t run this script in your local machine because it will heat up and the machine will stuck. I have used a few Azure VM machines for this purpose.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uku1vDjBWLpWAKLIFN8giw.png" /></figure><p>In case you are wondering what my product is, It’s an awesome internal developer platform. Try here <a href="https://console.choreo.dev/">https://console.choreo.dev/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dee516652d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Protractor useful commands and resources]]></title>
            <link>https://medium.com/@isurutestng/protractor-useful-commands-and-resources-a6f5ee1652a3?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6f5ee1652a3</guid>
            <category><![CDATA[jasmine]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[protractor]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Fri, 02 Oct 2020 06:31:05 GMT</pubDate>
            <atom:updated>2020-10-02T06:35:37.973Z</atom:updated>
            <content:encoded><![CDATA[<p>This will cover initial commands and some resources that you need to get started with protractor.</p><ul><li><strong>protractor-beautiful-reporter </strong>— (Angularized HTML Reporter with Screenshots for Protractor)<br><em>npm i protractor-beautiful-reporter<br>npm install -g protractor-beautiful-reporter — save-dev</em></li><li><strong>Add Jasmine to your package.json</strong><br><em>npm install --save-dev jasmine</em></li><li><strong>allure commandline</strong><br><em>npm i allure-commandline<br>npm install -g allure-commandline --save-dev</em></li><li><strong>Jasmine allure reporter</strong><br><em>npm i jasmine-allure-reporter</em></li><li><strong>protractor jasmine2 screenshot reporter</strong><br><em>npm install protractor-jasmine2-screenshot-reporter -- save-dev<br>npm i protractor-jasmine2-screenshot-reporter</em></li><li><strong>Run allure report in CMD and get the html report</strong><br><em>allure serve “location of allure-results folder”</em><br>ex : <em>allure serve D:\Isuru\Protractor\allure-results<br></em>if you want different location<br><em>allure serve “location of allure-results folder” -o “new location path”</em></li></ul><p>This will start the allure server and report will be generated as a html file and saved to temp directory by default</p><p><strong>Required extensions/plugins</strong></p><p>Visual Studio Code Snippets for Protractor<br>* Protractor Snippets extension can be found <a href="https://marketplace.visualstudio.com/items?itemName=deerawan.vscode-protractor-snippets#:~:text=Visual%20Studio%20Code%20Snippets%20for%20Protractor&amp;text=Type%20cmd%2Dshift%2Dp%20%2F,and%20choose%20Extensions%3A%20Install%20Extension%20.">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/574/1*fI_EalIU2uGOT5LJepfrEQ.png" /></figure><p><strong>Other extensions to be installed from marketplace</strong><br><em>code runner</em><br>* it will enable run the code from UI instead terminal</p><p><strong>Useful Google Chrome extensions</strong><br>- Protractor recorder<br>- POM Builder</p><p><strong>Protractor API Cheat sheet</strong><br><a href="https://gist.github.com/javierarques/0c4c817d6c77b0877fda">https://gist.github.com/javierarques/0c4c817d6c77b0877fda</a></p><p><strong>Protractor API<br></strong>This includes Protractor API documentation. The menu lists all classes and methods exposed by Protractor.</p><p><a href="https://www.protractortest.org/#/api">https://www.protractortest.org/#/locators</a></p><p>Happy Testing :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6f5ee1652a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Testing Framework Setup with Selenium with C#]]></title>
            <link>https://engineering.99x.io/testing-framework-setup-with-selenium-with-c-90da9ea896d9?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/90da9ea896d9</guid>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[test-automation-framework]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Mon, 20 Jul 2020 11:04:31 GMT</pubDate>
            <atom:updated>2020-07-21T11:44:17.736Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*wdNe897-293N2i7j97ZztQ.png" /><figcaption>C# with Selenium</figcaption></figure><p>As you already know Selenium framework is most commonly used with Java. But with this article I’m going to help how to get started Selenium with C#. First let’s see what are the <em>prerequisites</em> we need to get started.</p><ul><li>Install .Net Core with SDK installer (latest is recommended). You need to have following components. <br>- dotnet-runtime<br>- aspnetcore- runtime <br>- dotnet-sdk<br>You can download from <a href="https://dotnet.microsoft.com/download">here</a> and<a href="https://dotnet.microsoft.com/download/dotnet-core/3.1"> here</a> (select based on your OS)</li><li>VS code or visual studio</li></ul><p>You can check whether .NET Core is installed correctly using command ‘dotnet --version’. You don’t need to setup the environment variables or anything.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/609/1*xc3hDWi-OwDr2yuD5pr_Ug.png" /><figcaption>dotnet version</figcaption></figure><p>Now we are ready to setup the C# solution. Let’s do it step by step</p><ol><li>Create a folder in your local machine. In my case it’s POC. Go inside that folder and open command prompt and type ‘code .’ It will open VS code as a new project like below.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4LEM1M1nlvlppOJBCqC-2Q.png" /><figcaption>New project</figcaption></figure><p>2. Go to marketplace and search for ‘PackSharp’ extension and install it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJGx8qBE7k_HqS3sU3xQ4g.png" /></figure><p>once done go to View&lt; Command Palette &lt;type packsharp&lt;Create new project&lt; Class library &lt;Give a name to your framework. In my case it’s Framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4EqQI5f38O5YjdGZS3rUeQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CnGIvOHLNfpbNkvuZzfMgQ.png" /><figcaption>command palette</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sN6U1eGLObXi6zX4_Rw83A.png" /><figcaption>Framework</figcaption></figure><p>3. Follow above steps thrice as below. <br>* Create a new project &lt;Class library &lt;Give a name (TestSystem)<br>* Create a new project &lt;NUnit 3 test project &lt;Give a name (TestSystem.Tests)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OKhF3uZOJZ-raVW3USVTJg.png" /><figcaption>NUNIT3 Test Project</figcaption></figure><ul><li>Create a new project &lt;Solution Files&gt; Give a name (stats)</li></ul><p>4. Then you need to add sln files. Use following commands to add sln files using terminal. <br><em>dotnet sln add Framework</em><br><em>dotnet sln add TestSystem</em><br><em>dotnet sln add TestSystem.Tests</em></p><p>*<strong>dotnet sln </strong>— Lists or modifies the projects in a .NET Core solution file.The dotnet sln command provides a convenient way to list and modify projects in a solution file.<br><em>Please note</em>-To use the dotnet sln command, the solution file must already exist.</p><p>Now your project structure should be like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/327/1*ytRr20TxgJNeFkwtc8-MiA.png" /></figure><p>5. Run the command ‘<em>dotnet build</em>’. <br>If you get the green &quot;Build succeeded&quot; message with zero warnings and errors that means everything is fine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p9NepNGZ3S8CFHeZFGBTdw.png" /><figcaption>build success</figcaption></figure><p>6. Then open UnitTests1.cs file. <br>Request permission message pop up will appear to add missing assets. Click Yes. It will add .vscode folder to your solution. If not reload the window and see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xuAwJ4deIH68BIxi8dud3w.png" /><figcaption>reload window</figcaption></figure><p>7. Run the command ‘<em>dotnet test</em>’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ITVz-1eU-MFk76--0D8FDg.png" /></figure><p>Congratulations !!! Now we are good to start scripting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*NOddqz5oeG5KpFhPJhjMjQ.jpeg" /></figure><p>First let’s add Selenium to our solution.</p><ul><li>Go to command palatte&lt; Bootstrap Selenium &lt; add to Test project (in my case it’s TestSystem.Tests)<br>You need to add it to where you write test cases.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZU_d-VdAP6Nooz2qAt4_kg.png" /></figure><p>*After that you will see a folder called <em>_drivers</em> has been added. <br>There you see chromedriver.exe has been added.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qbBt9DY90NEo-R3govrSgA.png" /><figcaption>ChromeDriver</figcaption></figure><ul><li>Now open .csproject file. (In my case it’s TestSystem.Tests.csproj)<br>As you can see Selenium.Support and Selenium.Webdriver Package References have been added. It means now Selenium is installed successfully and ready to use.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L91ozIsVjbrzR4G7INonLQ.png" /></figure><ul><li>Go to Tests folder (in my case TestSystem.Tests) and open your test class.(in my case it’s TestsOne.cs) and type IWebDriver driver;<br>You will see an error. Just click on yellow bulb icon and it will show import suggestions as below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eadKvBFrBcBlZpqc7NRvsQ.png" /><figcaption>import suggestions</figcaption></figure><p>I have included few initial steps to build your scripts below.</p><h4>Chrome driver initiation</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kBvFiVm8gQ7-5R2POPEi-Q.png" /></figure><h4>Driver path initialization</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-qcLgViP7Or7TMX14BlVNg.png" /></figure><h4>Specify URL</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XprKtj7qCLxefZcLaui2NQ.png" /></figure><p>There you go. Now you have a basic framework to get started. <br>Good luck :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90da9ea896d9" width="1" height="1" alt=""><hr><p><a href="https://engineering.99x.io/testing-framework-setup-with-selenium-with-c-90da9ea896d9">Testing Framework Setup with Selenium with C#</a> was originally published in <a href="https://engineering.99x.io/">Engineering at 99x</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling Selenium tests with Docker]]></title>
            <link>https://engineering.99x.io/scaling-selenium-tests-with-docker-ae4ed06dfa64?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae4ed06dfa64</guid>
            <category><![CDATA[scaling-tests]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[selenium-grid]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Sat, 02 May 2020 15:10:34 GMT</pubDate>
            <atom:updated>2020-05-04T09:40:04.286Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/357/1*g3qvqPndP8pYimokePk8Pg.jpeg" /></figure><p><em>You might think why use docker if we have selenium grid,</em></p><p>The reason is setting up selenium grid is also a manual and time consuming task. You need to download and run the Selenium server, configure hub and nodes for each machine and run multiple commands. It’s hard to manage your hub and nodes when the number of instances gets increased. And also with docker we can eliminate the need for downloading browser drivers and setting classpath because that is also done automatically.<br><br>I will be explaining how we can use headless and non headless Chrome and Firefox images and a selenium grid image to spin up as many containers as much as we need with the few simple commands. We will learn how to spin up, re start and tear down an entire grid in seconds with dockers.</p><p>There are 3 main pieces to the setup of our grid.<br>1. The docker machine(docker engine)<br>2. Hub container<br>3. Node container (with the browsers that are connected to the hub)<br> — our tests will run against the hub which balances them across the nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*YxLBIbt73Cxx-W4RksDkDg.png" /><figcaption>Three main components of our grid setup</figcaption></figure><p>I’m running these docker commands and tests in my laptop. So the laptop can be considered as the docker engine that the hub is connected to which connects the browser nodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/943/1*txCCw79vyiUXFP1RBJBOkg.png" /></figure><p>Hub and nodes are containers. Containers need to be started by using images. (<em>Refer my article </em><a href="https://medium.com/@isurutestng/dockers-for-beginners-from-qe-perspective-8d0e40f0b863"><em>here</em></a><em> to get a basic knowledge on dockers)</em><br>We get these images from docker hub which is a repository for holding our images. you can either save your images to the hub or you can download them from the hub.</p><h4>Steps</h4><ol><li>Go to <a href="https://hub.docker.com/">https://hub.docker.com/</a> and search for ‘Selenium hub’</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KH_sz6PWLNio2oCzCUMqWg.png" /></figure><p>2. Pull the selenium hub to your local machine using a terminal<br>(you must switch to Linux containers before you pull. You cant pull if you are inside windows containers)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XqD0nll0CcQMGk12_6o0Ww.png" /><figcaption>pull command</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryO-LdZy9ML5JcbAjfnCHQ.png" /><figcaption>docker pull using terminal</figcaption></figure><p>Once the pulling is over you can verify whether docker image is downloaded by executing ‘docker images’ command in terminal</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k5d8kYNryzk2fj2VIBIsFg.png" /><figcaption>verify docker image</figcaption></figure><p>3. Pull the Chrome and Firefox nodes by executing following commands</p><p>docker pull selenium/node-chrome<br>docker pull selenium/node-chrome-debug<br>docker pull selenium/node-firefox <br>docker pull selenium/node-firefox-debug</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f0_9GR7KmhWDPIzEUf0c8Q.png" /><figcaption>Chrome node</figcaption></figure><p>After pulling is over check the available images by executing ‘docker images’ command.</p><ul><li>Fire fox debug</li><li>Chrome debug</li><li>Firefox headless</li><li>Chrome headless</li><li>Hub</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fKh0YjWcOpS7UejoVFTlDA.png" /></figure><p>we can start creating containers as we have images now.</p><p>you are able to create and run containers one at a time through a ‘docker run’ command but we really don’t want to create one container at a time. We need to much rather create the containers and network them together with a single command. That’s where we need docker compose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RHlVwK_WNcHz-3NvA1AlRw.png" /><figcaption>without using docker compose</figcaption></figure><p><strong><em>What is docker compose</em></strong></p><p>docker compose is a part of docker but it has it’s own commands and uses<br>a YAML file to know which images you want to use, how you want to create<br>those containers and link them together. You define single yml file with<br>the services you want and then use the docker compose command to create and start all of them at once. Read more <a href="https://docs.docker.com/compose/#features">here</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ew5uIt3WmG3tMAiG8pi2Aw.png" /><figcaption>using docker compose</figcaption></figure><p><em>Let’s get started with real action people :D</em></p><p><strong>prerequisites</strong><br>- .NET Core with SDK (latest is recommended) <br><a href="https://dotnet.microsoft.com/download/dotnet-core/3.1">https://dotnet.microsoft.com/download/dotnet-core/3.1</a><br>- IDE (Visual studio or VS Code)</p><p><strong>Steps</strong></p><ol><li>Go to <a href="https://github.com/elsnoman/esports-automation">https://github.com/elsnoman/esports-automation</a> and checkout the code</li><li>Open it in a preferred IDE</li><li>Open docker-compose.yml file</li></ol><p><em>Let’s understand the structure of docker-compose.yml file</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7II1uAhJ8Qlu9SrEP0mMZg.png" /><figcaption>docker-compose.yml</figcaption></figure><ul><li>version-latest version of the docker compose files</li><li>services-each service is a container. Here we have 3 containers<br>- Selenium-hub- It will use the selenium/hub image and expose port 4444. max session of 16, which means only 16 browsers can be running at a time on this grid. Timeout is set to 300 seconds<br>- chrome-It will use headless node Chrome image. Chrome container will depend on selenium hub. That means it has to wait for selenium hub to be up and running. Then node max sessions and instances. It will have 2 chrome browsers on it <br>- firefox — It is almost identical to Chrome except max sessions and instances</li></ul><h4>How to Create Containers and spun up the grid</h4><p><em>Steps<br></em>1. Open the terminal and go to the directory where the yml file is <br>2. Execute the command ‘docker-compose up -d’<br>This is will create containers. In my case here it’s updating since I have already created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j-O11xF-ZZfg4qibh2YarQ.png" /><figcaption>create containers</figcaption></figure><p>3. Execute the command ‘docker ps -a’ command<br>this will list down all the created containers with image details. We have 3 containers running now as you can see below.</p><ul><li>Firefox container</li><li>Chrome container</li><li>Hub</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*27ufxwrXB-Aweh_OneCjNA.png" /><figcaption>check existing containers</figcaption></figure><p>You have successfully spun up the grid within 2 seconds. Isn&#39;t it amazing !</p><p>4. Open a browser and go to ‘localhost:4444/grid/console’ to see the grid</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-m_HQ_qZpZLlh0Rk0J02Q.png" /><figcaption>grid console</figcaption></figure><p>you have created two containers. One with two chrome browsers and other container with four Firefox browsers. (that’s the count we defined in compose.yml file earlier)</p><p><strong>Few useful commands</strong></p><p>— re start the grid- ‘docker-compose restart’<br> — tear down the grid-‘docker-compose down’<br>* it will stop and completely remove the containers</p><h4><em>Let’s run our tests</em></h4><p><em>Pre- conditions</em></p><ul><li>Tests are 100% independent from each other</li><li>Web Driver can’t be shared. Each test needs to have it’s own<br>instance of a driver.</li></ul><p><strong>Our test scenario</strong><br>1. Go to <a href="https://nexus.leagueoflegends.com/en-us/esports/">https://watch.lolesports.com/</a><br>2. Go to Standings<br>3. Filter by League<br>4. Assert first place team is correct</p><p>I’m not going to explain each and every code piece here. <br><em>Remember</em> : The most important pieces are the RemoteWebDriver class and the URL we pass into the constructor to connect that driver to the Grid.</p><ul><li>There are two ways you can run the tests</li></ul><ol><li>Using <em>config.json</em> file</li></ol><p>command to run tests-’<em>dotnet test</em>’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*PSEpWQqx_WB5ZOLwdvbyBg.png" /><figcaption>config.json</figcaption></figure><p>2. Using <em>.runsettings</em> file</p><p>command to run tests-’dotnet test- -settings .runsettings’</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*M14ytsoxegCH1WwknO5HOA.png" /><figcaption>.runsettings file</figcaption></figure><p>If you want run tests in locally in browser change type value to “local”. If we set the value to “remote” it will run the tests remotely on the grid. Make sure your grid is up. If not make it up and running by executing command ‘docker-compose up -d’.<br>You can also check the docker status in VS code like below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*UIb5KmYaSAm_95zuL3cOYw.png" /><figcaption>VS code container status</figcaption></figure><p><strong>How to scale up number of containers</strong></p><p>-Remember to kill existing containers using ‘docker-compose down’ command to skip any conflicts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vuDk2fCqEjXe5hST7LE_aw.png" /><figcaption>kill existing containers</figcaption></figure><p>-Execute command ‘docker-compose up -d --scale chrome=10’<br>This will create 10 containers each consists of 2 chrome instances. 1 hub container and 1 Firefox container will be also created by default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hzhZ8Ghz4c7PQ9E0ntdF6w.png" /><figcaption>scale up containers.</figcaption></figure><p>Now if you navigate to <a href="http://localhost:4444/grid/console">http://localhost:4444/grid/console</a> <br>you will see 10 chrome containers and 1 firefox container like below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VzkrcIITFsJRPHesdW0bhw.png" /><figcaption>grid console</figcaption></figure><p>Run the tests again and check the grid console. You will see the tests are running simultaneously as shown in below image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gGrsPXDibTKtBJ9xqoneYw.png" /></figure><p>You are now able to run as many tests as your machine can handle by <br>scaling up your containers.</p><ul><li>But remember there’s a limit to everything. To overcome any limitations we face here we have something called docker Swarm. <br>Let’s discuss docker Swarm in another article.</li></ul><blockquote><strong><em>references</em></strong><br><a href="https://github.com/ElSnoMan/esports-automation">https://github.com/ElSnoMan/esports-automation</a><br><a href="https://docs.docker.com/compose/">https://docs.docker.com/compose/</a><br><a href="https://www.softwaretestinghelp.com/docker-selenium-tutorial/">https://www.softwaretestinghelp.com/docker-selenium-tutorial/</a><a href="https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019">https://docs.microsoft.com/en-us/visualstudio/test/configure-unit-tests-by-using-a-dot-runsettings-file?view=vs-2019</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae4ed06dfa64" width="1" height="1" alt=""><hr><p><a href="https://engineering.99x.io/scaling-selenium-tests-with-docker-ae4ed06dfa64">Scaling Selenium tests with Docker</a> was originally published in <a href="https://engineering.99x.io/">Engineering at 99x</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dockers for Beginners — From QE perspective]]></title>
            <link>https://medium.com/@isurutestng/dockers-for-beginners-from-qe-perspective-8d0e40f0b863?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/8d0e40f0b863</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[containerization]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Mon, 27 Apr 2020 08:12:45 GMT</pubDate>
            <atom:updated>2020-05-01T06:04:18.084Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Dockers for Beginners</strong></h3><p><em>This article is for anyone who wants to learn about Docker containers yet has no clue where to start and what some of those words mean.</em></p><p><strong>What is Docker</strong><br>Designed to build, ship and run business critical applications in production environment at scale.<br>you can build and share containers and automate the development pipeline from a single environment. Each of these containers represent the piece of application or a system. <br>Containers are the building blocks of the containerization world it allow<br>you to package only the things you need for your application without creating <br>whole operating systems like virtual machines. <br>They are faster and more lightweight. Containers give you control over your <br>environments because you can specify exactly what you want each container to look like by using blueprints called images.</p><p><strong>What are docker images</strong></p><p>Images are the details used to create containers. They contain everything needed to run an application as a container. This includes:</p><ul><li>code</li><li>runtime</li><li>libraries</li><li>environment variables</li><li>configuration files</li></ul><p>Images for docker let you specify which services libraries or dependencies you need for a container. A Docker image is built up from a series of layers. Each layer represents an instruction in the image’s Dockerfile.<br>Then the image can be deployed to any Docker environment and execute as a container.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/882/1*Fq_QIMXSDciYbd2mX5Qxqw.png" /></figure><p>A Docker container is a runtime instance of an image. From one image you can create multiple containers (all running the same application) on multiple Docker platform.</p><p><em>ex:</em><br><em>you can share images with other people. Once you’ve created an image of a Docker virtual machine, you can send that image to someone else. That person can start a new virtual machine using your image, and their Docker virtual machine will run exactly the same as yours</em>.</p><p>This is why Docker is so powerful for creating and deploying applications. Every developer on the team will have the exact same development instance. Each testing instance is exactly the same as the development instance. Your production instance is exactly the same as the testing instance. Because your systems are identical, you don’t need to spend time troubleshooting issues that only exist in one environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bM-BILeR8KZEQiGxTZDBSQ.png" /><figcaption>simple web app without using dockers</figcaption></figure><p><em>Issues we face daily if not using containers</em></p><ul><li>Which version of our code?</li><li>Which dependencies and their versions</li><li>How to manage each service</li><li>Networking issues</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*8SZ3XMIQjyHXV0nxFnU5PA.png" /><figcaption>Day to day problems</figcaption></figure><p><strong><em>Usage of containers</em></strong></p><ul><li>Next to user interface we have DEV label so other dev services can see <br>and use it. If we want the latest version from the Dev branch it will also automatically link to the web server so the networking is done for us</li><li>If we containerize all the components we can spin up our entire application with one command and have all of it connected for us automatically</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0pyAMNpg99L53gQVz1qzag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gO5sZBhoWDKrZrouQf-LAQ.png" /><figcaption>simple web app using containers</figcaption></figure><h4><strong>How to install docker on windows</strong></h4><ol><li>Go to <a href="https://hub.docker.com/editions/community/docker-ce-desktop-windows">https://hub.docker.com/editions/community/docker-ce-desktop-windows</a> and download dockers desktop installer.exe</li><li>Run the .exe file after download is finished</li><li>Once the installation is done start the desktop docker app by giving the same credentials you used to sign in to the <a href="https://www.docker.com/">https://www.docker.com/</a>.</li><li>open a command prompt and type ‘ docker version’. If you see a output like below latest docker is successfully installed on your machine</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FYgOrLczmUVrJHZ-9bB2fQ.png" /><figcaption>docker verification on windows</figcaption></figure><p>Congratulations ! Now we are ready to use docker :)</p><blockquote><strong>references</strong><br><a href="https://codingthesmartway.com/docker-beginners-guide-part-1-images-containers/">https://codingthesmartway.com/docker-beginners-guide-part-1-images-containers/</a></blockquote><blockquote><a href="https://docs.docker.com/storage/storagedriver/">https://docs.docker.com/storage/storagedriver/</a></blockquote><blockquote><a href="https://stackify.com/docker-image-vs-container-everything-you-need-to-know/">https://stackify.com/docker-image-vs-container-everything-you-need-to-know/</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d0e40f0b863" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[File upload to SFTP servers via JMeter]]></title>
            <link>https://medium.com/@isurutestng/file-upload-to-sftp-servers-via-jmeter-f7bd6b6785a4?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7bd6b6785a4</guid>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Thu, 23 Apr 2020 10:19:25 GMT</pubDate>
            <atom:updated>2020-04-24T12:04:01.329Z</atom:updated>
            <content:encoded><![CDATA[<h3>File upload to SFTP server via JMeter</h3><p>Thought of publishing this article because I had to go through so much trouble to find this solution.</p><p>Problem — Upload files to Azure Storage accounts from SFTP location<br>Solution/tools tried — Filezilla, WinSCP<br>Successful solution — JMeter (5.2.1)</p><blockquote><strong>Prerequisites </strong><br><em>- Install JMeter plugins manager (because SSH SFTP sampler does not come by default)<br>you can refer </em><a href="https://jmeter-plugins.org/wiki/PluginsManager/">this link</a><em> on how to install plugins manager <br>- Download and add </em><a href="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/jmeter-ssh-sampler/jmeter-ssh-sampler-0.1.0.jar">jmeter-ssh-sampler-0.1.0.jar</a> <em>file</em> <em>inside jmeter/lib/ext folder</em></blockquote><p><strong>Steps</strong></p><ol><li>Add thread group &gt; SSH SFTP Sampler</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fLMQ7KiOhFT2_yiDeDKNmw.png" /></figure><p>2. Give following details</p><p><strong>Server details</strong> : Hostname, Port<br><em>hostname</em>-is the SFTP server IP<br><em>Port</em>-is 22 for SFTP</p><p><strong>Login</strong> : User Name, Password<br><em>SFTP username and password</em></p><p><strong>File Transfer</strong> : Action, Source path, Destination path<br><em>action</em>- these are the http methods such as GET, PUT, RM, EDIT, ls<br>* In this case it’s PUT method<br><em>Source path</em>- is the path where our file is <br><em>Destination path</em>- is the path where we need our file to be<br>* Most probably it’s a SFTP server location</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owJ_jSX8enY5JBeSpuE_1A.png" /></figure><p>and execute !</p><p>If all the provided information is correct you can see the results. In my case I have configured ‘View Results Tree’ listener as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4Xv1MJKeqJuXxKe7mY0tg.png" /></figure><p>3. Verify the file is uploaded to SFTP location<br>You can use tools like filezilla or winscp to access the sftp location. I have used winscp here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0m7XRT1d5yfKXPf2JU4mBg.png" /></figure><p>4. Verify the uploaded files from Azure storage Container</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bHwMKrEs5x7hjnYFUMyOGw.png" /></figure><ul><li>Depending on your solution step 4 may vary.</li></ul><p>Note : If you want to add multiple SFTP users with different credentials add SSH SFTP sampler multiple times.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*YSgXrJzyR-wejBk1zNKBdw.png" /></figure><p>Cheers :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7bd6b6785a4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Xpath for beginners]]></title>
            <link>https://medium.com/@isurutestng/xpath-for-beginners-54c90e1cfe73?source=rss-6dd68c6bb868------2</link>
            <guid isPermaLink="false">https://medium.com/p/54c90e1cfe73</guid>
            <category><![CDATA[xpath]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[location-strategis]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Isuru Piyarathna]]></dc:creator>
            <pubDate>Tue, 17 Dec 2019 09:43:32 GMT</pubDate>
            <atom:updated>2023-06-28T06:24:28.186Z</atom:updated>
            <content:encoded><![CDATA[<h4>Introduction</h4><p>Every test automation engineer <strong>must </strong>be very comfortable in locating elements in web pages. XPath and CSS are very powerful location strategies used in automation world as compared to other location strategies (id, name, linkText, partialLinkText, tagName, className )</p><p>Mastering XPath or CSS is <strong>essential </strong>for the Selenium test automation engineers to locate dynamic web elements. We must pay attention to master location strategies because it’s very crucial when web pages with dynamic contents are automated.<br>We are used to rely on some tools like Firebug, Firepath or any other tools to get the XPath. But these tools cannot be used directly for dynamic web elements.</p><h4>Why do we need to master many XPath syntax</h4><p>Some elements do not have unique attributes like id or name, some attributes are dynamically changed, some elements could be without any attribute. Therefore we might have to locate them differently than the static elements.</p><p><strong><em>Types of Xpath</em></strong></p><p><em>Absolute path — </em>specifying the location of a file or directory from the root directory(/). <br>* Starts from single forward slash(/)<br>* Starts from &lt;html&gt; tag</p><p>Ex: <br>html/head/body/form/table/tbody/tr/th</p><p><em>Relative path — </em>locating an element from a known element where the path starts from the node of your choice.<br>* Starts with double forward slash(//)<br>* Does not start from the root node<br>* Starts selection matching anywhere in the document</p><p>Ex:<br>//*[@id=’login’]/ul/li[3]/a</p><p>It is not recommended to use absolute XPath in test automation specially in Selenium. Because of the following reasons.</p><ul><li>Absolute XPaths are lengthier and not readable</li><li>Absolute XPaths tend to break as web pages content is changed</li><li>Very slower</li></ul><p><em>Let’s do an exercise</em></p><p><strong>Write ‘xpath’ to following scenarios</strong></p><p>_______________________________________________________________</p><p><strong>1.</strong> <strong>Identify element using ‘id’ attribute</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/455/1*MNf43MNl78lU-Lu-wW0WPg.png" /></figure><p>Answer — //input[@id=’model’]</p><p>_______________________________________________________________</p><p>2. <strong>Identify ‘select’ node using both ‘class’ and ‘name’ attributes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*PoNSELVkBQG97NXlfwWxdQ.png" /></figure><p>Answer — //select[@class=’htext round’ and @name=’vtype’]</p><p>_______________________________________________________________</p><p>3. <strong>Identify ‘select’ node using either ‘class’ or ‘name’ attributes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/1*RTNY3ismTDS4lVZs-2e6Hg.png" /></figure><p>Answer — //select[@class=’htext round’ or @name=’vtype’]</p><p>_______________________________________________________________</p><p>4. <strong>Identify element using link text</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*6ujz2sG6yR2mZzk2eY5btw.png" /></figure><p>Answer — link=Toyota</p><p>5. <strong>Identify element using ‘href’</strong></p><p>Answer — //a[@href=’http://riyasewana.com/search.php?make=Toyota&#39;]</p><p>_______________________________________________________________</p><p>6. <strong>Write the relative path to expanded ‘td’ node</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*au5BBWIYmRSBglo16YS2lQ.png" /></figure><p>Answer — //table/tbody/tr[2]/td</p><p>7. <strong>Identify third ‘tr’ node from expanded ‘td’ node</strong></p><p>Answer — //table/tbody/tr[2]/td/../../tr[3]</p><p>_______________________________________________________________</p><p>8. <strong>Identify first child of ‘tr’ node</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/501/1*9CLoTjIBDIYe9Xk-yI05Nw.png" /></figure><p>Answer — //tr/td[1]</p><p>9. <strong>Identify last child of ‘tr’ node</strong></p><p>Answer — //tr/td[last()]</p><p>10. <strong>Identify second to last child of ‘tr’ node (in this scenario, 4th ‘td’ node)</strong></p><p>Answer — //tr/td[last()-1]</p><p>11. <strong>Identify 3rd position ‘td’ node</strong></p><p>Answer — //tr/td[position()=3]</p><p>12. <strong>Identify last position ‘td’ node</strong></p><p>Answer — //tr/td[position()=last()]</p><p>_______________________________________________________________</p><p>13. <strong>Identify ‘h2’ node from text</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/223/1*p6QWqJgbB8nX8aRfWYCS5g.png" /></figure><p>Answer — //h2[text()=’Search Vehicle’]</p><p>_______________________________________________________________</p><p>14. <strong>Identify ‘h2’ node contains ‘Vehicle’ as text</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*TmpJF84vm608PrqMqvTy0g.png" /></figure><p>Answer — //h2[contains(text(),’Vehicle’)]</p><p>_______________________________________________________________</p><p>15. <strong>Identify ‘img’ node contains ‘src’ attribute value as ‘thumbtoyota’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*41ne-FZtIQx__QO2F4kELw.png" /></figure><p>Answer — //img[contains(@src,’thumbtoyota’)]</p><p>_______________________________________________________________</p><p>16. <strong>Identify ‘input’ node, under ‘div’ node having ‘h2’ node text as ‘Search Vehicles’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*xDFftgV-NPldQM19GXAK8w.png" /></figure><p>Answer — //div/h2[text()=’Search Vehicles’]/ following-sibling::input[@id=’model’]</p><p>_______________________________________________________________</p><p>17. <strong>Identify the ‘img’ node having ‘src’ attribute value starts with ‘thumb’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/517/1*MyNNrb9A3y6a69pGOHnmcw.png" /></figure><p>Answer — //img[starts-with(@src,’thumb’)]</p><p>_______________________________________________________________</p><p>18. <strong>Identify ‘div’ node which do not contain any child nodes</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*qri1CCsJ_4-JmLDw-mtYxA.png" /></figure><p>Answer — //div[count(*)=0]</p><p>19. <strong>Identify ‘div’ node which contains two child nodes</strong></p><p>Answer — //div[count(*)=2]</p><p>_______________________________________________________________</p><p>20. <strong>Identify, ‘nobr’ node which contains text “TEAM” starting from nobr node having text ‘GROUP’</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*8fc6A8s_1I9Io-YTkdhsoQ.png" /></figure><p>Answer — //td[@class=’dataValueRead’]/div/nobr[text()=’GROUP’]/following::nobr[1]</p><p>21. <strong>Identify, ‘nobr’ node which contains text “GROUP” starting from nobr node having text ‘TEAM’</strong></p><p>Answer — //td[@class=’dataValueRead’]/div/nobr[text()=’TEAM’]/preceding::nobr[1]</p><p>_______________________________________________________________</p><p><strong><em>Scenario 1</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/439/1*sWflwzOVcD4s-iOnvp0fJQ.png" /></figure><p><strong><em>Scenario 2</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*_DCN27VyW6cAVN_rRQKvQg.png" /></figure><p>22. <strong>Write a single xpath to identify ‘td’ node which contains text “TEAM” under any child node (both in scenario 1 and 2)</strong></p><p>Answer — //td[contains(normalize-space(),’TEAM’)]</p><p>Happy Testing :D</p><p><em>references</em></p><ul><li><a href="https://stqatools.com/selenium-absolute-relative-xpath/">SELENIUM Absolute Relative XPath in selenium with Example</a></li><li><a href="http://pragmatictestlabs.com/2020/01/28/mastering-xpath-for-selenium-test-automation-engineers/">Mastering XPath for Selenium Test Automation Engineers</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54c90e1cfe73" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>