<?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 Joonas Venäläinen on Medium]]></title>
        <description><![CDATA[Stories by Joonas Venäläinen on Medium]]></description>
        <link>https://medium.com/@joonasvenlinen?source=rss-e9d98f989762------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*rW-W_I1sPyUKCvdy</url>
            <title>Stories by Joonas Venäläinen on Medium</title>
            <link>https://medium.com/@joonasvenlinen?source=rss-e9d98f989762------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:42:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@joonasvenlinen/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[Use Renovate to Manage Dependencies in Gitlab]]></title>
            <link>https://faun.pub/use-renovate-to-manage-dependencies-in-gitlab-37fab2b7e847?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/37fab2b7e847</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[dependency-management]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Tue, 18 Jan 2022 17:16:52 GMT</pubDate>
            <atom:updated>2022-01-18T18:52:14.378Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*QmKCp_Iq-O4bMcPlMk_7rg.png" /></figure><p>If you don’t have the Gitlab Ultimate subscription then you are missing the Dependency scanning features that comes with it. Github has Dependabot and it also works with Gitlab in some degree through the script repository but it is not anymore maintained. Luckily there is <a href="https://github.com/renovatebot/renovate">Renovate</a> which describes itself as:</p><blockquote>Universal dependency update tool that fits into your workflows.</blockquote><p>It’s available in three flavors:</p><ul><li><a href="https://github.com/renovatebot/renovate#self-hosting">Self-hosted</a></li><li>As <a href="https://github.com/apps/renovate">Github Application</a></li><li>In Azure DevOps through <a href="https://marketplace.visualstudio.com/items?itemName=jyc.vsts-extensions-renovate-me">marketplace</a></li></ul><p>It has wide support for different managers. I highly suggest checking them out through <a href="https://docs.renovatebot.com/modules/manager/#supported-managers">this</a>.</p><h4>Setup</h4><p>First we need to create repository for the Renovate. After repository is created create .gitlab-ci.yml:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c16d0462af60b7ff584d1d9783c02879/href">https://medium.com/media/c16d0462af60b7ff584d1d9783c02879/href</a></iframe><p>This will use the latest image available (at the time of writing) and is only triggered by schedule. You also need to define two environment variables:</p><p><strong>GITHUB_COM_TOKEN</strong></p><p>You need to create PAT in Github with read access to public repositories</p><p><strong>RENOVATE_TOKEN</strong></p><p>This is Gitlab Access Token which should have API access.</p><p>Next, we need to provide config file for the Renovate which defines basic settings for Renovate.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/357807552b6c4ad28132760a342fc11d/href">https://medium.com/media/357807552b6c4ad28132760a342fc11d/href</a></iframe><p>Lets quickly go through all the settings:</p><p><strong>onboardingConfig:</strong></p><p>When you add repository to the repositories block without having renovate.json file inside the default branch of target repository everything inside this block is added to the renovate.json file in the merge request Renovate will create.</p><p><strong>platform:</strong></p><p>Defines platform where Renovate is executed. <a href="https://docs.renovatebot.com/modules/platform/">List of supported platforms</a>.</p><p><strong>gitAuthor:</strong></p><p>This will show in the git logs after the changes are merged.</p><p><strong>baseBranches:</strong></p><p>Default setting what branches should be checked. This can be overwritten per repository with their own config.</p><p><strong>labels:</strong></p><p>What labels PR’s should have. These can also be defined at the repository level config. When it’s defined in the root config every repository will get the dependency label.</p><p><strong>packageRules:</strong></p><p>This block offers wide variery of settings to be configured. In this example i’m saying that i want all the repositories that has terraform related dependency updates happening to have label terraform and it will also include the dependencies label. I highly suggest reading more about the packageRules <a href="https://docs.renovatebot.com/configuration-options/#packagerules">here</a>.</p><p><strong>repositories:</strong></p><p>Defines what repositories Renovate should check.</p><p>These are not the only settings available and you can check complete settings available <a href="https://docs.renovatebot.com/configuration-options/">here</a>. If you are using self-hosted Gitlab you can define attribute endpoint: <a href="https://gitlab.com/api/v4/">https://self-hosted-url/api/v4</a> in config.json.</p><p>In our example we are checking the Renovate repository itself. If there would be update available for the image used in .gitlab-ci.yml Renovate would open PR for it. Lastly we need to add renovate.json file as it’s required in <strong>default branch</strong> of repositories that are included in repositories block:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2b91c2888ed1c9cb0a4609f2b47f3288/href">https://medium.com/media/2b91c2888ed1c9cb0a4609f2b47f3288/href</a></iframe><p>In example Terraform project i have two files:</p><p><strong>versions.tf:</strong></p><p>This file lists all the required providers and their versions that should be checked and updated accordingly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/75c7eb16c96340a9fbdccd2cceaa76a2/href">https://medium.com/media/75c7eb16c96340a9fbdccd2cceaa76a2/href</a></iframe><p><strong>renovate.json:</strong></p><p>This provides instructions to Renovate what to check from the repository.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1995a08046c9cef4047fa3bcdb610604/href">https://medium.com/media/1995a08046c9cef4047fa3bcdb610604/href</a></iframe><p>Lets go through the settings</p><p><strong>dependencyDashboard:</strong></p><p>This will create markdown formatted “dashboard” under issues in Gitlab. Here you can see status of your dependencies like open merge requests, also merge requests that weren’t opened because of rate limits will show here also.</p><p><strong>baseBranches:</strong></p><p>In our config.js file we defined that by default we want to check the main branch for dependency updates. Here we are overriding it and checking dependencies from main and production branches and opening pr against those branches.</p><p><strong>enabledManagers:</strong></p><p>This defines what managers we want to use. If this is not defined it will check all the files in the repository and figures out suitable manager for the files.</p><p>With these settings you should be able to trigger pipeline succesfully which checks the updates for the Terraform providers and opens PR’s for those. <strong>One thing to note is that this example is using the config:base setting which will set </strong><a href="https://docs.renovatebot.com/presets-config/"><strong>these settings</strong></a><strong>. There is atleast two settings to consider changing:</strong></p><p><a href="https://docs.renovatebot.com/configuration-options/#prhourlylimit"><strong>prHourlyLimit</strong></a><strong> (default: 2):</strong></p><p>This configures how many Merge requests Renovate can open per hour. So if you don’t see your Merge requests created you can check the planned Merge requests from the Dependency Dashboard (If you have it enabled) and mark them to be created regardless the rate limit.</p><p><strong>prConcurrentLimit (default: 10):</strong></p><p>This defines how many open Merge requests Renovate can have. This is per repository limit.</p><p>This was just a light scratch on the surface of what Renovate can do. I highly suggest going through the <a href="https://docs.renovatebot.com/">documentation</a> and check if it would suit your workflow.</p><figure><a href="https://faun.to/bP1m5"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCiLLad3dvZLwBa-B5cAVQ.png" /></a></figure><p>Join FAUN: <a href="https://faun.to/i9Pt9"><strong>Website</strong></a><strong> </strong>💻<strong>|</strong><a href="https://faun.dev/podcast"><strong>Podcast</strong></a><strong> </strong>🎙️<strong>|</strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong>|</strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong>|</strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷|<a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook Group</strong></a><strong> </strong>🗣️<strong>|</strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin Group</strong></a><strong> </strong>💬<strong>|</strong> <a href="https://faun.dev/chat"><strong>Slack</strong></a> 📱<strong>|</strong><a href="https://thechief.io/"><strong>Cloud Native</strong> <strong>News</strong></a><strong> </strong>📰<strong>|</strong><a href="https://linktr.ee/faun.dev/"><strong>More</strong></a><strong>.</strong></p><p><strong>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author 👇</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37fab2b7e847" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/use-renovate-to-manage-dependencies-in-gitlab-37fab2b7e847">Use Renovate to Manage Dependencies in Gitlab</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using Filestore with GKE]]></title>
            <link>https://medium.com/@joonasvenlinen/using-filestore-with-gke-c9bea824eccc?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9bea824eccc</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Mon, 27 Sep 2021 06:15:35 GMT</pubDate>
            <atom:updated>2021-09-27T06:15:35.857Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Gx3jk4VP4C_vO0J9" /><figcaption>Photo by <a href="https://unsplash.com/@frank041985?utm_source=medium&amp;utm_medium=referral">Frank R</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Filestore is Google’s fully managed NFS solution. Using this with the GKE it allows to use ReadWriteMany access mode. This allows to make zero downtime deployments when the volume can be mounted to new pod before tearing down the old. Also if you have application that needs to scale you would need to have storage solution that allows ReadWriteMany. One downside to this service is that it’s relatively expensive as you have to provision minimum of 1 terabytes of space for the Basic HDD which costs you + 200$. If you need more performance then you have to go with the SSD and there you have minimum of 2.5 terabytes so the costs will go up quickly.</p><p>If we want to dynamically provision storage from the Filestore we have to use provisioner like <a href="https://github.com/kubernetes-sigs/nfs-subdir-external-provisioner">nfs-subdir-external-provisioner</a> which can be easily installed using Helm. Google through me little bit off with this statement:</p><blockquote><strong>Note:</strong> Google recommends using the managed <a href="https://cloud.google.com/kubernetes-engine/docs/how-to/persistent-volumes/filestore-csi-driver">Google Kubernetes Engine (GKE) Filestore CSI driver</a> (GKE version 1.21 or later) to enable GKE workloads to dynamically create and mount Filestore volumes.</blockquote><p>What i though i could do is to use the storageClass Google creates when the Filestore CSI driver is enabled to dynamically provision storage from the Filestorage but what it actually means is that it allows you to dynamically provision Filestore instances using the CSI drivers. This would obviously cost lots of money so best bet is to go with the provisioner installed to the cluster and configure it to use the Filestore. It would be nice if Filestore could actually handle the dynamic provisioning of storage. It could be something that is coming at some point as the Filestore CSI driver is still in beta.</p><p>With this setup actual NFS Server is managed by Google so there is one less critical component to manage by cluster admins. Also the provisioner is only used when there is changes in claims that use the storageClass that is scoped to the provisioner. This means that it’s not that critical part of the system as it can go down and volumes still continues to work.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9bea824eccc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Robot Framework testing using Github Actions]]></title>
            <link>https://faun.pub/robot-framework-testing-using-github-actions-e0aa8df16fd8?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/e0aa8df16fd8</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[robot-framework]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 11:41:00 GMT</pubDate>
            <atom:updated>2020-04-21T09:38:23.328Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tsO8gh31aGaX82nmKWibqQ.jpeg" /></figure><p>I recently started using Github Actions to automate my software workflows. In this article, I want to demonstrate how to use actions to run Robot Framework tests. I’m using my own action in this example. You can find out more about the action from <a href="https://github.com/marketplace/actions/robot-framework">here</a>. Also, I’m showing how to publish a simple report about the run in the commit comment section. Here is a screenshot how the report looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*ktf6aGgNAid-bPygeUXUhA.png" /></figure><p>This action is still under heavy development and bugs might occur. In this example, I’m creating the workflow by hand but you can find started templates from the Actions tab inside your repository. First, let&#39;s create the workflow folder:</p><pre>mkdir -p .github/workflows</pre><p>Create a file called main.yml under directory we just created. If you want you can choose a different name for the file. In this file add this code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e0600a5bb16d553d15f688e64f6c0d3c/href">https://medium.com/media/e0600a5bb16d553d15f688e64f6c0d3c/href</a></iframe><p>Here we define a name for the workflow. Again this is up to you to decide how to name your workflow. Then we define when we want to trigger the action. In this example, we want to trigger the action when there is a new commit in the master branch. Next, let&#39;s define jobs for the action:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6aed8a2d5fbd47dedccb9069dc23f208/href">https://medium.com/media/6aed8a2d5fbd47dedccb9069dc23f208/href</a></iframe><p>Here we are defining a job called test that is run on ubuntu-latest runner. You can check for more information about runners <a href="https://help.github.com/en/actions/configuring-and-managing-workflows/configuring-a-workflow#choosing-a-runner">here</a>. Next, we define steps for the jobs. First, we are using <a href="https://github.com/actions/checkout">actions/checkout@v2</a> action to checkout our repository so we can use it in the workflow. After the checkout, we are using <a href="https://github.com/marketplace/actions/robot-framework">joonvena/robotframework-docker-action@v0.1</a> action to execute tests. You need to define these environment variables for the action.</p><ul><li><strong>BROWSER</strong>: chrome / firefox</li><li><strong>ROBOT_TEST_DIR</strong>: Path where your tests are found. In this case /robot_tests</li><li><strong>ROBOT_RESULTS_DIR</strong>: Reports output-dir (This directory will be created for you it doesn’t exist)</li></ul><p>If you want to execute in parallel use <strong>ROBOT_THREADS</strong> environment variable eg. <strong>ROBOT_THREADS: 2. The default</strong> is not to execute in parallel.</p><p><strong>${{ github.workspace }}</strong> is Github&#39;s default environment variables that contains the copy of the repository. If you don’t use the checkout action at the beginning the directory will be empty. You can read more about the environment variables <a href="https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables">here</a>.</p><p>At the last step, we use the <a href="https://github.com/actions/upload-artifact">actions/upload-artifact@v1</a> action to store our test reports so we can use them in the next job. Github stores the artifacts for 90 days. if: always() is used to make sure that the step is executed even if the test suite fails. You can read more about Job-status checks from <a href="https://help.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#job-status-check-functions">here</a>.</p><p>Now we have to define a job that creates the report:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8af01ceb28bc32d9c16878ab0640f1cb/href">https://medium.com/media/8af01ceb28bc32d9c16878ab0640f1cb/href</a></iframe><p>We are calling it generate_report. Again you can use the name you like. if the step is used again to make sure that this step is run always. needs is used to wait until the test step is run before starting this job. Here we are using <a href="https://github.com/actions/download-artifact">actions/download-artifact@v1</a> to get the artifacts we stored at a previous job. In the next step, we are getting the owner and name of the repository. This step is completely optional and you can give these values straight as environment variables. The last step is to use <a href="https://github.com/marketplace/actions/robot-reporter">joonvena/robotframework-reporter-action@v0.1</a> action to generate a report and post it. This action needs these environment variables:</p><ul><li><strong>GH_ACCESS_TOKEN</strong>: Token to access Github API</li><li><strong>REPO_OWNER</strong>: Owner of the repository</li><li><strong>COMMIT_SHA: </strong>SHA<strong> </strong>of the commit that triggered the action (This is already provided inside ${{ github.sha }} environment variable)</li><li><strong>REPOSITORY_NAME</strong>: Name of the repository</li><li><strong>REPORT_PATH</strong>: Path to your reports folder</li></ul><p>Complete code should look like this now:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1e3e89d2b115ccaa77451e6943b8b6ff/href">https://medium.com/media/1e3e89d2b115ccaa77451e6943b8b6ff/href</a></iframe><p>Now when you push to master it should create a report at the end. Hope you enjoyed this article!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/0*Piks8Tu6xUYpF4DU" /></figure><p><strong>Follow us on </strong><a href="https://twitter.com/joinfaun"><strong>Twitter</strong></a><strong> </strong>🐦<strong> and </strong><a href="https://www.facebook.com/faun.dev/"><strong>Facebook</strong></a><strong> </strong>👥<strong> and </strong><a href="https://instagram.com/fauncommunity/"><strong>Instagram</strong></a><strong> </strong>📷 <strong>and join our </strong><a href="https://www.facebook.com/groups/364904580892967/"><strong>Facebook</strong></a><strong> and </strong><a href="https://www.linkedin.com/company/faundev"><strong>Linkedin</strong></a><strong> Groups </strong>💬<strong>.</strong></p><p><strong>To join our community Slack team chat </strong>🗣️ <strong>read our weekly Faun topics </strong>🗞️,<strong> and connect with the community </strong>📣<strong> click here⬇</strong></p><figure><a href="https://www.faun.dev/join/?utm_source=medium.com%2Ffaun&amp;utm_medium=medium&amp;utm_campaign=faunmediumbanner"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6P3WpLjGv5v1ucm5dgkucg.png" /></a></figure><h4>If this post was helpful, please click the clap 👏 button below a few times to show your support for the author! ⬇</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e0aa8df16fd8" width="1" height="1" alt=""><hr><p><a href="https://faun.pub/robot-framework-testing-using-github-actions-e0aa8df16fd8">Robot Framework testing using Github Actions</a> was originally published in <a href="https://faun.pub/">FAUN.dev() 🐾</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Monitoring Jenkins jobs with Grafana]]></title>
            <link>https://medium.com/@joonasvenlinen/monitoring-jenkins-jobs-with-grafana-f1ff11af1e6c?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1ff11af1e6c</guid>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[influxdb]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Wed, 25 Mar 2020 12:54:10 GMT</pubDate>
            <atom:updated>2020-03-25T12:54:10.564Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qeMRcS0vdJUH1sas" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>This article demonstrates how to use Jenkins with InfluxDB plugin to monitor Jenkins jobs through Grafana. You can get the example repository from <a href="https://github.com/joonvena/jenkins_job_monitor">here</a>. There isn’t any real application code in the repository as you can modify this example Jenkinsfile to your likings.</p><p>First clone the repository and use docker-compose to create the application stack:</p><pre>docker-compose up -d</pre><h4>Jenkins &amp; InfluxDB Setup</h4><p>Navigate to <a href="http://localhost:8080/">http://localhost:8080</a>. Jenkins is now asking for Administrator password. You can get it with:</p><pre>docker logs &lt;container_id&gt;</pre><p>You should see the password near the end. Paste the password and press next. Select the default option to install suggested plugins. When plugins are installed add your user details and initial Jenkins setup is done (You can leave the jenkins url as default).</p><p>Now we need to install the <a href="https://plugins.jenkins.io/influxdb">InfluxDB</a> plugin. From the left press Jenkins and navigate to Manage Jenkins &gt; Manage Plugins. Select the available tab and search for InfluxDB and install it without restart.</p><p>Next step is to configure the InfluxDB instance in Jenkins. Go to Manage Jenkins &gt; Configure System and find InfluxDB targets there and add new target (<strong>You can find the db, username &amp; password from compose file</strong>):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uoLeVkcJ2HqZttiCCtAD8g.png" /></figure><p>We did uncheck the Global Listener because we don’t want to trigger it on every project. We are defining the usage in pipeline along with the custom data that contains the job url.</p><p>Create new Multibranch pipeline project with name you want. Im using Test_Project for now. Add Git as branch source:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Sd3WcR8c7CfM-UUIZz4bcg.png" /></figure><p>Now it scans through the repo and should find master branch. Now we can test that the InfluxDB plugin is working by running the job. If everything works as expected you should see this in job Console Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NSj3pJzb8SUTY3H-VdJlOQ.png" /></figure><h4>Grafana Setup</h4><p>You can access Grafana in <a href="http://localhost:3005/">http://localhost:3005</a>. Default username/password is admin/admin. You will be prompted to enter new password. Now click Add Datasource from the frontpage and select InfluxDB as source with these settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dW06oYbLlpRZ8sG5sLPChg.png" /></figure><p>Go back to home and press new New Dashboard &gt; Choose Visualisation and select Table. Click the Queries tab and change settings to these:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DwaIf1q2lrk3QWeqSimxZw.png" /></figure><p>Add these column styles in the Visualization tab:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dXbrM8rkDGg9NGhcdriIWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zy3FHmZJf2599_gGxVauSA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pzFD4894qp6nnH6vXoYyA.png" /></figure><p>The ${__cell_3:raw} basically checks cell for value. In this case it check value from third cell. Now if you save the dashboard and click the build status you should be redirected to the build job page in Jenkins. So thats it for now. I suggest that you read the <a href="https://plugins.jenkins.io/influxdb">InfluxDB</a> documentation for more information and use cases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1ff11af1e6c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build Simple Web Scraper Using Python & Selenium]]></title>
            <link>https://medium.com/@joonasvenlinen/build-simple-web-scraper-using-python-selenium-f0376b6cc8fa?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0376b6cc8fa</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Thu, 25 Jul 2019 14:01:47 GMT</pubDate>
            <atom:updated>2019-07-25T14:01:47.907Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bOw1B4ULyw3Wj09d" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this article i’m going to show you how to build a simple web scraper that makes request to Google by user input. It finds results from Stackoverflow. Example if i search “How to define array in Java” it opens the first result and checks if there is a accepted answer. If it finds the answer it gets the<strong> &lt;code&gt;</strong> block from the answer and print it to user. If no its fetches all the <strong>&lt;code&gt;</strong> blocks from the topic and prints them out.</p><p>First lets define all the needed imports:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/98cf8d7e1f15ca794d835a2c750a820c/href">https://medium.com/media/98cf8d7e1f15ca794d835a2c750a820c/href</a></iframe><p>Now we can define base settings:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08f0dbc9410a684ffba27c413ed3c169/href">https://medium.com/media/08f0dbc9410a684ffba27c413ed3c169/href</a></iframe><p>We are writing the program inside while loop because we don’t want the program to exit after it finishes. First we are asking input from user what to search. After that we define our driver in this case i’m using Chrome as my browser. After you get it up and running you can change the browser to headless mode. This way the browser doesn’t pop up but instead does everything in the background. Then we define wait. This defines how long does the Selenium wait the element to be visible. Last we are using the <strong>driver.get()</strong> method to navigate to Google.</p><p>Now we can start locating the elements from Google. Open the Elements Panel from Chrome with<strong> Ctrl+Shift+c </strong>and click on the search field. Now we can see the element information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*1Ozfv5-rMsLM8w38Q4HCrw.png" /></figure><p>We can use the name attribute to locate element in Selenium:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e6e9b29a25c67015c9e57c5b2425ca23/href">https://medium.com/media/e6e9b29a25c67015c9e57c5b2425ca23/href</a></iframe><p>Now we have to pass the search word from user input to this element:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a6e92985c66c9a6ce5b19d5392c6f15/href">https://medium.com/media/6a6e92985c66c9a6ce5b19d5392c6f15/href</a></iframe><p>Here we are using the <strong>send_keys()</strong> method to pass the search_word variable to the input field. At the end we are also defining that we only want results from stackoverflow.com. Last we press Enter key to search.</p><p>Now for the results we are using the <strong>wait.until() </strong>method. If we didn’t have any wait it would try to run the code instantly and it would fail because the results are not finished loading:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5aeabe1845079c25eb69010c92206fff/href">https://medium.com/media/5aeabe1845079c25eb69010c92206fff/href</a></iframe><p>I’m using XPATH to locate the elements. You can test your locators in the browser by opening Google results page, Developer Console (<strong>Ctrl+Shift+i) </strong>and type:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c216d88b6c5c709bc593317881e30c6f/href">https://medium.com/media/c216d88b6c5c709bc593317881e30c6f/href</a></iframe><p>This finds all the elements from the page matching the locator and prints them in console. For this example i’m just going to open the first result and i’m using <strong>click()</strong> method for this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ec6f12381dc46827b8f59dc54374ba9/href">https://medium.com/media/1ec6f12381dc46827b8f59dc54374ba9/href</a></iframe><p>Now we need to define a method to check if element is present. This is used to assert if there is accepted answer in the topic opened:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f60dd35717a6d47cd7f02f3b8ab77aab/href">https://medium.com/media/f60dd35717a6d47cd7f02f3b8ab77aab/href</a></iframe><p>Now we can write the logic to check if there is accepted answer:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ed19273f801c5e1b6e16119ad24126e4/href">https://medium.com/media/ed19273f801c5e1b6e16119ad24126e4/href</a></iframe><p>Here we are calling the elements_is_present method to check if accepted answer is present. If its there get the <strong>&lt;code&gt; </strong>block, else get all the <strong>&lt;code&gt; </strong>elements from the page. We are using <strong>.text </strong>to print out the elements text.</p><p>Lastly we need to close the browser:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/debf0d939a7efbf3b8eae3a35c2b885f/href">https://medium.com/media/debf0d939a7efbf3b8eae3a35c2b885f/href</a></iframe><p>It it good idea to clear the screen after new search is made. Add this after the <strong>driver.get():</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/00fdbb975c6c87d250bda85ac515fa88/href">https://medium.com/media/00fdbb975c6c87d250bda85ac515fa88/href</a></iframe><p>If you are using UNIX:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc33873ca79c2597b6a23d85e559ec75/href">https://medium.com/media/fc33873ca79c2597b6a23d85e559ec75/href</a></iframe><p>So here it is. Simple example how you could use Selenium and get started building something with it. Here is the complete code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d67d64255e19b14eace7f862deb0d0e5/href">https://medium.com/media/d67d64255e19b14eace7f862deb0d0e5/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0376b6cc8fa" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Gerrit with HTTP authentication]]></title>
            <link>https://medium.com/@joonasvenlinen/gerrit-with-http-authentication-1e7ae5fb7359?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/1e7ae5fb7359</guid>
            <category><![CDATA[gerrit]]></category>
            <category><![CDATA[code-review]]></category>
            <category><![CDATA[version-control]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Sat, 13 Jul 2019 14:33:57 GMT</pubDate>
            <atom:updated>2019-07-13T14:33:57.243Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*BZ8XPwtEGAhhR_bt" /><figcaption>Photo by <a href="https://unsplash.com/@freeche?utm_source=medium&amp;utm_medium=referral">Kvistholt Photography</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong>Gerrit</strong> is a free, web based team code collaboration tool. Software developers in a team can review each other’s modifications on their source code using a Web browser and approve or reject those changes. It integrates closely with Git. Gerrit also has wide range of plugins that integrates example Jenkins to the workflow.</p><p>Gerrit supports different authentication methods but doesn’t come with any out of the box. Default setting is DEVELOPMENT_BECOME_ANY_ACCOUNT. This basically allows you to just select account from list and login without any authentication. You can check different authentication methods <a href="https://gerrit-review.googlesource.com/Documentation/config-gerrit.html">here</a>. In this article i’m going to show how you can setup simple HTTP based authentication with Apache. I’m using Docker with compose on this example.</p><p>First create the docker-compose.yml file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/dcad22b4fb575faeb307c94db0680634/href">https://medium.com/media/dcad22b4fb575faeb307c94db0680634/href</a></iframe><p>Create folders:</p><pre>mkdir gerrit httpd</pre><p>Initialize the Gerrit to get the config files under gerrit folder:</p><pre>docker-compose up gerrit<br>docker-compose stop</pre><p>Copy the httpd.conf from <a href="https://gist.github.com/joonvena/2aa0c30550d8564fef9253e08a770291">here</a> and copy it under httpd folder. Create a .htpasswd file under the httpd folder and add user to it:</p><pre>htpasswd -c .htpasswd joonas</pre><p>Open the httpd.conf file and find lines:</p><pre>#LoadModule proxy_module modules/mod_proxy.so</pre><pre>#LoadModule proxy_http_module modules/mod_proxy_http.so</pre><p>Comment out these lines. Scroll to the bottom and add this section:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/da56b5d519548bc47782ff3a7fd5a3fe/href">https://medium.com/media/da56b5d519548bc47782ff3a7fd5a3fe/href</a></iframe><p>Here we define VirtualHost and Proxy. We are using the .htpasswd as authentication file. If authentication is successful we are redirecting the user to the Gerrit home page. Now open the gerrit.config file under gerrit folder and change the settings to this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/229d5fa111e936fda7473683ff897f69/href">https://medium.com/media/229d5fa111e936fda7473683ff897f69/href</a></iframe><p>Auth type is changed to http. There is also logout url defined. Haven’t figured out easy way logging out when using Apache so this is a workaround for it. Now run the docker-compose:</p><pre>docker-compose up -d</pre><p>I’t should start the containers and if we access the url: <a href="http://localhost:8100/">http://localhost:8100</a> it should prompt for password. Enter the correct username and password and you should be forwarded to Gerrit.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1e7ae5fb7359" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[UI Regression Testing With Robot Framework Part 1]]></title>
            <link>https://medium.com/@joonasvenlinen/ui-regression-testing-with-robot-framework-part-1-578f2f50b721?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/578f2f50b721</guid>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[robot-framework]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[regression-testing]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Sat, 16 Feb 2019 14:09:36 GMT</pubDate>
            <atom:updated>2019-02-16T14:09:36.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fadllMmaFpdPXnBU" /><figcaption>Photo by <a href="https://unsplash.com/@rocknrollmonkey?utm_source=medium&amp;utm_medium=referral">Rock&#39;n Roll Monkey</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In this series we are going to learn how to install &amp; use Robot Framework. We are going to write a simple regression suite for website. In this first part we cover the installation process and also write a simple case.</p><h3>Tools needed:</h3><ul><li>Robot Framework</li><li>Selenium2Library</li><li><a href="https://www.python.org/">Python</a> (Version 2 or 3)</li></ul><h3>Installation</h3><p>When you install Python it should install PyPi which is the Python Package Manager. If you don’t get the PyPi installed you can try to bootstrap it from the standard library:</p><pre>python -m ensurepip --default-pip</pre><p>First we are going to install the Robot Framework using PyPi. Open Command Line and type:</p><pre>pip install robotframework</pre><p>After this install the web testing library that is used to test the UI:</p><pre>pip install robotframework-selenium2library</pre><p>There is a RIDE test data editor for Robot Framework available if you want to use that to edit and run the cases. You can install it with PyPi:</p><pre>pip install robotframework-ride</pre><p>I personally use <a href="https://code.visualstudio.com/">Visual Studio Code</a> with the <a href="https://marketplace.visualstudio.com/items?itemName=TomiTurtiainen.rf-intellisense">Robot Framework Intellisense</a> plugin. It just works way faster than the RIDE editor. I’m going to demonstrate later other useful functions that you get with the VSCode.</p><p>Last thing we need to do is to install the drivers for the browser so it can be controlled by Robot Framework. I’m using Chrome in this example so we have to get the ChromeDriver from <a href="https://sites.google.com/a/chromium.org/chromedriver/downloads">here</a>. Now we have to copy the driverfile to correct folder:</p><pre>cp /path/to/chromedriver /usr/local/bin/chromedriver</pre><p>You can use Safari out of the box without installing any drivers just enable ‘Show Develop menu in menu bar’ from the Safari preferences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*laEhX5mVrSc0hIg1tXFW1w.png" /></figure><p>Now you can see Develop menu in menubar. Here you just select <em>Develop &gt; Allow Remote Automation</em> and you are good to go.</p><h3>Writing first case</h3><p>Ok, no we are ready to start writing our first case. We are going to write a simple case that navigates to Google and checks the page title and verifies that we are really in the Google and closes the browser. I’m going to provide the full code here:</p><pre>*** Settings ***</pre><pre>Library        Selenium2Library</pre><pre>*** Test Cases ***</pre><pre>Open Google</pre><pre>  Navigate To Google</pre><pre>  Verify Page Contains Google</pre><pre>*** Keywords ***</pre><pre>Navigate To Google</pre><pre>  Open Browser   https://www.google.fi   browser=chrome<br></pre><pre>Verify Page Contains Google</pre><pre>  ${Get_title}=      Get Title</pre><pre>  Should Be Equal As Strings     ${Get_title}   Google</pre><pre>  Close Browser</pre><p>Save the file as <em>.robot</em> file and run inside cmd:</p><pre>robot example.robot</pre><p>This starts running the test suite and should output something like this after the tests are run:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ToRP-MAj9Wgu8tZlTcBXw.png" /></figure><p>Here we can see that the test case Open Google passed. In the end you can see that there are also logs available from the test runs. If we open up the log.html we can see all the information about the test suite:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4UbHHqiVMEi-9ieMiJbRhQ.png" /></figure><p>Log.html file is your best friend when you are having problems with the suite. Lets modify the <em>Open Google </em>test case so it will fail:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z13GbAzyxwgw5uwSDXJ5YA.png" /></figure><p>Now we can already see from here what the problem is. Title is not matching Google and it will fail. But when we have more complex test suites and test steps its easier to check the Log.html file for more information:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0Tp_DOuHfIV8ljrXwO4_w.png" /></figure><p>Now we can see from the log that the first keyword has passed the test but on the second keyword it fails. As we can see its much easier to check the logs than just reading from cmd. This concludes the first part of this series. In next part we are going to dive a little deeper on writing the test suites, using own keywords and variables. Also i’m going to cover the most used keywords from Selenium2Library and give examples how to use them. Hope you did enjoy the first part of this series. See you in next one!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=578f2f50b721" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing ev3dev to Lego Mindstorms EV3]]></title>
            <link>https://medium.com/@joonasvenlinen/installing-ev3dev-to-lego-mindstorms-ev3-d53c77305468?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/d53c77305468</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[robots]]></category>
            <category><![CDATA[lego-mindstorms]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Thu, 08 Nov 2018 16:11:25 GMT</pubDate>
            <atom:updated>2018-11-08T16:11:25.072Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3pohlngMuTIFqRQtF_xeiw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/6NUlOHM40w8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jelleke Vanooteghem</a> on <a href="https://unsplash.com/search/photos/lego-robot?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>In this series i will go through the basic steps to install ev3dev a <a href="https://www.debian.org/">Debian Linux</a>-based operating system that runs on several LEGO® MINDSTORMS compatible platforms including the <a href="http://www.lego.com/en-us/mindstorms/products/mindstorms-ev3-31313">LEGO®MINDSTORMS EV3</a> and <a href="https://www.raspberrypi.org/">Raspberry Pi</a>-powered <a href="https://www.dexterindustries.com/BrickPi/">BrickPi</a>. Also i will cover the basics to transfer data between your computer and the EV3, writing your first program and transferring it to the EV3 and also one ‘advanced’ example. So lets begin installation. (NOTE: This installation doesn’t touch the original Lego system. When you remove the SD-card it boots normally to the original system)</p><h3>Tools we need</h3><ul><li>EV3 Brick</li><li>microSD or microSDHC card (2GB or larger, but not over 32GB) microSDXC is not supported</li><li>Latest ev3dev image file from <a href="https://www.ev3dev.org/downloads/">here</a></li><li><a href="https://www.balena.io/etcher/">Etcher</a> for transfering the image file to SD-card</li></ul><p>When you have downloaded all the files and installed Etcher we can start by plugging our SD-card to the reader and open Etcher. Etcher should automatically recognize the SD-card. Press the Select image button and select the ev3dev image file you downloaded previously. Now our screen should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*WvHYkTHawRItc6yvl3WPLQ.png" /></figure><p>I already have it installed so don’t mind the name of the SD-card. Now you can press Flash and wait for it to finish. After the flashing is done, we can insert the SD-card in EV3 brick and start it. You should see ev3dev text at top of the screen. It runs the initial configuration and after that you should be greeted with ev3dev menus.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/317/1*HZ4Vaw6n1PndoCRbzxrIng.png" /><figcaption>It works!</figcaption></figure><p>So here is the first part of the series. In next part we will look how to connect to the brick from SSH using Bluetooth connection, writing our first program and running it. You can also check from the official <a href="https://www.ev3dev.org/docs/tutorials/">ev3dev </a>website how to setup connections.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d53c77305468" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Desktop Application Automation With Robot Framework]]></title>
            <link>https://medium.com/@joonasvenlinen/desktop-application-automation-with-robot-framework-6dc39193a0c7?source=rss-e9d98f989762------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dc39193a0c7</guid>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[robot-framework]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Joonas Venäläinen]]></dc:creator>
            <pubDate>Wed, 07 Nov 2018 20:31:52 GMT</pubDate>
            <atom:updated>2018-11-09T11:48:23.880Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i384H_6SMsFYMMH4aPrZfw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/U3sOwViXhkY?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Franck V.</a> on <a href="https://unsplash.com/search/photos/automation?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>A colleague of mine approached me and asked is it possible to use Robot Framework for automating desktop applications. I really haven’t ever considered using that for that purpose. There was some tutorial on YouTube that explained how to run &amp; write automation for the Windows stock calculator. I decided to try to install the correct tools and write some simple test case. Let’s begin</p><h3><strong>Installation</strong></h3><p><strong>List of packages to download from web</strong></p><ul><li>Python from <a href="https://www.python.org/downloads/release/python-2713/">here</a></li><li>wxPython2.8-win64-unicode-2.8.12.1-py27 from <a href="https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/">here</a></li><li>AutoItLibrary from <a href="https://pypi.org/project/robotframework-autoitlibrary/#files">here</a></li><li>AutoIt Window Info Tool from <a href="https://www.autoitscript.com/site/autoit/downloads/">here</a></li></ul><p><strong>Python</strong></p><p>First, we need to install Python. You have to install version 2.7.13 which you can get from <a href="https://www.python.org/downloads/release/python-2713/">here</a> if you didn’t download it from the links above. I’m using the 64bit version on my setup. I recommend you install the python to the default location (C:\Python27). Also, remember to check Add python.exe to a path is selected to be installed. This adds Python to PATH variable so you can call it anywhere in cmd with python command. I had some problem with the installation and pip(Python package manager) didn’t get installed so i did have to install it manually by going to cmd and writing the following commands:</p><pre>curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py</pre><pre>python get-pip.py</pre><p>After that you can check that it’s installed with command:</p><pre>pip --version</pre><p>You should get something like this:</p><pre>pip 18.1 from c:\python27\lib\site-packages\pip (python 2.7)</pre><p>You can also check that Python is correctly installed with command:</p><pre>python --version</pre><p><strong>Pywin32</strong></p><p>Next, we are going to install Pywin32. This package provides access to much of the Win32 API, the ability to create and use COM objects, and the Pythonwin environment. We can install it through the cmd using pip:</p><pre>pip install pywin32</pre><p><strong>wxPython</strong></p><p>This package is needed for the RIDE to work correctly. You can get it with pip again:</p><pre>pip install -U wxPython</pre><p>We also have to install the windows executable version wxPython2.8-win64-unicode-2.8.12.1-py27.exe. If you didn’t download it from the link in the beginning you can get it from <a href="https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/">here</a>.</p><p><strong>Robot Framework</strong></p><p>Then we also have to install the test automation framework.</p><pre>pip install robotframework</pre><p><strong>RIDE</strong></p><p>RIDE is editor for the test data</p><pre>pip install robotframework-ride</pre><p><strong>AutoItLibrary</strong></p><p>AutoItLibrary is a Robot Framework keyword library wrapper for the AutoIt Scripting Language.</p><pre>pip install robotframework-autoitlibrary</pre><p>We also have to extract the robotframework-autoitlibrary-1.2.2.zip file. If you didn’t download it in the beginning you can get it from <a href="https://pypi.org/project/robotframework-autoitlibrary/#files">here</a>. You can extract it anywhere. Now you have to open new cmd but this time you have to run the cmd as Administrator (right-click the cmd from the start menu and choose Run as administrator). Now navigate in the cmd to the folder you extracted previously and run:</p><pre>python setup.py install</pre><h3>Automating first program</h3><p>Now we got the boring part out of the way. You can now launch RIDE editor from cmd by typing:</p><pre>ride.py</pre><p>After the RIDE is loaded go to <strong>File &gt; New Project. </strong>Use these settings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bw72YjCTApktKNUQB2EQWQ.png" /></figure><p>Now you should have screen like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IyfafN4dmRMsUwou6ug4xw.png" /></figure><p>Now we have to add the AutoItLibrary to the suite Libraries. Click Library &gt; Browse. Now you have to navigate to the folder where libraries are. So I’m going to navigate to C:\Python\27\Lib\site-packages\AutoItLibrary. Here choose any file and click Open. You can also just type the library name to Name field and press Ok. I have sometimes countered some issues using just the name so i prefer to use the longer version. Now my Name field looks like this:</p><pre>../../../../Python27/Lib/site-packages/AutoItLibrary/__init__.pyc</pre><p>Now we have to trim the field value so its like this:</p><pre>../../../../Python27/Lib/site-packages/AutoItLibrary/</pre><p>Now you can press Ok. A library is now added and the color of the text should be black. If its red then import failed. You can check clues from View &gt; View RIDE Log.</p><p>Right-click your test suite name and select New Test Case. You can name it however you want I’m going to use first_test. Now your screen should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qWFEpm1W01bzb2J6NCDt-Q.png" /></figure><p>You can save by pressing <strong>CTRL + S. </strong>Now navigate to Text Edit tab. Here we will be writing our code for the automation. Our test case looks like this when you open it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVqzksTn7hc1pOBjJfLqSA.png" /></figure><p>If you want some syntax highlighting to your RIDE editor install this package and restart RIDE. I prefer just to make initial config in RIDE &amp; after that write &amp; edit my cases in <a href="https://code.visualstudio.com/">VSCode</a> and just run the cases in RIDE. Im also using the <a href="https://marketplace.visualstudio.com/items?itemName=TomiTurtiainen.rf-intellisense">Robot Framework Intellisense extension</a> to make VSCode recognize the language.</p><pre>pip install pygments</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*b0EQ30KEPmyjEePBy8QRzQ.png" /><figcaption>Better</figcaption></figure><p>Now let’s start writing our code. First, we have to pick our software that we are going to automate. I’m going to use Notepad++ for this tutorial. First, we are going to add a new section to the test called Variables. Inside Variables, we are going to define our first variable that defines the program we are going to run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C9CEsgU0vSoM9N12MT1Tjg.png" /></figure><p>Here we have defined variable ${Notepad} which contains a path to the programs .exe file.</p><p>Now let’s write our first automation step. Here we are using keyword Run that is used to run the file. You can run EXE, BAT, COM, or PIF files with this command. Also, remember to indent the text after test case name. Also after the keyword, there should be 4 whitespaces between arguments.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*30zA1muPlCWvTBwpEm_l3Q.png" /></figure><p>After this we can open the <strong>Run </strong>tab select our test case from left menu and press Start button. If everything went fine Notepad++ should open. Our Run tab should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qW43fY_AL-fX8cdQXQW5Fg.png" /></figure><p>Now we need to install AutoIt Window Info tool. If you didn’t download it at the beginning you can download it from <a href="https://www.autoitscript.com/site/autoit/downloads/">here</a>. With this tool we can inspect the elements of the application and use it to target the correct elements. Open the AutoIt Windows Info program. It should look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*qdO5CgprUPfOvLxVJifYNA.png" /></figure><p>If you want to target the Notepad++ window you have to click the icon under the Finder Tool and drag &amp; drop it to the window you want to inspect. Now as you can see I already did that on the screenshot. Now we can inspect the properties and values of the window. Let’s take the Title and use it in automation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uns8J1dlFQWFwXjVSYY__w.png" /></figure><p>Now we added two new keywords to our automation case.</p><p><strong>WinWaitActive </strong>this keyword waits until the window is active with title ‘new 1 — Notepad++’.</p><p><strong>Send </strong>this keyword inputs text to the currently selected element.</p><h3>Conclusion</h3><p>So we managed to write a simple desktop application automation case. This article was meant for starting point using Robot Framework with AutoItLibrary to write desktop application automation cases. There is also /doc folder under the robotframework-autoitlibrary-1.2.2.zip file where you can find more keywords. Also, you can find documentation from <a href="https://www.autoitscript.com/autoit3/docs/">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dc39193a0c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>