<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: humlix</title>
    <description>The latest articles on DEV Community by humlix (@humlix).</description>
    <link>https://dev.to/humlix</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F415119%2F10069ce9-182b-42a3-a5b1-dd1b8859c2dc.png</url>
      <title>DEV Community: humlix</title>
      <link>https://dev.to/humlix</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/humlix"/>
    <language>en</language>
    <item>
      <title>Testing REST APIs</title>
      <dc:creator>humlix</dc:creator>
      <pubDate>Thu, 14 Jan 2021 09:22:00 +0000</pubDate>
      <link>https://dev.to/humlix/testing-rest-apis-5emb</link>
      <guid>https://dev.to/humlix/testing-rest-apis-5emb</guid>
      <description>&lt;p&gt;For many companies, it is crucial to build and maintain APIs for the Web. Building robust APIs that will be maintained and improved over time comes with a lot of challenges. This article will go through things to remember when testing REST APIs and show you what makes Humlix different from other testing tools available. For a more basic introduction to creating a REST API, you can check out the article &lt;a href="https://blog.humlix.com/create-and-test-restful-apis/"&gt;Create and test RESTful APIs&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you haven’t heard about &lt;a href="https://www.humlix.com"&gt;Humlix&lt;/a&gt; before, it is a tool to help out when building and testing RESTful APIs. It can automatically generate tests to discover errors in API endpoints.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  REST
&lt;/h2&gt;

&lt;p&gt;REST (Representational State Transfer) is a software architecture style relying on stateless communication, often using the HTTP protocol. REST APIs (also referred to as RESTful APIs) make it possible for systems implemented with different technologies to collaborate and understand each other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Specifying a contract
&lt;/h2&gt;

&lt;p&gt;Using, e.g., &lt;a href="https://swagger.io/specification/"&gt;OpenAPI&lt;/a&gt;, it is possible to specify the API before writing code and let teams develop in parallel by implementing code according to the contract. It also makes it easier for tools to understand how the API works and allows them to display the API documentation or generate code based on the specification.&lt;/p&gt;

&lt;p&gt;An OpenAPI specification states, e.g., HTTP status code, payload, headers, and makes it possible to use tools like Humlix to understand the API and use that as a base for generating tests.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ways of testing
&lt;/h2&gt;

&lt;p&gt;Different ways of testing a REST API is to cover:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Contract testing or schema validation

&lt;ul&gt;
&lt;li&gt;Use tooling to verify that the API corresponds with a given OpenAPI specification.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Basic positive testing

&lt;ul&gt;
&lt;li&gt;E.g., use code or tooling to test happy paths&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Testing with valid and invalid input

&lt;ul&gt;
&lt;li&gt;Verify that the API handles valid and invalid input both for query and path parameters and for the payload correctly&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Traditionally REST APIs are often tested using positive tests. Developers write tests for the API's happy paths and possibly extending it with some edge cases that they think of quickly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tooling
&lt;/h2&gt;

&lt;p&gt;Today's tooling for testing REST APIs often lets the user create test cases by manually writing some test code, e.g., using Javascript or doing calls given example data. Using tooling like that makes it easy to reach a basic level of testing quickly.&lt;/p&gt;

&lt;p&gt;Humlix test data generation logic makes it possible to discover edge cases that would be hard to think of for a developer writing all the tests manually. Make sure to look at this &lt;a href="https://blog.humlix.com/how-to-create-1040-tests-targeting-gitlab-in-5-minutes-with-humlix/"&gt;article&lt;/a&gt; describing how Humlix was used to discover bugs in GitLab CE. Humlix unique way of understanding an OpenAPI specification combined with &lt;a href="https://en.wikipedia.org/wiki/Property_testing"&gt;Property-based testing&lt;/a&gt; makes it easy to find otherwise hard to find bugs.&lt;/p&gt;

&lt;h2&gt;
  
  
  Developer experience (DX)
&lt;/h2&gt;

&lt;p&gt;Remember to walk through the experience for developers that will use the API. How is the API documented? Is it easy to figure out how to use the API? Provide code examples showing how to authenticate and start using the API.&lt;/p&gt;

&lt;p&gt;DX is, generally speaking, how developers feel while using an API. With good DX, developers have a better chance of making quality products than using an API with horrible DX. If your API is public, DX will be one selling point compared to your competitors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Thank you for reading
&lt;/h2&gt;

