<?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 Can Seker on Medium]]></title>
        <description><![CDATA[Stories by Can Seker on Medium]]></description>
        <link>https://medium.com/@can.seker?source=rss-9d4236e5af45------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-_CbdtiHQQjH0RnE_73rMQ.png</url>
            <title>Stories by Can Seker on Medium</title>
            <link>https://medium.com/@can.seker?source=rss-9d4236e5af45------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 07:42:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@can.seker/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[SonarQube - Step by Step Static Code Analysis Implementation]]></title>
            <link>https://medium.com/@can.seker/sonarqube-step-by-step-static-code-analysis-implementation-54eac845c486?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/54eac845c486</guid>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[code-analysis]]></category>
            <category><![CDATA[sonarqube]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 11:56:50 GMT</pubDate>
            <atom:updated>2023-08-07T13:37:02.990Z</atom:updated>
            <content:encoded><![CDATA[<p>Static code analysis is the process of analyzing the source code of software. This analysis is performed as a review process before the code is compiled or executed. Static code analysis is used to identify the structure, style, errors, defects, security vulnerabilities, and performance issues in the code.</p><p>Static code analysis is carried out using automated tools or software platforms. These tools scan the source code, calculate code metrics, and check whether the code conforms to specific rules or best practices. They can also perform functions such as error detection, identifying defects in the code, detecting potential security vulnerabilities, evaluating code quality, and finding performance issues.</p><ul><li>Bug effects: Possible errors, logic errors, or pieces of code that do not follow certain rules of the language are detected. This helps to study errors that will arise during operation.</li><li>Flaw detection: Identifies areas of code that are difficult to maintain or malicious applications. The readability of this code is increased and it is made more maintainable.</li><li>Vulnerabilities: Potential vulnerabilities, pieces of code or vulnerabilities are detected that could lead to malicious attacks. This helps augment the software’s instructions.</li><li>Performance values: Code fragments that cause performance speeds are identified and more effective or optimized code alternatives can be offered.</li><li>Code quality configurations: Compliance with code editors or best practices specified in software projects is checked. This allows to build a code database and develop better quality software around here.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UX1ECC8HMre6r_wZwyKBiQ.png" /></figure><p>SonarQube is an open source platform for software quality and security. It is used to detect and analyze errors, flaws and vulnerabilities in code that occur in software projects.</p><p>SonarQube provides various metrics and statistics by doing source code analysis. With these analyzes you can evaluate the quality, maintainability, performance and security of the code. It is an essential tool for understanding and improving the code base, especially in large and complex projects.</p><p>SonarQube is compatible with a variety of programming languages and technologies. It supports Java, C#, C/C++, Python, JavaScript, TypeScript, Ruby, PHP, Swift, Objective-C and many more. It also offers different integration options and can be integrated into CI/CD (Continuous Integration/Continuous Deployment) processes.</p><p><strong>You can follow the steps below to start code analysis your projects</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/0*X51en6ADeNht7l4t.png" /></figure><p>Before we initiate the demo we’ll be conducting, the first step is to prepare the necessary tools. At this stage, we can download the SonarQube Community version that we’ll be using onto our computer.</p><p><a href="https://www.sonarsource.com/products/sonarqube/downloads/">https://www.sonarsource.com/products/sonarqube/downloads/</a></p><p>Once we have the downloaded file for installation, within the &quot;bin&quot; directory of the downloaded package, we&#39;ll find the appropriate &quot;sh&quot; or &quot;bat&quot; file that matches our operating system. Running this file will initiate the installation process and set everything in motion.<br><strong>SonarQube\bin\windows-x86–64</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*ErxQq_PkbpUlyc1dtjR70Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZ-PfvAn3gxiOyd6R8ibpg.png" /></figure><p>After the “bat” file runs successfully, we can then establish control by accessing “localhost:9000” through our web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5jvkwbdrXyQiCi4LS1g4mQ.png" /></figure><p>We begin by providing the necessary project details for the code analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lr-6ztgbPl4h14MAyFISrA.png" /></figure><p>We proceed by selecting the repository information for the code analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c8DIdRCTl7qWn_sw0dT13Q.png" /></figure><p>After choosing the environment in which we’ll perform the build for code analysis, we can use the generated token to execute the necessary commands. By utilizing this token, the appropriate platform for the project’s code analysis will be accessible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6us56MP1l_zpLitBo-uYAQ.png" /></figure><p>Upon executing the required commands, the project’s code analysis should generate outcomes that are reflected in the displayed interface of the appropriate platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uIkr2LksbiVxrtHcNieJoA.png" /></figure><p>The analysis results can be examined on the dashboard, allowing for a review based on the priority status.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*bYO_HZTiqreBNJy0B-AyIA.png" /></figure><p>Upon completion of the code analysis, the subsequent steps can be displayed, showcasing either the fixes that need to be made or informative messages for guidance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gl19waqzmdgzq9sWaOSeKA.png" /></figure><p>You can find more information about SonarQube at the following link.</p><p><a href="https://docs.sonarsource.com/sonarqube/latest/">SonarQube 10.7</a></p><p>About to be together in our next article.<br>Stay Tuned</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=54eac845c486" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenium, Allure Report, TestNG, and JUnit: E2E Test Automation for Web Applications]]></title>
            <link>https://medium.com/@can.seker/selenium-allure-report-testng-and-junit-e2e-test-automation-for-web-applications-996f7c85b0b4?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/996f7c85b0b4</guid>
            <category><![CDATA[testng]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[allure-reporting]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Tue, 23 May 2023 18:57:24 GMT</pubDate>
            <atom:updated>2023-05-23T19:03:02.370Z</atom:updated>
            <content:encoded><![CDATA[<p>Selenium is an open-source testing tool used to automate web applications. It allows you to test web applications by automatically controlling web browsers, simulating user interactions, and analyzing data on web pages.</p><p>Selenium provides a range of tools and libraries that can be used in different programming languages such as Java, C#, Python, and more. These tools include Selenium WebDriver, Selenium IDE, Selenium Grid, and Selenium Remote Control.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*Wr-C2WZQWLFNSDHmyOirMg.png" /></figure><ul><li><strong>Selenium WebDriver</strong> is the most popular Selenium tool used for automatically controlling a web browser. WebDriver can perform actions such as navigating web pages, filling out forms, clicking, entering text, and scrolling pages automatically. It can also be used for executing test scenarios automatically and reporting the results.</li><li><strong>Selenium IDE</strong> is a tool that is used as a browser extension to record and execute test scenarios. Although Selenium IDE has limited functionality, it can be used quickly and easily for simple test scenarios.</li><li><strong>Selenium Grid</strong> is a tool used to execute multiple test scenarios simultaneously on different browsers and operating systems.</li><li><strong>Selenium Remote Control (RC) </strong>is an older tool that is no longer recommended for use.</li></ul><p>To start writing automation tests using Java and Selenium, you can follow the steps below:</p><p>Firstly, Java and JDK need to be installed. You can perform the installation from the link provided below.</p><pre>#Java &amp; JDK Install<br>Download: https://www.oracle.com/java/technologies/downloads/</pre><p>We need a convenient IDEA when writing tests. You can perform the installation of IntelliJ from the link provided below.</p><pre>#Intellij<br>Download: https://www.jetbrains.com/idea</pre><p>You can add the required libraries to your projects using Maven.</p><pre>#Maven<br>https://mvnrepository.com/<br><br>&lt;dependencies&gt;<br># JUnit is a dependency that is necessary for adding annotations to our JUnit tests for tasks such as ordering, defining, and other operations.<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;junit&lt;/groupId&gt;<br>            &lt;artifactId&gt;junit&lt;/artifactId&gt;<br>            &lt;version&gt;4.13&lt;/version&gt;<br>            &lt;scope&gt;compile&lt;/scope&gt;<br>        &lt;/dependency&gt;<br># Selenium is a dependency that is necessary for automating our tests for Selenium test automation.<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.9.1&lt;/version&gt;<br>        &lt;/dependency&gt;<br># TestNG is a dependency that is necessary for adding annotations to our TestNG tests for tasks such as ordering, defining, and other operations.<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;6.14.3&lt;/version&gt;<br>        &lt;/dependency&gt;<br># Allure and AspectJ is a dependency that allows us to use Allure Report for reporting our tests.<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;io.qameta.allure&lt;/groupId&gt;<br>            &lt;artifactId&gt;allure-testng&lt;/artifactId&gt;<br>            &lt;version&gt;2.21.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.aspectj&lt;/groupId&gt;<br>            &lt;artifactId&gt;aspectjweaver&lt;/artifactId&gt;<br>            &lt;version&gt;1.9.4&lt;/version&gt;<br>            &lt;scope&gt;runtime&lt;/scope&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;</pre><p>We are creating a Page Object Model to write our tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*TLTHltQuxSTzvCv9bU_RMg.jpeg" /></figure><p>You need to import the libraries you want to use into the BaseTest.java file.</p><pre>//It contains the necessary dependency to use the general methods of the Selenium library in the project.<br>import org.openqa.selenium.*;<br>//It contains the dependency required to use the TestNG framework.<br>import org.testng.annotations.BeforeTest;</pre><pre> @BeforeTest<br>    public void openBrowser() {<br>        String tarayici = System.getProperty(&quot;browser&quot;);<br>        String osName = System.getProperty(&quot;os.name&quot;);<br><br>        //If the &quot;browser&quot; property is null, it will be set as Chrome.<br>        if (tarayici== null) {tarayici=&quot;Chrome&quot;;}<br><br>        System.out.println(tarayici);<br><br>        // The browser option is checked to ensure its validity.<br>        if (tarayici.equals(&quot;Chrome&quot;)) {<br>            if (osName.equals(&quot;Mac OS X&quot;)) {<br>                System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;driver/chromedriver&quot;);<br>            } else {<br>                System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;driver/chromedriver.exe&quot;);<br>            }<br>            ChromeOptions co = new ChromeOptions();<br>            co.addArguments(&quot;--remote-allow-origins=*&quot;);<br>            driver = new ChromeDriver(co);<br>        }<br>        else {<br>            if (osName.equals(&quot;Mac OS X&quot;)) {<br>                System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;driver/geckodriver&quot;);<br>            } else {<br>                System.setProperty(&quot;webdriver.chrome.driver&quot;, &quot;driver/geckodriver.exe&quot;);<br>            }<br>            driver = new FirefoxDriver();<br>        }<br>        // To open the Parabank homepage in the browser<br>        driver.get(&quot;https://parabank.parasoft.com&quot;);<br>        // To maximize the browser to full-screen mode<br>        driver.manage().window().maximize();<br>    }</pre><p>We are writing test scenarios for the login module in theLoginTests.java file.</p><p>We create an Interface for the test steps found in theLoginPage.java class and call them within our tests. Since we are using the Page Object Model (POM), we can reuse these steps in different tests.</p><p>In case of maintenance requirements in the steps, we can easily make fixes for multiple test scenarios by making changes to the steps.</p><p>We specify our tests using the @Testannotation</p><pre>import Base.BaseTest;<br>import Pages.AccountPage;<br>import Pages.HomePage;<br>import io.qameta.allure.Feature;<br>import org.testng.annotations.Test;<br><br>@Feature(&quot;Login Tests&quot;)<br>public class LoginTest extends BaseTest {<br><br>    @Test(description = &quot;TC0001 Success Login User&quot;)<br>    public void TC0001() {<br><br>        HomePage homePage = new HomePage(driver);<br>        AccountPage accountPage = new AccountPage(driver);<br><br>        homePage<br>                .fillUsername(&quot;Test&quot;)<br>                .fillPassword(&quot;Test123456&quot;)<br>                .login();<br>        accountPage<br>                .accountPageController(&quot;Accounts Overview&quot;);<br>    }<br><br>    @Test(description = &quot;TC0002 Username field is null user&quot;)<br>    public void TC0002() {<br>        HomePage homePage = new HomePage(driver);<br>        AccountPage accountPage = new AccountPage(driver);<br><br>        homePage<br>                .fillUsername(&quot;&quot;)<br>                .fillPassword(&quot;Test123456&quot;)<br>                .login()<br>                .errorMessageController(&quot;Please enter a username and password.&quot;);<br>    }<br><br>}</pre><p>We are writing test steps for the login module in the LoginPage.java file.</p><pre>package Pages;<br><br>import Base.BaseLib;<br>import io.qameta.allure.Allure;<br>import io.qameta.allure.Step;<br>import org.junit.Assert;<br>import org.openqa.selenium.*;<br><br>public class HomePage extends BaseLib {<br><br>    private WebDriver driver;<br><br>    public HomePage(WebDriver driver){<br>        this.driver =  driver;<br>    }<br><br>    @Step(&quot;Fill username&quot;)<br>    public HomePage fillUserName(String text){<br>        driver.findElement(By.name(&quot;username&quot;)).sendKeys(text);<br>        return this;<br>    }<br><br>    @Step(&quot;Fill password&quot;)<br>    public HomePage passwordDoldur(String pass){<br>        driver.findElement(By.name(&quot;password&quot;)).sendKeys(pass);<br>        return this;<br>    }<br><br>    @Step(&quot;Login button clicked&quot;)<br>    public HomePage login(){<br>        driver.findElement(By.cssSelector(&quot;#loginPanel &gt; form &gt; div:nth-child(5) &gt; input&quot;)).click();<br>        return this;<br>    }<br><br>    @Step(&quot;Error message controller: {text}&quot;)<br>    public HomePage errorKontrolu(String text){<br>        String value =  driver.findElement(By.cssSelector(&quot;#rightPanel &gt; p&quot;)).getText();<br>        Assert.assertEquals(text, value);<br>        Allure.addAttachment(text + &quot;: erorr message is seen&quot;,&quot;&quot;);<br>        attachScreenshot(driver);<br>        return this;<br>    }<br><br>}</pre><p>In the Selenium library, the driver.findElement() method is used to locate the desired element. You need to specify the element you want to search for inside this method. For example, you can use driver.findElement(By.name(&quot;username&quot;)) to search for an element with the name attribute set to &quot;username&quot;.</p><ul><li><strong>By.id(String id)</strong>: It searches for the element whose “id” attribute matches the given value.</li><li><strong>By.name(String name)</strong>: It searches for the element whose “name” attribute matches the given value.</li><li><strong>By.className(String className)</strong>: It searches for the element whose “class” attribute matches the given value.</li><li><strong>By.cssSelector(String css)</strong>: It searches for the element whose “css-selector” attribute matches the given value.</li><li><strong>By.xpath(String xpath)</strong>: It searches for the element whose “XPATH” attribute matches the given value.</li><li><strong>By.tagName(String tagName)</strong>: It searches for the element whose “tagName” attribute matches the given value.</li><li><strong>By.linkText(String linkText)</strong>: It searches for the element whose “linkText” attribute matches the given value.</li></ul><pre>WebElement txtUsername = driver.findElement(By.name(&quot;username&quot;));</pre><p>There are multiple functions in the Selenium library. It performs the operation we want to make to the element with these functions. For example, using driver.findElement(By.name(&quot;username&quot;)).sendKeys(&quot;TestQA&quot;) it searches for the element whose name is “username” and writes TestQA in the content of this element.</p><ul><li><strong>sendKeys(CharSequence... keysToSend)</strong>: Entering text into an element driver.findElement(By.name(&quot;username&quot;)).sendKeys(&quot;TestQA&quot;) used as.</li><li><strong>click()</strong> : Used to click an element. driver.findElement(By.name(&quot;login&quot;)).click() used as.</li><li><strong>clear()</strong>: It is used to clear the contents of an element.<br>driver.findElement(By.name(&quot;username&quot;)).clear() used as.</li><li><strong>submit()</strong>: Used to submit a form.<br>driver.findElement(By.name(&quot;login&quot;)).submit() used as.</li><li><strong>getAttribute(String attributeName)</strong> : It is used to get a specific attribute value of an element.<br>driver.findElement(By.name(&quot;login&quot;)).getAttribute(&quot;type&quot;) used as.</li><li><strong>getCssValue(String propertyName)</strong> : It is used to get a specific CSS value of an element.<br>driver.findElement(By.name(&quot;login&quot;)).getCssValue(&quot;color&quot;) used as</li></ul><pre>    WebElement txtUserName = driver.findElement(By.name(&quot;username&quot;));<br><br>public LoginPage userName(String userName) {<br>        txtUserName.sendKeys(userName);<br>        return this;<br>    }</pre><p>Selenium and Junit provides several “assert” methods to control expectation of elements. “assert” methods expect elements to have a certain property or perform a certain action.</p><ul><li><strong>assertEquals(expected, actual)</strong>: It compares the expected value (expected) with the actual value (actual) and checks if they are equal.</li><li><strong>isDisplayed()</strong> Used to check whether a WebElement is visible on the page.</li><li><strong>isEnabled() </strong>: Used to check whether a WebElement is enable on the page.</li><li><strong>isSelected()</strong>: Used to check if a WebElement is selected.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fl9N51QZTncI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dl9N51QZTncI&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ccc716f48e36388009ce796f8926da92/href">https://medium.com/media/ccc716f48e36388009ce796f8926da92/href</a></iframe><p>You can find more information about Selenium at the following link.</p><p><a href="https://www.selenium.dev/documentation/">The Selenium Browser Automation Project</a></p><p>You can access the demo project I have prepared for you from the repository link.</p><p><a href="https://github.com/can-seker/selenium-test-automation">GitHub - can-seker/selenium-test-automation: Selenium is an open-source testing tool used to automate web applications. It allows you to test web applications by automatically controlling web browsers, simulating user interactions, and analyzing data on web pages.</a></p><p>About to be together in our next article.</p><p>Stay Tuned</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=996f7c85b0b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cypress: JavaScript API Testing]]></title>
            <link>https://medium.com/@can.seker/cypress-javascript-api-testing-ca1eb31522c0?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca1eb31522c0</guid>
            <category><![CDATA[api-testing]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[api-test-automation]]></category>
            <category><![CDATA[cypress]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Thu, 11 May 2023 22:43:11 GMT</pubDate>
            <atom:updated>2023-05-11T22:43:11.047Z</atom:updated>
            <content:encoded><![CDATA[<p>API tests are used to check whether APIs are working correctly or not. Such tests can verify whether the API responds to a specific request URL, whether the data returned by the response is correct, and whether the API responds correctly to error situations. <strong>Cypress </strong>provides a way to perform API tests using the cy.request() command. This command allows you to send HTTP requests and test responses. When performing API tests with <strong>Cypress</strong>, you can use the same <strong>Cypress </strong>test interface for writing test code and analyzing results. This enables API tests to be performed quickly and results to be easily viewed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*PpZk1knHjIadHW-lpWSsOQ.png" /></figure><p><strong>You can follow the steps below to start writing your tests using JavaScript and Cypress:</strong></p><pre># Node.js<br>curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -<br>sudo apt-get install -y nodejs<br><br># Cypress<br>npm install cypress</pre><p>Create a file to write your tests. You can name it something like <strong><em>userTests.cy.js</em></strong></p><p>Write your tests using the <strong>describe()</strong> and<strong> it()</strong> functions. The <strong>describe()</strong> function represents a block of tests that are grouped together, while the<strong> it()</strong> functions represent individual tests within that block.</p><pre>describe(&quot;GET /v2/user&quot;, function() {<br> it(&quot;TC&quot;, function () {<br> // Test Cases<br> });<br>it(&quot;POST /v2/user/{userName}&quot;, function () {<br> // Test Cases<br> });<br>});</pre><p>In your tests, make API calls using request functions such as <strong><em>GET, POST, PUT, PATCH, </em></strong>or <strong><em>DELETE.</em></strong></p><pre>cy.request(&#39;GET&#39;, &#39;https://petstore.swagger.io/v2/user/testqauser21&#39;)</pre><p>Check the responses of your requests using the expect() function. For example, you can expect the status code of the response to be 200 (OK):</p><pre>const userName = &#39;testqauser21&#39;<br><br>cy.request(&#39;GET&#39;, `https://petstore.swagger.io/v2/user/`+userName)<br>    .then((response) =&gt; {<br>      expect(response.status).to.eq(200)<br>    })</pre><p>HTTP status codes are three-digit numeric codes that indicate how a web server responded to an HTTP request.</p><ul><li><strong>200 OK: </strong>The request was successfully processed and the expected data was sent by the server in response.</li><li><strong>301 Moved Permanently: </strong>The requested resource has been permanently moved to a different URL.</li><li><strong>400 Bad Request: </strong>The server could not understand the request because it was malformed or invalid.</li><li><strong>401 Unauthorized: </strong>The request was rejected by the server because it requires authentication.</li><li><strong>404 Not Found:</strong> The requested resource could not be found on the server.</li><li><strong>403 Forbidden:</strong> The server refused to process the request by the client because the client failed to provide correct authentication or tried to access a forbidden resource.</li><li><strong>500 Internal Server Error</strong>: The server encountered an error while processing the request.</li><li><strong>503 Service Unavailable: </strong>The server couldn’t process or respond to the client’s request, usually due to server overload, maintenance work, or temporary service outage.</li></ul><p><strong>Cypress </strong>allows you to send parameters like request body, header, and query string (qs) while creating HTTP requests.</p><p>As shown in the code example below, you can send request body and headers while creating a POST request:</p><pre>      const postData = {<br>        &quot;id&quot;: 78799781,<br>        &quot;username&quot;: &quot;testqauser21&quot;,<br>        &quot;firstName&quot;: &quot;test&quot;,<br>        &quot;lastName&quot;: &quot;qa&quot;,<br>        &quot;email&quot;: &quot;testqa@test.com&quot;,<br>        &quot;password&quot;: &quot;test123&quot;,<br>        &quot;phone&quot;: &quot;54545454545&quot;,<br>        &quot;userStatus&quot;: 1<br>      }<br>      const headers = {<br>        &#39;Content-Type&#39;: &#39;application/json&#39;,<br>        &#39;Authorization&#39;: &#39;Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9&#39;<br>      }<br><br>      cy.request({<br>        method: &#39;POST&#39;,<br>        url: &#39;https://petstore.swagger.io/v2/user&#39;,<br>        body: postData,<br>        headers: headers<br>      })<br>      .then((response) =&gt; {<br>        expect(response.status).to.eq(200)<br>      })</pre><p>You can also send Query String (qs) values while creating a request in the same way.</p><pre>const userName = &#39;testqauser21&#39;<br>    const qsParams = {<br>      param1: &#39;test1&#39;,<br>      param2: &#39;test2&#39;<br>    }<br>    cy.request(&#39;GET&#39;, `https://petstore.swagger.io/v2/user/`+userName, {<br>      query: qsParams<br>    })<br>    .then((response) =&gt; {<br>      expect(response.status).to.eq(200)<br>    })</pre><p>After creating your documentation, you can run the userTests.cy.js file using the following command:</p><pre>npx cypress run</pre><p>When the command “<strong><em>npx cypress run</em></strong>” is executed, your tests will run and a report will be displayed as output showing whether the tests have passed or failed.</p><pre> Petstore API TESTING<br>    √ POST /v2/user (User Create) (993ms)<br>    √ PUT /v2/user/{username} (User Update) (220ms)<br>    √ GET /v2/user/{userName} (243ms)<br>    √ GET /v2/user/login} (224ms)<br>    √ Delete /v2/user/ (User Delete) (223ms)<br>    1) GET /v2/user/{userName}<br>    √ GET /v2/user/logout (207ms)<br><br><br>  6 passing (3s)<br>  1 failing<br><br>  1) Petstore API TESTING<br>       GET /v2/user/{userName}:<br>     CypressError: `cy.request()` failed on:<br><br>https://petstore.swagger.io/v2/user/testqa7451656<br><br>The response we received from your web server was:<br><br>  &gt; 404: Not Found<br><br>This was considered a failure because the status code was not `2xx` or `3xx`.<br><br>If you do not want status codes to cause failures pass the option: `failOnStatusCode: false`<br><br>  (Results)<br><br>  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐<br>  │ Tests:        7                                                                                │<br>  │ Passing:      6                                                                                │<br>  │ Failing:      1                                                                                │<br>  │ Pending:      0                                                                                │<br>  │ Skipped:      0                                                                                │<br>  │ Screenshots:  1                                                                                │<br>  │ Video:        true                                                                             │<br>  │ Duration:     2 seconds                                                                        │<br>  │ Spec Ran:     UserTests.cy.js                                                                  │<br>  └────────────────────────────────────────────────────────────────────────────────────────────────┘<br><br><br>  (Screenshots)<br><br>  -  cypress-api-testing\cypress\screenshots\     (1280x720)<br>     UserTests.cy.js\Petstore API TESTING -- GET v2user{userName} (failed).png<br><br><br>  (Video)<br><br>  -  Started processing:  Compressing to 32 CRF<br>  -  Finished processing: 0 seconds<br><br>  -  Video output: cypress-api-testing\cypress\videos\UserTests.cy.js.mp4<br><br><br>====================================================================================================<br><br>  (Run Finished)<br><br><br>       Spec                                              Tests  Passing  Failing  Pending  Skipped<br>  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐<br>  │ ×  UserTests.cy.js                          00:02        7        6        1        -        - │<br>  └────────────────────────────────────────────────────────────────────────────────────────────────┘<br>    ×  1 of 1 failed (100%)                     00:02        7        6        1        -        -</pre><p>This output shows whether the tests have passed or failed, and displays error messages for the failed tests.</p><pre>npx cypress open</pre><p>When you execute the command “<strong><em>npx cypress open</em></strong>”, you will be able to run your tests and a dashboard will be displayed as output showing whether the tests have passed or failed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mwug8dy1BrCHQjK5veQMRw.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FwbsHlJ0obeE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DwbsHlJ0obeE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FwbsHlJ0obeE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/50d5c01754da577e805c0b92d97424f6/href">https://medium.com/media/50d5c01754da577e805c0b92d97424f6/href</a></iframe><p>You can find more information about Cypress at the following link.</p><p><a href="https://docs.cypress.io/guides/overview/why-cypress">Comprehensive Cypress Test Automation Guide | Cypress Documentation</a></p><p>You can access the demo project I have prepared for you from the repository link.</p><p><a href="https://github.com/can-seker/cypress-api-testing">GitHub - can-seker/cypress-api-testing: cypress-api-testing</a></p><p>About to be together in our next article.</p><p>Stay Tuned</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca1eb31522c0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cypress: JavaScript Tabanlı E2E Test Otomasyonu]]></title>
            <link>https://medium.com/@can.seker/cypress-javascript-tabanl%C4%B1-e2e-test-otomasyonu-e47a8fef59ea?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/e47a8fef59ea</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[cypress-testing]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Sat, 04 Feb 2023 14:53:54 GMT</pubDate>
            <atom:updated>2023-02-04T14:53:54.990Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Cypress</strong>, end-to-end (E2E) web uygulamalarının testini yapmak için kullanılan açık kaynaklı bir JavaScript test framework’dür. Cypress, tarayıcı üzerinde çalışan testlerle hızlı ve güvenilir bir şekilde web uygulamalarının fonksiyonelitesini test edebilmeyi amaçlar. Cypress, tarayıcı üzerinde gerçek kullanıcı deneyimini taklit ederek, tüm tarayıcı uygulamalarının yanı sıra back-end ve API’lere de erişebilme özelliğine sahiptir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*TiIryqVoBRDk6RKJV9NleA.png" /></figure><ul><li><strong>Kullanım kolaylığı: </strong>Cypress, JavaScript tabanlı ve kullanımı kolay bir framework olması sayesinde web uygulamalarının testini hızlı ve etkileyici şekilde yapabilme imkanı sunar.</li><li><strong>End-to-End Testler:</strong> Cypress, end-to-end testler için tasarlanmış bir framework olduğundan, tüm web uygulamalarının çalışma şeklini test edebilme imkanı sunar.</li><li><strong>Hız: </strong>Cypress, web tarayıcısını kontrol ederek test yapma şekline sahiptir. Bu nedenle test süresi çok hızlıdır ve testin çalışması için fazladan bir sunucuya ihtiyaç duymaz.</li><li><strong>Cross-Browser Desteği</strong>: Cypress, tüm popüler web tarayıcılarında çalışabilen bir framework olduğundan, cross-browser testleri rahatça yapabilme imkanı sunar.</li><li><strong>Gerçek Kullanıcı Deneyimi</strong>: Cypress, testleri tarayıcı üzerinden gerçekleştirir, bu nedenle gerçek kullanıcı deneyimini yakalamanız mümkündür.</li><li><strong>Debugging</strong>: Cypress, geliştiricilerin hızlı ve etkileyici şekilde test hata ayıklamalarını yapabilmelerine olanak tanır.</li><li><strong>Time-Travel:</strong> Cypress, test esnasında gerçekleşen işlemleri kaydederek, bu işlemlere daha sonra tekrar bakabilme ve hata ayıklama yapabilme imkanı sunar.</li><li><strong>Ek Güçlü Özellikler:</strong> Cypress, makro kaydetme, otomatik reload, ve çoklu tarayıcı desteği gibi ek güçlü özelliklere sahiptir.</li></ul><p><strong>Testlerinizi JavaScript ve Cypress kullanarak yazmaya başlamak için aşağıdaki adımları izleyebilirsiniz:</strong></p><p>Öncelikle, Node.js ve Cypress’in aşağıdaki komutları kullanarak kurulumu gerçekleştirebilirsiniz:</p><pre># Node.js<br>curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -<br>sudo apt-get install -y nodejs<br><br># Cypress<br>npm install cypress</pre><p>Testlerimizi yazmak için Page Object Model oluşturuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/635/1*MouXfu2wegNw69R7YodUew.png" /></figure><p>Daha sonra, testlerinizi yazmak için bir dosya oluşturun. Örneğin, userTests.cy.js olarak adlandırabilirsiniz. (Test senaryolarınızın dosyalarını belirtmek için .cy.js uzantısını kullanmalısınız.)</p><pre>describe(&#39;Login Module&#39;, () =&gt; {<br>  it(&#39;TC0001 - Login User Control&#39;, () =&gt; {<br>    cy.visit(&#39;https://demo.borland.com/InsuranceWebExtJS/&#39;)<br><br>    cy.get(&quot;[id=&#39;login-form:email&#39;]&quot;).type(&quot;john.smith@gmail.com&quot;);<br><br>    cy.get(&quot;[id=&#39;login-form:password&#39;]&quot;).type(&quot;john&quot;);<br><br>    cy.get(&quot;[id=&#39;login-form:login&#39;]&quot;).click();<br>    <br>    cy.get(&quot;[id=&#39;logout-form&#39;] p&quot;).should(&quot;have.text&quot;, &quot;Logged in as&quot;);<br>  })<br>})</pre><p>describe() ve it() fonksiyonlarını kullanarak testlerinizi yazın. describe() fonksiyonu, bir grup testin bir arada olduğu bir bloğu temsil etmektedir ve it() fonksiyonları ise bu bloktaki testleri temsil eder.</p><pre>describe(&quot;Login Module&quot;, function() {<br> it(&quot;TC0001 - Login User Control&quot;, function () {<br> // Test kodlarınız<br> });<br>it(&quot;TC0002 - Login Logout User Control&quot;, function () {<br> // Test kodlarınız<br> });<br>});</pre><p>cy.visit(url): Belirtilen URL&#39;yi ziyaret etmek için kullanılır.</p><pre>cy.visit(&#39;https://demo.borland.com/InsuranceWebExtJS/&#39;)</pre><p>cy.get(selector): Belirtilen selector&#39;a göre HTML elementini seçer.<br>cy.type(text): Seçilen elemente metin girişi yapar.</p><pre>cy.get(&quot;[id=&#39;login-form:password&#39;]&quot;).type(&quot;john&quot;);</pre><p>cy.click(): Seçilen elemente tıklama işlemini yapar.</p><pre>cy.get(&quot;[id=&#39;login-form:login&#39;]&quot;).click();</pre><p>cy.should(assertion): Test koşullarını belirler. <br>.should(&#39;have.text&#39;, &#39;text&#39;) metnin belirtilen metnin içinde bulunmasını bekler.</p><pre>cy.get(&quot;[id=&#39;logout-form&#39;] p&quot;).should(&quot;have.text&quot;, &quot;Logged in as&quot;);</pre><p>cy.select(): Bu fonksiyon, bir select elementinin belirli bir seçeneğini seçmek için kullanılır</p><pre>cy.get(&quot;[id=&#39;signup:state&#39;]&quot;).select(&#39;AL&#39;)</pre><p>cy.get().check(): Radio button veya checkbox’un seçimi için kullanılır.</p><pre>cy.get(&quot;[name=&#39;checkbox-name&#39;]&quot;).check();</pre><p>Cypress framework’ünde bulunan kodları kullanmak için cy komutu ile çağırabilirsiniz.</p><ul><li>cy.contains(text): Belirtilen metnin bulunduğu bir HTML elementini seçer.</li><li>cy.get(selector): Belirtilen selector&#39;a göre HTML elementini seçer.</li><li>cy.url(): Aktif URL&#39;yi döndürür.</li><li>cy.clear(): Seçilen elementin içeriğini temizler.</li><li>cy.wait(time): Belirtilen zaman kadar bekleme yapar.</li><li>cy.reload(): Sayfanın yeniden yüklenmesini yapmaya yarar.</li></ul><p>Testlerinizi oluşturduktan sonra, aşağıdaki komutları kullanarak testlerinizi başlatabilirsiniz:</p><pre>## Run CommandLine tests<br>Run this command: **npx cypress run**<br><br>## Run tests Dashboard<br>Run this command: **npx cypress open**</pre><p>npx cypress runkomut çalıştırıldığında, testleriniz çalıştırılacak ve çıktı olarak, testlerin başarılı veya başarısız olduğunu gösteren bir rapor görüntülenecektir.</p><pre>====================================================================================================<br><br>  (Run Starting)<br><br>  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐<br>  │ Cypress:        12.5.0                                                                         │<br>  │ Browser:        Electron 106 (headless)                                                        │<br>  │ Node Version:   v14.17.4 (C:\Program Files\nodejs\node.exe)                                    │<br>  │ Specs:          2 found (Login.cy.js, Register.cy.js)                                          │<br>  │ Searched:       cypress/e2e/**/*.cy.{js,jsx,ts,tsx}                                            │<br>  └────────────────────────────────────────────────────────────────────────────────────────────────┘<br><br>────────────────────────────────────────────────────────────────────────────────────────────────────<br><br>  Running:  Login.cy.js                                                                     (1 of 2)<br><br>  Login Module<br>    √ TC0001 - Login User Control (2240ms)<br>    √ TC0002 - Login Logout User Control (6310ms)<br>    √ TC0003 - Login Error User Control (1310ms)<br><br>  3 passing (12s)<br><br>  (Results)<br><br>  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐<br>  │ Tests:        3                                                                                │<br>  │ Passing:      3                                                                                │<br>  │ Failing:      0                                                                                │<br>  │ Pending:      0                                                                                │<br>  │ Skipped:      0                                                                                │<br>  │ Screenshots:  0                                                                                │<br>  │ Video:        true                                                                             │<br>  │ Duration:     12 seconds                                                                       │<br>  │ Spec Ran:     Login.cy.js                                                                      │<br>  └────────────────────────────────────────────────────────────────────────────────────────────────┘<br><br>  (Video)<br><br>  -  Started processing:  Compressing to 32 CRF<br>  -  Finished processing: 1 second<br><br>  -  Video output: cypress-test-automation\cypress\videos\Login.cy.js.mp4<br><br>────────────────────────────────────────────────────────────────────────────────────────────────────<br><br>====================================================================================================<br><br>  (Run Finished)<br><br>       Spec                                              Tests  Passing  Failing  Pending  Skipped<br>  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐<br>  │ √  Login.cy.js                              00:12        3        3        -        -        - │<br>  ├────────────────────────────────────────────────────────────────────────────────────────────────┤ │<br>    √  All specs passed!                        00:12        3        3        -        -        -</pre><p>npx cypress openkomut çalıştırıldığında, testlerinizi çalıştırabileceğiniz ve çıktı olarak, testlerin başarılı veya başarısız olduğunu gösteren bir dashboard görüntülenecektir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xw9OTIuZ9ErZg7dBH7tXJA.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Faq-P3Z6N610&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Daq-P3Z6N610&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2Faq-P3Z6N610%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8f334e8ccd544879c7d0a8b6135c7ed/href">https://medium.com/media/d8f334e8ccd544879c7d0a8b6135c7ed/href</a></iframe><p>Cypress Cloud, satın almanız durumunda test otomasyonlarını uzak bir sunucuda dağıtılmasına, yönetilmesine ve sonuçlarının raporlanmasına olanak tanır. Kullanıcılar, çoklu tarayıcı ve cihaz desteği, test otomasyonlarının hızlı çalışması, test otomasyonlarının düzenli olarak tekrar çalışmasını ve ortak bir test otomasyonları çalışma alanı oluşturmasını sağlar.</p><p><strong>Cypress Cloud hakkında daha fazla bilgiye linkten ulaşabilirsiniz.</strong></p><p><a href="https://www.cypress.io/cloud/">Automate web testing in CI with Cypress Cloud | cypress.io testing tools</a></p><p><strong>Cypress hakkında daha fazla bilgiye aşağıdaki linkten ulaşabilirsiniz.</strong></p><p><a href="https://docs.cypress.io/">Cypress Documentation</a></p><p><strong>Sizler için hazırladığım demo projesine repo linkinden erişim sağlayabilirsiniz</strong></p><p><a href="https://github.com/can-seker/cypress-test-automation">GitHub - can-seker/cypress-test-automation: cypress-test-automation</a></p><p>Bir sonraki yazımızda görüşmek üzere.</p><p>Takipte kalın.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e47a8fef59ea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Selenide ile Test Otomasyonu]]></title>
            <link>https://medium.com/@can.seker/selenide-ile-test-otomasyonu-2be9adcc085b?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/2be9adcc085b</guid>
            <category><![CDATA[test]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[qa]]></category>
            <category><![CDATA[test-otomasyonu]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Mon, 23 Jan 2023 09:11:49 GMT</pubDate>
            <atom:updated>2023-02-04T15:39:02.806Z</atom:updated>
            <content:encoded><![CDATA[<p>Selenide, Java kullanarak web otomasyon testleri yazmak için kullanabileceğiniz bir tooldur. Selenium WebDriver kütüphanesini kullanarak web tarayıcıların otomasyonlarını oluşturmamıza olanak tanır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/689/1*1Du7Le3GXzjYr5zcTbOJMg.png" /></figure><ul><li>Selenide, testlerinizi yazarken daha az kod yazmanızı sağlar ve kodunuzu okunaklı ve anlaşılır hale getirir.</li><li>Selenide, web sayfalarının elementlerine erişmenizi, web sayfalarının içeriğini kontrol etmenizi ve browserlarınız da işlem yapmanıza olanak sağlar.</li><li>Selenide, hata ayıklama, raporlama ve diğer özellikleri için ekstra özellikler sunar.</li><li>Selenide, Page Object Model tasarım desenini kullanmanıza olanak tanır, böylece testlerinizi daha okunaklı ve anlaşılır hale getirebilirsiniz.</li><li>Selenide ile yazdığınız testleri TestNG kullanarak test başlamadan önce ve sonra yapılması gereken işlemleri organize edebilirsiniz. Aynı zaman da tagler ile methodlarınıza tag ataması sağlayabilirsiniz.</li></ul><p>Automation testlerini Java ve Selenide kullanarak yazmaya başlamak için aşağıdaki adımları izleyebilirsiniz:</p><p>Öncelikle Java ve JDK yüklü olması gereklidir. Aşağıdaki bulunan linkten kurulum gerçekleştirebilirsiniz.</p><pre>#Java &amp; JDK Install<br>Download: https://www.oracle.com/java/technologies/downloads/</pre><p>Testleri yazarken kullanışlı bir IDEA ihtyacımız var. Aşağıdaki bulunan linkten Intellij kurulumunu gerçekleştirebilirsiniz.</p><pre>#Intellij<br>Download: https://www.jetbrains.com/idea</pre><p>İhtiyacınız olacak kütüphaneleri Maven kullanarak projelerinize ekleyebilirsiniz.</p><pre>#Maven<br>https://mvnrepository.com/<br><br>&lt;dependencies&gt;<br># Selenium test otomasyonu için Chrome tarayıcısını kullanmak için gerekli olan bir bağımlılıktır.<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;org.seleniumhq.selenium&lt;/groupId&gt;<br>            &lt;artifactId&gt;selenium-chrome-driver&lt;/artifactId&gt;<br>            &lt;version&gt;4.7.2&lt;/version&gt;<br>        &lt;/dependency&gt;<br># Selenide test otomasyonu için testlerimizi otomatize etmek kullanmak için gerekli olan bir bağımlılıktır.<br>        &lt;dependency&gt;<br>            &lt;groupId&gt;com.codeborne&lt;/groupId&gt;<br>            &lt;artifactId&gt;selenide&lt;/artifactId&gt;<br>            &lt;version&gt;6.9.0&lt;/version&gt;<br>        &lt;/dependency&gt;<br># TestNg testlerimize annotation ekleyerek sıralama, tanımmlama vb. işlemler için gerekli olan bir bağımlılıktır.<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;6.14.3&lt;/version&gt;<br>        &lt;/dependency&gt;<br>    &lt;/dependencies&gt;</pre><p>Testlerimizi yazmak için Page Object Model oluşturuyoruz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*fSqxSqR4gTc3SFlX-UAVTw.jpeg" /></figure><p>BasePage.javadosyasına kullanmak istediğimiz kütüphaneleri import etmemiz gerekmektedir.</p><pre>//Selenide kütüphanesinin genel metotlarını projede kullanmak için gerekli olan bağımlılığı içerir.<br>import com.codeborne.selenide.*;<br>//TestNG framework&#39;ünü kullanmak için gerekli olan bağımlılığı içerir.<br>import org.testng.annotations.BeforeTest;</pre><p>@BeforeTest etiketini kullanarak Testlerimizden önce başlayacak method belirtiyoruz. Bu işlemde testlerimiz başlamadan önce koşmak istediğimiz tarayıcının ne olacağı, test koşulacak ortamın url biligisini ve testlerin tarayıcıda tam ekran da koşması gerekli configuration sağlıyoruz.</p><pre>@BeforeTest<br>    public void openBrowser() {<br>        // Testlerimizi koşmak istediğimiz Browser belirtmeliyiz.<br>        Configuration.browser = &quot;chrome&quot;;<br>        // Browser da Parabank ana sayfasını aç<br>        open(&quot;https://parabank.parasoft.com/&quot;);<br>        // Browser Tam ekran moduna al<br>        getWebDriver().manage().window().maximize();<br>    }</pre><p>LoginTests.javadosyasına login modülüne ait test senaryolarını yazmaktayız.</p><p>LoginPage.java class da bulunan test steplerinin Interface oluşturarak testlerimizin içerisinde çağırmaktayız. POM (Page Object Model) kullandığımız için oluşturduğumuz stepleri farklı testlerde de kullanabiliriz.</p><p>Stepler de maintenance gerektiren durumlarda kolaylıkla step değişikliği ile birden fazla test senaryosunun fix gerçekleştirmiş oluruz.</p><p>@Test etiketini kullanarak testlerimizi belirtmekteyiz.</p><pre>import Base.BasePage;<br>import Pages.LoginPage;<br>import org.testng.annotations.Test;<br>public class LoginTests extends BasePage{<br>    LoginPage loginPage = new LoginPage();<br>    @Test(description = &quot;Login Test - TC0002&quot;)<br>    public void TC0002() throws Exception{<br>//BaseLib class bulunan Users.txt file bulunan random bir user çağırmaktadır.<br>        String user = randomUser();<br>        loginPage<br>                .userName(user)<br>                .password(&quot;QWERT123&quot;)<br>                .login()<br>                .loginControl(&quot;Welcome User QA&quot;);<br>    }<br>    @Test(description = &quot;Login Test - TC0003&quot;)<br>    public void TC0003() throws Exception{<br>//BaseLib class bulunan Users.txt file bulunan random bir user çağırmaktadır.<br>        String user = randomUser();<br>        loginPage<br>                .userName(user)<br>                .password(&quot;123456789&quot;)<br>                .login()<br>                .loginErrorControl(&quot;An internal error has occurred and has been logged.&quot;);<br>    }<br>}</pre><p>LoginPage.javadosyasına login modülüne ait test steplerini yazmaktayız.</p><pre>package Pages;<br>import Base.BasePage;<br>import com.codeborne.selenide.*;<br>import org.openqa.selenium.By;<br>import static com.codeborne.selenide.Selenide.$;<br>public class LoginPage extends BasePage {<br>    SelenideElement userNameField = $(By.name(&quot;username&quot;));<br>    SelenideElement passwordField = $(By.name(&quot;password&quot;));<br>    SelenideElement loginButton = $(By.cssSelector(&quot;[class=&#39;login&#39;] input[type=&#39;submit&#39;]&quot;));<br>    SelenideElement loginControlField = $(By.cssSelector(&quot;[id=&#39;leftPanel&#39;] p&quot;));<br>    public LoginPage userName(String userName) {<br>        userNameField.setValue(userName);<br>        return this;<br>    }<br>    public LoginPage password(String password) {<br>        passwordField.setValue(password);<br>        return this;<br>    }<br>    public LoginPage login() {<br>        loginButton.click();<br>        return this;<br>    }<br>    public LoginPage loginControl(String user) {<br>        loginControlField.shouldHave(Condition.text(user));<br>        return this;<br>    }<br>}</pre><p>Selenide kütüphanesi içerisinde $() metodu aradığınız elementi bulur. Bu metodun içerisine arama yapmak istediğiniz elementi belirtmeniz gerekmektedir. Örnek olarak $(By.name(&quot;username&quot;)) kullanarak name &quot;username&quot; olan elementi arar.</p><ul><li>By.id(String id): Elementin &quot;id&quot; attribute&#39;unun verilen değerle eşleştiği elementi arar.</li><li>By.name(String name): Elementin &quot;name&quot; attribute&#39;unun verilen değerle eşleştiği elementi arar.</li><li>By.className(String className): Elementin &quot;class&quot; attribute&#39;unun verilen değerle eşleştiği elementi arar.</li><li>By.cssSelector(String css): Verilen CSS sorgusu ile eşleşen elementi arar.</li><li>By.xpath(String xpath): Verilen XPath sorgusu ile eşleşen elementi arar.</li><li>By.tagName(String tagName): Verilen tagName ile eşleşen elementi arar.</li><li>By.linkText(String linkText): Verilen link texti ile eşleşen elementi arar.</li><li>By.partialLinkText(String linkText): Verilen link textinin bir kısmı ile eşleşen elementi arar.</li></ul><pre>SelenideElement userNameField = $(By.name(&quot;username&quot;))</pre><p>Selenide kütüphanesi içerisinde birden fazla fonksiyon bulunmaktadır. Elemente yaptırmak istediğimiz işlemi bu fonksiyonlar ile gerçekleştirmektedir. Örnek olarak $(By.name(&quot;username&quot;)).setValue(&quot;TestQA&quot;) kullanarak name &quot;username&quot; olan elementi arar ve bu elementin içeriğine TestQA ibaresini yazmaktadır.</p><ul><li><strong>sendKeys(CharSequence... keysToSend)</strong>: Bir elemente text girişi yapmak için kullanılır. <strong>element.sendKeys(&quot;username&quot;)</strong> şeklinde kullanılır.</li><li><strong>click()</strong> : Bir elemente tıklama işlemi yapmak için kullanılır. <strong>element.click()</strong> şeklinde kullanılır.</li><li><strong>clear()</strong>: Bir elementin içeriğini temizlemek için kullanılır. <strong>element.clear()</strong> şeklinde kullanılır.</li><li><strong>setValue(String value)</strong>: Bir elemente değer atamak için kullanılır. <strong>element.setValue(&quot;text&quot;)</strong> şeklinde kullanılır.</li><li><strong>submit()</strong>: Bir formun gönderilmesi için kullanılır. <br><strong>element.submit()</strong> şeklinde kullanılır.</li><li><strong>getAttribute(String attributeName)</strong> : Bir elementin belirli bir attribute değerini almak için kullanılır. <br><strong>element.getAttribute(&quot;value&quot;)</strong> şeklinde kullanılır.</li><li><strong>getCssValue(String propertyName)</strong> : Bir elementin belirli bir CSS değerini almak için kullanılır. <br><strong>element.getCssValue(&quot;color&quot;)</strong> şeklinde kullanılır.</li></ul><pre>SelenideElement userNameField = $(By.name(&quot;username&quot;));<br><br>public LoginPage userName(String userName) {<br>        userNameField.setValue(userName);<br>        return this;<br>    }</pre><p>Selenide elementlerin beklentilerinin kontrol edilmesini sağlamak için birçok “should” metodları sağlar. “should” metodları, elementlerin belirli bir özellikte olmasını veya belirli bir işlemi gerçekleştirmesini bekler.</p><ul><li>shouldBe(Condition condition): Bir elementin belirli bir koşula uymasını beklenir.<br>$(By.id(&quot;username&quot;)).shouldBe(enabled) gibi bir kod ile &quot;username&quot; id&#39;sine sahip bir elementin etkin olması beklenir.</li><li>shouldBe(Condition condition, long timeoutMilliseconds) : Bir elementin belirli bir koşula uymasını veya belirli bir zaman içinde uymamasını beklenir. <br>$(By.id(&quot;username&quot;)).shouldBe(enabled, 5000) gibi bir kod ile &quot;username&quot; id&#39;sine sahip bir elementin 5 saniye içinde etkin olması beklenir.</li><li>shouldHave(Condition condition): Bir elementin belirli bir koşula uymasını bekler. <br>$(By.id(&quot;username&quot;)).shouldHave(value(&quot;TestQA&quot;)) gibi bir kod ile &quot;username&quot; id&#39;sine sahip bir elementin değerinin &quot;TestQA&quot; olması beklenir.</li></ul><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fvip02nE8Law%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dvip02nE8Law&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fvip02nE8Law%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/22e997cbf3b5c58b346f9ed95b363855/href">https://medium.com/media/22e997cbf3b5c58b346f9ed95b363855/href</a></iframe><p><strong>Selenide hakkında daha fazla bilgiye aşağıdaki linkten ulaşabilirsiniz.</strong></p><p><a href="https://selenide.org/documentation.html">Documentation</a></p><p><strong>Sizler için hazırladığım demo projesine repo linkinden erişim sağlayabilirsiniz.</strong></p><p><a href="https://github.com/can-seker/selenide-test-automation">GitHub - can-seker/selenide-test-automation: selenide-test-automation</a></p><p>Bir sonraki yazımızda görüşmek üzere.</p><p>Takipte kalın.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2be9adcc085b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Locust ile Yük Testi ve Türleri]]></title>
            <link>https://medium.com/@can.seker/locust-ile-y%C3%BCk-testi-ve-t%C3%BCrleri-69852eb70aab?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/69852eb70aab</guid>
            <category><![CDATA[loadtest]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[performance-test]]></category>
            <category><![CDATA[locust]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Thu, 12 Jan 2023 19:19:34 GMT</pubDate>
            <atom:updated>2023-01-23T07:06:36.030Z</atom:updated>
            <content:encoded><![CDATA[<p>Locust, Python programlama dilinde yazılmış bir web veya api istekleri gönderen yük testi aracıdır. Locust kullanarak, web uygulamalarının ve API’lerin nasıl performans gösterdiğini veya ne kadar iyi çalıştığını test edebilirsiniz. Locust, kullanıcı davranışlarını tanımlayan Python kodları kullanarak istekleri oluşturur ve sonuçları izler. Bu, gerçek kullanıcılardan daha fazla trafik oluşturmanıza ve web uygulamanızın ne kadar iyi performans gösterebileceğini ölçmenize olanak tanır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kqf1Wotk9VntfOrDJaVmBg.jpeg" /></figure><p>Yük testlerini Python ve Locust kullanarak yazmaya başlamak için aşağıdaki adımları izleyebilirsiniz:</p><p>Öncelikle Python ve pip yüklü olması gerekir. Aşağıdaki bulunan linke ve komut ile kurulum gerçekleştirebilirsiniz.</p><pre>#Python Install<br>Download: https://www.python.org/downloads<br><br>#Locust Install:<br>pip install locust</pre><p>Daha sonra, testlerinizi yazmak için bir dosya oluşturun. Örneğin, userTests.py olarak adlandırabilirsiniz.</p><p>Dosyanızın başına HttpUserkodu ekleyin, böylece Locust ve beklenen değerleri HttpUser ile ullanabileceksiniz:<br>HttpUser, Locust tarafından sağlanan bir sınıftır. Geliştiriciler için bir web uygulaması veya API için bir kullanıcı senaryosunu tanımlamak için kullanılır.</p><pre>from locust import HttpUser, between</pre><p>Testlerinizde, Locust get(), post(), put(), patch() veya delete() gibi istek yapma metodlarını kullanarak API istekleri yapmaktadır.<br>wait_time özelliği, task arasındaki bekleme süresini ifade eder (1-2 saniye arasında)</p><pre>from locust import HttpUser, task, between<br><br>class UserApi(HttpUser):<br>    wait_time = between(1, 2)<br><br>    @task<br>    def get_user(self):<br>        self.client.get(&quot;/v2/user/&quot;)<br>        <br>    @task<br>    def post_user(self):<br>        self.client.post(&quot;/v2/user&quot;, json={&quot;name&quot;: &quot;userqa&quot;, &quot;email&quot;: &quot;userqa@userqa.com&quot;})</pre><p>Locust da, HTTP istekleri oluştururken request body, header ve query string (qs) gibi öğeleri göndermenize olanak sağlar. <br>Aşağıdaki kod örneğinde gösterildiği gibi, request body ve header’ları POST isteği oluştururken gönderebilirsiniz:</p><pre>from locust import HttpUser, task, between<br><br>class UserApi(HttpUser):<br>    wait_time = between(1, 2)<br><br>#Header<br>    @task<br>    def get_user_info(self):<br>        headers = {&quot;userId&quot;: &quot;12345678911&quot;}<br>        self.client.get(&quot;/users/&quot;, headers=headers)<br><br>#Body<br>    @task<br>    def post_user(self):<br>        self.client.post(&quot;/v2/user&quot;, json={&quot;name&quot;: &quot;userqa&quot;, &quot;email&quot;: &quot;userqa@userqa.com&quot;})<br><br>#Params<br> @task<br>    def get_user(self):<br>        params = {&quot;id&quot;: 1, &quot;name&quot;: &quot;userqa&quot;}<br>        self.client.get(&quot;/user&quot;, params=params)</pre><p>Test senaryolarımızı oluşturduktan sonra, aşağıdaki locust komutunu terminal ekranınız da kullanarak locust -f userTests.pytestleri çalıştırabilirsiniz:</p><pre>Starting web interface at http://localhost:8089 (accepting connections from all network interfaces)<br>Starting Locust 2.14.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*juQkBGEUQjXBJm0-Cs6zYQ.png" /></figure><p><strong><em>Spawn Rate</em></strong><em>, yük testlerinde, sisteme zaman içerisinde eklenen kullanıcı sayısını ifade eder.</em></p><p><strong><em>Number of users</em></strong><em>, Locust da yapılan yük testlerinde, aynı anda sisteme bağlı olan ve test yapılan kullanıcı sayısını ifade eder.</em></p><p><strong><em>Host</em></strong><em>, testin yapılacağı web uygulamasının veya API’nin adresini ifade eder.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*Fpz1kerb57KGsjskeZrbAg.png" /></figure><p>Testleriniz çalıştırıldıktan sonra dashboard da metriclerin takibi sağlanabilinmektedir.<br>Charts ve Download Data kısımlarından testlerin tamamlanması sonrasında excel, csv gibi çıktılar alınabilinmektedir.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F9KQFwR2CLes%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D9KQFwR2CLes&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F9KQFwR2CLes%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/942ae80b2b4b3a623c8fa51eb36c754b/href">https://medium.com/media/942ae80b2b4b3a623c8fa51eb36c754b/href</a></iframe><p><strong>Locust hakkında daha fazla bilgiye aşağıdaki linkten ulaşabilirsiniz.</strong></p><p><a href="https://docs.locust.io/en/stable/">Locust Documentation - Locust 2.14.2 documentation</a></p><p><strong>Sizler için hazırladığım demo projesine repo linkinden erişim sağlayabilirsiniz</strong></p><p><a href="https://github.com/can-seker/locust-load-testing">GitHub - can-seker/locust-load-testing: locust-load-testing</a></p><h4>Yük Testi türleri nelerdir?</h4><p>Yük testi, bir sistemin veya uygulamanın belirli bir yük altında nasıl performans gösterdiğini test etmek için kullanılan bir metottur. Yük testi türleri arasında en yaygın olanlar şunlardır:</p><blockquote><strong>Load Testing</strong>: <br>Load Testi, bir sistemin belirli beklenen bir yük altında ne kadar dayanabildiğini veya ne kadar süre boyunca çalışabildiğini test etmek için kullanılan bir test türüdür. Yapılan test de hedeflenen darboğazların testpit edilmesidir.</blockquote><blockquote><strong>Stress Testing</strong>: <br>Stress testi, bir sistemin belirli bir yük altında ne kadar dayanabildiğini veya ne kadar süre boyunca çalışabildiğini test etmek için kullanılan bir test türüdür. Bu testler, sistemin veya uygulamanın normal kullanım koşullarının üstünde bir yük altında nasıl performans gösterdiğini ölçer. Bu testler, sistemin veya uygulamanın ne zaman çökeceği veya ne zaman hata vermeye başlayacağı gibi kritik bilgileri sağlar.</blockquote><blockquote><strong>Spike Testing</strong>: <br>Spike testi, bir sistemin ani veya beklenmedik yük değişikliklerine nasıl cevap verdiğini test etmek için kullanılan bir yük testidir. Bu testler, sistemin veya uygulamanın normal kullanım koşullarının dışında ani bir yük artışına nasıl cevap verdiğini ölçer.</blockquote><blockquote><strong>Endurance Testing: <br></strong>Yük testlerinde endurance test, bir sistemin belirli bir yük altında, belirli bir süre boyunca çalışmaya devam edebilecek kapasitesini ölçmek için kullanılan bir test türüdür. Bu testler, sistemlerin veya cihazların uzun vadeli dayanıklılığını ve güvenilirliğini değerlendirmek için kullanılır. Örneğin, bir web sunucusunun endurance testi, yüksek trafik altında uzun süre boyunca çalışmasını sağlamak için yapılır.</blockquote><blockquote><strong>Volume Testing: <br></strong>Volume testing, bir sistemin belirli bir veri hacmi altında, belirli bir süre boyunca çalışmaya devam edebilecek kapasitesini ölçmek için kullanılan bir test türüdür. Bu testler, sistemlerin veri hacmi büyüdükçe performansının nasıl etkileneceğini ve veri hacmi ne kadar büyüdükçe sistemlerin nasıl tepki vereceğini incelemek için kullanılır. Bir veritabanı sunucusunun volume testingi, veritabanının belirli bir veri hacmi altında nasıl çalıştığını ve veri hacmi arttıkça performansın nasıl etkilendiğini incelemek için yapılır.</blockquote><blockquote><strong>Scalability Testing: <br></strong>Scalability testing, bir sistemin belirli bir yük arttıkça, performansının nasıl etkileneceğini ve sistemin ne kadar yük artırılabilir olduğunu ölçmek için kullanılan bir test türüdür. Bu testler, sistemlerin yük arttıkça nasıl tepki vereceğini ve sistemin yük arttıkça ne kadar büyüyebileceğini incelemek için kullanılır. Kullanıcı sayısı arttıkça sistem davranışı nasıl ve scale edilebiliyor mu gibi.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/936/1*-4_j_0uLOqHOZEjI4erDvg.png" /></figure><p>Bir sonraki yazımızda görüşmek üzere.</p><p>Takipte kalın.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=69852eb70aab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[JavaScript ile Chakram Kullanarak REST API Testleri: Püf Noktaları]]></title>
            <link>https://medium.com/@can.seker/javascript-ile-chakram-kullanarak-rest-api-testleri-p%C3%BCf-noktalar%C4%B1-f4b0f3a00393?source=rss-9d4236e5af45------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4b0f3a00393</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[chakram]]></category>
            <category><![CDATA[api-test-automation]]></category>
            <category><![CDATA[api-testing]]></category>
            <dc:creator><![CDATA[Can Seker]]></dc:creator>
            <pubDate>Sat, 07 Jan 2023 12:26:51 GMT</pubDate>
            <atom:updated>2023-01-07T12:37:18.942Z</atom:updated>
            <content:encoded><![CDATA[<p>API testlerini Node.js ve Chakram kullanarak yazmaya başlamak için aşağıdaki adımları izleyebilirsiniz:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hRCR2q2OF7cPjIi1ZZbHPg.jpeg" /></figure><p>Öncelikle, Node.js ve Chakram’ın aşağıdaki komutları kullanarak kurulumu gerçekleştirebilirsiniz:</p><pre># Node.js<br>curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -<br>sudo apt-get install -y nodejs<br><br># Chakram<br>npm install -g chakram</pre><p>Daha sonra, testlerinizi yazmak için bir dosya oluşturun. Örneğin, userTests.js olarak adlandırabilirsiniz.</p><p>Dosyanızın başına aşağıdaki kodu ekleyin, böylece Chakram ve beklenen değerleri (expectations) kullanabileceksiniz:</p><pre>const chakram = require(&#39;chakram&#39;),<br>    expect = chakram.expect;</pre><p>describe() ve it() fonksiyonlarını kullanarak testlerinizi yazın. describe() fonksiyonu, bir grup testin bir arada olduğu bir bloğu temsil eder ve it() fonksiyonları ise bu bloktaki tek tek testleri temsil eder.</p><pre>describe(&quot;TC0001 /v2/user&quot;, function() {<br> it(&quot;TC&quot;, function () {<br> // Test kodlarınız<br> });<br>it(&quot;TC0002 /v2/user/{userName}&quot;, function () {<br> // Test kodlarınız<br> });<br>});</pre><p>Testlerinizde, Chakram’ın get(), post(), put(), patch() veya delete() gibi istek yapma metodlarını kullanarak API çağrıları yapın.</p><pre>  const response = chakram.get(&quot;https://petstore.swagger.io/v2/user/&quot;);</pre><p>İsteklerinizin yanıtlarını, expect() fonksiyonunu kullanarak kontrol edin. Örneğin, cevabın durum kodunun 200 (OK) olduğunu bekleyebilirsiniz:</p><pre>expect(response).to.have.status(200);</pre><p>Chakram, HTTP istekleri oluştururken request body, header ve query string (qs) gibi öğeleri göndermenize olanak sağlar. <br>Aşağıdaki kod örneğinde gösterildiği gibi, request body ve header’ları POST isteği oluştururken gönderebilirsiniz:</p><pre>const chakram = require(&#39;chakram&#39;);<br><br>const requestBody = {<br>    username: &quot;userqa&quot;,<br>    password: &quot;QWERTY123&quot;<br>};<br><br>const headers = {<br>    &quot;Content-Type&quot;: &quot;application/json&quot;<br>};<br><br>const response = chakram.post(&quot;https://petstore.swagger.io&quot;, requestBody, {headers});</pre><p>Query string değerlerini de aynı şekilde istek oluştururken gönderebilirsiniz.</p><pre>const chakram = require(&#39;chakram&#39;);<br><br>const queryParams = {<br>    userName: &quot;userqa&quot;<br>};<br><br>const response = chakram.get(&quot;https://petstore.swagger.io&quot;, {qs: queryParams});</pre><p>Dökümanınızı oluşturduktan sonra, aşağıdaki komutu kullanarak userTests.js dosyasını çalıştırabilirsiniz:</p><pre>npm test</pre><p>Bu komut çalıştırıldığında, testleriniz çalıştırılacak ve çıktı olarak, testlerin başarılı veya başarısız olduğunu gösteren bir rapor görüntülenecektir.</p><p>Eğer testleriniz başarılı olursa, aşağıdaki gibi bir çıktı görebilirsiniz:</p><pre>User Tests<br>    √ TC0001 /v2/user (1468ms)<br>    √ TC0002 /v2/user/{userName} (522ms)<br><br>  2 passing (2s)</pre><p>Eğer testlerinizden bazıları başarısız olursa, aşağıdaki gibi bir çıktı görebilirsiniz:</p><pre>User Tests<br>    √ TC0001 /v2/user (879ms)<br>    1) TC0002 /v2/user/{userName}<br><br><br>  1 passing (1s)<br>  1 failing<br><br>  1) User Tests<br>       TC0002 /v2/user/{userName}:<br>     AssertionError: expected status code 404 to equal 200</pre><p>Bu çıktı, testlerin başarılı veya başarısız olduğunu gösterir ve başarısız olan testlerin hata mesajlarını gösterir.</p><p><strong>Chakram hakkında daha fazla bilgiye aşağıdaki linkten ulaşabilirsiniz.</strong></p><p><a href="http://dareid.github.io/chakram/jsdoc/index.html">Chakram</a></p><p><strong>Sizler için hazırladığım demo projesine repo linkinden erişim sağlayabilirsiniz</strong></p><p><a href="https://github.com/can-seker/chakram-api-testing">GitHub - can-seker/chakram-api-testing: chakram-api-testing</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*zAdfPvZfmH5qTKh6PR__PQ.png" /></figure><p>Bir sonraki yazımızda görüşmek üzere.</p><p>Takipte kalın.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4b0f3a00393" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>