&lt;p&gt;Visit &lt;a href="https://www.humlix.com"&gt;Humlix&lt;/a&gt; to learn more about how you can generate tests for your Web APIs to improve your products' quality.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Testing of a RESTful API</title>
      <dc:creator>humlix</dc:creator>
      <pubDate>Fri, 09 Oct 2020 07:59:57 +0000</pubDate>
      <link>https://dev.to/humlix/testing-of-a-restful-api-12ac</link>
      <guid>https://dev.to/humlix/testing-of-a-restful-api-12ac</guid>
      <description>&lt;p&gt;This is a follow-up to the article RESTful API quick tutorial that went trough basic REST-topics.&lt;/p&gt;

&lt;p&gt;There is a lot of tutorials online that describe how to manually set up tests for your API. With Humlix, you can either import, e.g., an OpenAPI specification or use the request builder to set up your API. Humlix will then automatically generate and execute tests for you.&lt;/p&gt;

&lt;p&gt;We will use Humlix to test the GitLab Groups API. We will use a Docker-container from Gitlab: gitlab/gitlab-ce:13.1.0-ce.0.&lt;/p&gt;

&lt;h1&gt;
  
  
  Set up the API within Humlix
&lt;/h1&gt;

&lt;p&gt;You need to download Humlix. Remember to sign up for the Humlix mailing list to stay up to date with the latest news. You can follow the Humlix getting started guide if you don't know how to run it.&lt;/p&gt;

&lt;p&gt;Select the HOME menu and click on ADD SUITE and create a test suite called &lt;em&gt;GitLab Suite&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xheiZ3__--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-suite.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xheiZ3__--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-suite.png" alt="GitLab Suite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press the Add request link and create a new test request called Get a group list by page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ngEHfhSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-request.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ngEHfhSR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-request.png" alt="GitLab test request"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the &lt;em&gt;ENVIRONMENT VARIABLES&lt;/em&gt; tab and change the environment name to GitLab Environment. Add two variables base_url and gitlab_token. Set the values according to your setup. Make sure to use your token for GitLab.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3hMqzeZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-environment.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3hMqzeZu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-environment.png" alt="GitLab Environment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the &lt;em&gt;REQUEST tab&lt;/em&gt; so that you can see the Humlix test request builder. Select &lt;em&gt;GET&lt;/em&gt; verb and &lt;em&gt;Http&lt;/em&gt; protocol and add base_url/api/v4/groups. Add a new query parameter page of type integer according to the picture below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--abyj2HWZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-request-builder.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--abyj2HWZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/gitlab-request-builder.png" alt="Request builder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can run a test with the example data you entered by pressing the Run single test button. This will verify that you can connect to the GitLab service trough the API endpoint that you built.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iJoBVB3k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/single-test-button.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iJoBVB3k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/single-test-button.png" alt="Single test button"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If everything works as expected, you should receive something like this in the log area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WuIYCehA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/one-off-run.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WuIYCehA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/one-off-run.png" alt="Log view"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result above shows that our setup works and that your Gitlab API token is correct.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclaimer: The next step will generate many requests targeting the selected environment. Make sure that it is a test- or dev-environment that you can easily re-create if needed. Don't run this against a production environment.&lt;br&gt;
Press the Generate tests button to see some real magic. This will trigger Humlix test generation, and during that time, you will see a progress indicator at the top of the user interface. When it is done, you should be able to see something similar to the image below.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uGSR3Z1y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/1048-errors-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uGSR3Z1y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/1048-errors-1.png" alt="Test result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Experiment with the test request settings, if you don't get the same result. E.g., you can change the Max number of generated test calls to 1000 and rerun the test generation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yJrOEBby--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/settings.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yJrOEBby--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/2020/10/settings.png" alt="Test settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Looking for the cause
&lt;/h1&gt;

&lt;p&gt;We can see the cause of the problem by going into the production.log file for GitLab and see that during the execution of some SQL statement, the error was:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2020-10-02_19:43:52.85686 ERROR:  bigint out of range&lt;br&gt;
2020-10-02_19:43:52.85689 STATEMENT:  SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' ORDER BY "namespaces"."name" ASC, "namespaces"."id" ASC LIMIT 20 OFFSET 9223372036854775820&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We have found a bug in the production code!&lt;br&gt;
We can also verify the bug using this cURL command:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;curl -I localhost/api/v4/groups?page=461168601842738792 &lt;br&gt;
HTTP/1.1 500 Internal Server Error&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h1&gt;
  
  
  Wrap up
&lt;/h1&gt;

&lt;p&gt;Now you have seen how easy it is to let Humlix create tests for you. Download and try it out if you haven't already! Make sure to subscribe to our newsletter, so you don't miss coming articles and updates around testing Web APIs.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>codequality</category>
    </item>
    <item>
      <title>Create and test RESTful APIs</title>
      <dc:creator>humlix</dc:creator>
      <pubDate>Mon, 05 Oct 2020 18:52:48 +0000</pubDate>
      <link>https://dev.to/humlix/create-and-test-restful-apis-4ii</link>
      <guid>https://dev.to/humlix/create-and-test-restful-apis-4ii</guid>
      <description>&lt;p&gt;Using &lt;a href="https://www.humlix.com"&gt;Humlix&lt;/a&gt; for test generation&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NwhXyYB8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1532622785990-d2c36a76f5a6%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2400%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NwhXyYB8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://images.unsplash.com/photo-1532622785990-d2c36a76f5a6%3Fixlib%3Drb-1.2.1%26q%3D80%26fm%3Djpg%26crop%3Dentropy%26cs%3Dtinysrgb%26w%3D2400%26fit%3Dmax%26ixid%3DeyJhcHBfaWQiOjExNzczfQ" alt="White board"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Welcome to the first article in a series on how to develop and test RESTful APIs. In this series, we will utilize Humlix when trying out different REST endpoints.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you haven’t heard about &lt;a href="https://www.humlix.com"&gt;Humlix&lt;/a&gt; before, it is a tool to help out when building and testing RESTful APIs. It can automatically generate tests to discover errors in API endpoints.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The series contains the following articles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;RESTful API quick tutorial (in this article)&lt;/li&gt;
&lt;li&gt;Testing of a RESTful API (coming soon)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For many companies, it is crucial to build and maintain APIs for the Web. Building robust APIs that will be maintained and improved over time comes with a lot of challenges. In this guide, we will go from the basics of creating a RESTful API and continue by showing how to test it using Humlix to generate tests for us.&lt;/p&gt;

&lt;h1&gt;
  
  
  RESTful API quick tutorial
&lt;/h1&gt;

&lt;p&gt;REST APIs are implemented daily by developers all over the world to enable communication between systems. They make it possible for systems implemented with different technologies to collaborate and understand each other.&lt;/p&gt;

&lt;p&gt;We will go through some of the principles when building an API for the Web:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using the request methods (GET, POST, etc.) correctly&lt;/li&gt;
&lt;li&gt;Naming API endpoints&lt;/li&gt;
&lt;li&gt;Using parameters for filtering&lt;/li&gt;
&lt;li&gt;Using correct HTTP response codes&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Use HTTP request methods correctly
&lt;/h1&gt;

&lt;p&gt;HTTP defines request methods used to show the action to perform on a resource. HTTP verbs are another common way to refer to these request methods. Some of the most commonly used verbs are:&lt;/p&gt;

&lt;p&gt;GET — Get one or more resources&lt;br&gt;
POST — Create one or more resources&lt;br&gt;
PUT — Update one or more resources&lt;br&gt;
DELETE — Delete one or more resources&lt;/p&gt;

&lt;h1&gt;
  
  
  Naming API endpoints
&lt;/h1&gt;

&lt;p&gt;When developing software, methods are often named using verbs to describe their intent, e.g., GetPerson or SetLimit. Because we have HTTP verbs used to indicate the action, we can name our endpoints using nouns instead, i.e., /persons instead of /getPersons.&lt;/p&gt;

&lt;p&gt;Let’s look at a real-life example from GitLab and their Groups API. That API provides a GET /groups endpoint to get a list of groups for the logged-on user. They didn’t call it /getGroups because they used the GET HTTP verb to state the intention.&lt;/p&gt;

&lt;p&gt;GET /api/v4/groups&lt;/p&gt;

&lt;h1&gt;
  
  
  Use parameters for filtering
&lt;/h1&gt;

&lt;p&gt;RESTful APIs can provide means to sort or filter responses on the server-side so that clients don’t have to massage the response data. The technique for this is to use query parameters.&lt;/p&gt;

&lt;p&gt;Let’s go back to the GitLab example above where the GET /groups endpoint can handle sorting if clients add a query string ?sort=asc.&lt;/p&gt;

&lt;p&gt;GET /api/v4/groups?sort=asc&lt;/p&gt;

&lt;p&gt;The image below shows how to use Humlix to make test requests to the GET /groups endpoint.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--U2a6c26O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/1%2ANVLdIEPZ_QyJE3az5RIFDQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U2a6c26O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://cdn-images-1.medium.com/max/2400/1%2ANVLdIEPZ_QyJE3az5RIFDQ.png" alt="Test request built with Humlix"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Use correct HTTP response status codes
&lt;/h1&gt;

&lt;p&gt;HTTP response status codes are a way for an endpoint to inform the client of the request’s status. Was the call a success, or did it fail?&lt;/p&gt;

&lt;p&gt;There are five categories of status codes, where the first digit defines the class of the response.&lt;/p&gt;

&lt;p&gt;1XX — used for information, e.g., backend received a request&lt;br&gt;
2XX — successfully handled request&lt;br&gt;
3XX — redirection occurred&lt;br&gt;
4xx — client request cannot be fulfilled, e.g., due to the wrong syntax&lt;br&gt;
5xx — server failed to fulfill a valid request&lt;/p&gt;

&lt;p&gt;Be sure to utilize more than just 200 OK responses for your API. &lt;a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes"&gt;Check this list of HTTP response status codes&lt;/a&gt;.&lt;/p&gt;

&lt;h1&gt;
  
  
  Thank you for reading
&lt;/h1&gt;

&lt;p&gt;We will soon publish the follow-up article, Testing of a RESTful API, to show you how to generate RESTful APIs tests.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>codequality</category>
    </item>
    <item>
      <title>How to create 1040 tests targeting Gitlab in 5 minutes with Humlix</title>
      <dc:creator>humlix</dc:creator>
      <pubDate>Sun, 04 Oct 2020 13:10:21 +0000</pubDate>
      <link>https://dev.to/humlix/how-to-create-1040-tests-targeting-gitlab-in-5-minutes-with-humlix-2hg1</link>
      <guid>https://dev.to/humlix/how-to-create-1040-tests-targeting-gitlab-in-5-minutes-with-humlix-2hg1</guid>
      <description>&lt;p&gt;&lt;a href="https://www.humlix.se"&gt;Humlix&lt;/a&gt; is a brand new web API request builder and quality assurance tool that automatically generates tests. All you need to do is provide examples of how to call your API methods, and Humlix will use it to start doing its magic.&lt;/p&gt;

&lt;p&gt;To put Humlix to a real test, we decided to try it on a real industry giant, and GitLab seemed to be a suitable candidate because of its size and that we can run it locally. Therefore, in this post, we will let Humlix create tests targeting GitLab Community Edition (gitlab-ce) and specifically its GitLab Groups API. We will use &lt;em&gt;gitlab/gitlab-ce:11.2.0-ce.0&lt;/em&gt; docker image and later try to repeat the same scenario on the currently latest version &lt;em&gt;gitlab/gitlab-ce:13.1.0-ce.0&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Let’s start with the end
&lt;/h1&gt;

&lt;p&gt;By showing Humlix how to call the &lt;em&gt;/api/v4/groups&lt;/em&gt; &lt;em&gt;Gitlab Group&lt;/em&gt; API method, we were able to discover a bug that would have been hard to detect using regular unit tests. You can see that Humlix generated 1040 tests towards &lt;em&gt;gitlab-ce&lt;/em&gt; in the screenshot below and that calling:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;/api/v4/groups?page=461168601842738792&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;resulted in a status &lt;strong&gt;500 Internal Server Error&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8Jtoq9lx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/screenshot.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Jtoq9lx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/screenshot.png" alt="Humlix test result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can see the cause of the problem by going into the production.log file for GitLab and see that during the execution of some SQL statement the error was:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;2020-10-02_19:43:52.85686 ERROR:  bigint out of range&lt;br&gt;
2020-10-02_19:43:52.85689 STATEMENT:  SELECT "namespaces".* FROM "namespaces" WHERE "namespaces"."type" = 'Group' ORDER BY "namespaces"."name" ASC, "namespaces"."id" ASC LIMIT 20 OFFSET 9223372036854775820&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5pMUfVoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/production-log.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5pMUfVoH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/production-log.png" alt="GitLab production log"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So in just a couple of minutes, we were able to detect bugs in production code.&lt;/p&gt;

&lt;p&gt;A user has already reported this issue in the GitLab issue tracker system. To check if GitLab has fixed the bug, we can repeat the same scenario on the currently latest version &lt;em&gt;gitlab/gitlab-ce:13.1.0-ce.0&lt;/em&gt;. Humlix once again located the same problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--1TU7EexM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/1073-errors-repeat.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1TU7EexM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/1073-errors-repeat.png" alt="Repeated issue"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also verify it using this cURL command:&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;curl -I localhost/api/v4/groups?page=461168601842738792&lt;br&gt;
HTTP/1.1 500 Internal Server Error&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;As you can see, this problem has existed for a long time, even between different versions, but Humlix was able to find the bug within minutes.&lt;/p&gt;

&lt;h1&gt;
  
  
  How to generate tests with Humlix
&lt;/h1&gt;

&lt;p&gt;You need to &lt;a href="https://www.humlix.com"&gt;download Humlix&lt;/a&gt;. Remember to &lt;a href="https://www.humlix.com"&gt;sign up for the Humlix mailing list&lt;/a&gt; to stay up to date with the latest news. You can follow the Humlix getting started guide if you don’t know how to run it.&lt;/p&gt;

&lt;p&gt;Select the &lt;em&gt;HOME&lt;/em&gt; menu and click on &lt;em&gt;ADD SUITE&lt;/em&gt; and create a test suite called &lt;em&gt;GitLab Suite&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ypXwnTb7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-suite.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ypXwnTb7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-suite.png" alt="Add suite"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Press the &lt;em&gt;Add request&lt;/em&gt; link and create a new test request called &lt;em&gt;Get a group list by page&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--c8i3Ggr_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-request.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--c8i3Ggr_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-request.png" alt="Add request"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the &lt;em&gt;ENVIRONMENT VARIABLES&lt;/em&gt; tab and change the environment name to &lt;em&gt;GitLab Environment&lt;/em&gt;. Add two variables &lt;em&gt;base_url&lt;/em&gt; and &lt;em&gt;gitlab_token&lt;/em&gt;. Set the values according to your setup.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0liNpq3h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-environment.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0liNpq3h--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-environment.png" alt="Environment variables"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to the &lt;em&gt;REQUEST&lt;/em&gt; tab so that you can see the Humlix test request builder. Select &lt;em&gt;GET&lt;/em&gt; verb and &lt;em&gt;Http&lt;/em&gt; protocol and add &lt;em&gt;base_url/api/v4/groups&lt;/em&gt;. Add a new query parameter page of type &lt;em&gt;integer&lt;/em&gt; according to the picture below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iGygGRGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-request-builder.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iGygGRGE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/gitlab-request-builder.png" alt="Request builder"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we are ready to perform some tests. To verify that your setup is working, you can run a test with precisely the data you entered in the request builder by pressing the &lt;em&gt;Run single test&lt;/em&gt; button.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S9qoyoYc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/single-test-button.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S9qoyoYc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/single-test-button.png" alt="Run single test"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If everything works as expected, you should receive something like this in the log area.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xhSG85NY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/one-off-run.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xhSG85NY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/one-off-run.png" alt="Test result"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result above shows that our setup works and that your Gitlab API token is correct.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Disclaimer: Don’t perform the next step unless you are sure you are targeting a test environment running GitLab that you can re-create without losing anything important. Humlix will generate many requests and could cause a heavy load on production servers.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now you can press the &lt;em&gt;Generate tests&lt;/em&gt; button to see some real magic.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9THYmkZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/1048-errors-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9THYmkZ4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/1048-errors-1.png" alt="Generate tests"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you don’t get the same result, you can experiment with the test request settings. E.g., you can change the Max number of generated test calls to 1000 and rerun the test generation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SZ7qYlxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/settings.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SZ7qYlxc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.humlix.com/content/images/size/w2400/2020/10/settings.png" alt="Test settings"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now you have seen what Humlix is capable of in just a few minutes and how easy it is to let Humlix create tests for you. &lt;a href="https://www.humlix.com"&gt;Download&lt;/a&gt; and try it out if you haven’t already!&lt;/p&gt;

</description>
      <category>testing</category>
      <category>startup</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
