<?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: FePaiva</title>
    <description>The latest articles on DEV Community by FePaiva (@fepaiva).</description>
    <link>https://dev.to/fepaiva</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%2F768394%2F9509467f-c7d6-48c2-b2f2-cfdb9538feee.png</url>
      <title>DEV Community: FePaiva</title>
      <link>https://dev.to/fepaiva</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fepaiva"/>
    <language>en</language>
    <item>
      <title>Setbacks that push you forward. Learning Testing!</title>
      <dc:creator>FePaiva</dc:creator>
      <pubDate>Fri, 28 Oct 2022 18:09:35 +0000</pubDate>
      <link>https://dev.to/fepaiva/setbacks-that-push-you-forward-learning-testing-2na3</link>
      <guid>https://dev.to/fepaiva/setbacks-that-push-you-forward-learning-testing-2na3</guid>
      <description>&lt;p&gt;I consider myself someone who kinda enjoy stepping outside my comfort zone if it is for learning something new. &lt;/p&gt;

&lt;p&gt;  Giving you a few examples:&lt;/p&gt;

&lt;p&gt;1) If you are from a non-English speaking country, you must know English to get good jobs. Knowing English is considered basic skill nowadays for most of corporate jobs in Brazil. In my case, I decided to sell my motorbike and move to Australia for 1 year to learn English, back in 2004. So after finishing my first year in college, I quit my job and went to Sydney by myself. It was harsh!  &lt;/p&gt;

&lt;p&gt;2) In order to advance in my “old” career in HR (Global Mobility), I decided that an international career was essential. I started applying for any and all HR jobs in the US, Europe and Australia. I eventually got a job in the US, and here I am 10 years later writing this post. Second time moving to a foreign country without knowing anyone, but this time I could at least communicate with people from the start.&lt;/p&gt;

&lt;p&gt;3) Writing this post. I do have social media, but do not like posting / writing / sharing things to avoid self exposure. However, since I am transitioning careers and have been relying on the tech community so much lately, I decided to, some how, give it back by sharing things I am learning hoping to help someone else who might be in my shoes. I noticed that I get to practice what I learned while writing the post. Win win situation I guess. &lt;/p&gt;

&lt;p&gt;All of that to say that I faced many challenges and was able to overcome them (still working on #3) by stepping out of my comfort zone and growing with it.&lt;/p&gt;

&lt;p&gt;The latest setback for me is related to rejections I am getting from my job search. At the end of an interview with the hiring manager I always ask: “Is there anything that make you hesitant in considering me for this role, that we could address now?”. Most of the time the answer is no, but I end up not moving forward in the process.&lt;/p&gt;

&lt;p&gt;However, a couple of months ago &lt;strong&gt;I finally got a response!&lt;/strong&gt; The response was: “Yes. Based on our conversation, you do not know much about testing. Quality is very important to us, and our team constantly tests the products. I recommend you learning Jest, Unit testing and other ways of testing.”&lt;/p&gt;

&lt;p&gt;I took that serious, and today I want to share a bit of what I learned since that feedback.&lt;/p&gt;

&lt;p&gt;After some research and talking to QA Engineers, I decided to start with &lt;code&gt;Jest&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;So far, I find &lt;code&gt;Jest&lt;/code&gt; very straight forward and easy to understand as it provides an assertion library to validate functionality, and a test runner to execute the tests.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Getting started:&lt;/u&gt; &lt;br&gt;
Install the Jest package as a developer dependency. Run: &lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm install --save-dev jest&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To make sure it was installed, check your &lt;code&gt;package.json&lt;/code&gt; and see if &lt;code&gt;Jest&lt;/code&gt; is listed there under “devDependencies” (your version may be different).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VCskIe59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqimzypu7ff4z461in06.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VCskIe59--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fqimzypu7ff4z461in06.png" alt="json devDependencies" width="740" height="204"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;2) &lt;u&gt;Configuring Jest&lt;/u&gt;. Since you have &lt;code&gt;package.json&lt;/code&gt; open, set up the “test” script in the “scripts” property as follow:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oXiirK2n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57q81kq6ukjbmxv6qmit.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oXiirK2n--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/57q81kq6ukjbmxv6qmit.png" alt="json scripts" width="652" height="144"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;—coverage&lt;/code&gt; flag produce a report of which lines of code were tested, and the report is available in a directory named coverage/ that is created at runtime.&lt;/p&gt;

&lt;p&gt;3) &lt;u&gt;Create a file to write your tests&lt;/u&gt;. The Jest API looks for files that are either inside of a &lt;strong&gt;tests&lt;/strong&gt;/ directory, or a file that ends in &lt;code&gt;.test.js&lt;/code&gt; or &lt;code&gt;specs.js&lt;/code&gt; .&lt;/p&gt;

&lt;p&gt;To make it easy, match the name of the test file with the file you want to test.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Example: &lt;/u&gt;&lt;br&gt;
File I want to test: &lt;code&gt;language_spoken.js&lt;/code&gt;&lt;br&gt;
Test file: &lt;code&gt;language_spoken.test.js&lt;/code&gt;&lt;br&gt;
 &lt;br&gt;
4) &lt;u&gt;Writing tests&lt;/u&gt;. Before writing your tests in the test file, do not forget to import the methods you want to test from the other file.&lt;br&gt;
Example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rUfeDBrq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fm4vvovf5od1ssry0dd1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rUfeDBrq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fm4vvovf5od1ssry0dd1.png" alt="Import methods" width="786" height="480"&gt;&lt;/a&gt;&lt;br&gt;
Then, write the first test. Lets do it for the method &lt;code&gt;countryExtractor( )&lt;/code&gt; :&lt;/p&gt;

&lt;p&gt; In unit testing, each function should be tested in isolation, and we do that by creating separate containers for the test logic using the &lt;code&gt;test( )&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;The test function takes 3 arguments: A string describing what is being tested, a callback function containing assertions and other logics, and an optional timeout that specifies how long a test should wait before automatically aborting (defaults to 5000 ms if unspecified).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;countryExtractor( )&lt;/code&gt; should take an array of countries and their capitals, and convert it to an array of just the country names. So the &lt;code&gt;test( )&lt;/code&gt; should be something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_qdCxCL1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytf7gz5o94lrtz7jspwr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_qdCxCL1--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ytf7gz5o94lrtz7jspwr.png" alt="test" width="880" height="42"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, add the code required to setup the test. This is done in the &lt;u&gt;“Arrange”&lt;/u&gt; section of the test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zxz7aGag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzdkr9wonjhrptyft7x7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zxz7aGag--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jzdkr9wonjhrptyft7x7.png" alt="arrange section" width="880" height="304"&gt;&lt;/a&gt;&lt;br&gt;
Note that I am defining the inputedObejct array, and what the expectedValue should be as per the inputedObject. &lt;/p&gt;

&lt;p&gt;The arrange section holds the objects, mocks setup (if you are using one) and other things; and also potential result expectation.&lt;/p&gt;

&lt;p&gt;The next section in the test is the &lt;u&gt;“Act”&lt;/u&gt;. The Act should be focus on the thing to be tested, which could be calling a function or method, REST API or interacting with a web page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--txcGMSUr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf80gz49ljs7bof8e2cy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--txcGMSUr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lf80gz49ljs7bof8e2cy.png" alt="act" width="880" height="84"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case, we are testing the &lt;code&gt;countryExtractor( )&lt;/code&gt; passing the inputObject as argument.&lt;/p&gt;

&lt;p&gt;The last section is the &lt;u&gt;“Assert”&lt;/u&gt;. It is where we assert expected outcomes, indicating if the test passes or fails.  Here is where we use the &lt;a href="https://jestjs.io/docs/expect"&gt;Jest assertion library&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The idea is to write what the expected result should be considering what was provided in the previous sections of the test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rgPEQCQw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fu4g79p4qayheksv20j7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rgPEQCQw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fu4g79p4qayheksv20j7.png" alt="assertion" width="828" height="240"&gt;&lt;/a&gt;&lt;br&gt;
&lt;code&gt;.toEqual( )&lt;/code&gt; is used to perform deep equality checks between objects.&lt;br&gt;
&lt;code&gt;.toBe( )&lt;/code&gt; is used to compare primitive values.&lt;br&gt;
&lt;code&gt;.toContain( )&lt;/code&gt; is used to check if an item is in an array.&lt;br&gt;
&lt;code&gt;.toBeTruthy( )&lt;/code&gt; is used to verify if a value is truth or not.&lt;br&gt;
&lt;code&gt;.toBeDefined( )&lt;/code&gt; to verify if a variable is not undefined.&lt;/p&gt;

&lt;p&gt;You can check more examples in the &lt;a href="https://jestjs.io/docs/expect"&gt;Jest assertion library&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;5) &lt;u&gt;Run the test&lt;/u&gt;. &lt;br&gt;
To run the test you can type &lt;code&gt;npm test&lt;/code&gt; in your terminal.  Thanks to the &lt;code&gt;jest —coverage&lt;/code&gt; setup, we are able to see exactly what was tested.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--zoI2hwF8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4ho4dg7mgk0hsz9l5p0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zoI2hwF8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4ho4dg7mgk0hsz9l5p0.png" alt="test report" width="718" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Closing this post, I really appreciate the feedback I received from my job interview that pushed me to learn something new. Besides &lt;code&gt;Jest&lt;/code&gt;, I am also learning &lt;code&gt;Mocha&lt;/code&gt;, &lt;code&gt;Chai&lt;/code&gt; and &lt;code&gt;WebDriverIO&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Don't let Setbacks pull you down. Use that as an opportunity for Growth.&lt;/u&gt; &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>testing</category>
      <category>javascript</category>
      <category>qaengineer</category>
    </item>
    <item>
      <title>My XP with the bootcamp so far.</title>
      <dc:creator>FePaiva</dc:creator>
      <pubDate>Fri, 10 Dec 2021 20:08:06 +0000</pubDate>
      <link>https://dev.to/fepaiva/my-xp-with-the-bootcamp-so-far-27ek</link>
      <guid>https://dev.to/fepaiva/my-xp-with-the-bootcamp-so-far-27ek</guid>
      <description>&lt;p&gt;I am finishing up Phase 1 of the Software Engineer bootcamp at Flatiron, and today (12/10/2021) I watched presentations of final projects for the cohort that is graduating this week. While I was watching the presentations I started feeling some sort of anxiety and excitement thinking about my future projects, specially, my final project.&lt;/p&gt;

&lt;p&gt;But I am not going to talk about the project I worked on with my partner this past week, or give any hints about what I am thinking my final project will be. Today I am going to talk about how phase 1 was for me.&lt;/p&gt;

&lt;p&gt;Starting with the thing that most of us are afraid of, the Code Challenge. I knew there was going to be a code challenge at the end of the phase, but I did not know exactly how that was going to work, and how I was going to feel about it. When I finally got to it, I felt that I learnt a lot during the phase, but that wouldn’t be enough to pass the challenge. &lt;/p&gt;

&lt;p&gt;My code challenge name was “Flatagram”(you might have done the same one). I was very nervous reading through the explanation and checking what the deliverables were. Right from the start I knew I was able to complete some of the tasks easily, but would have to work hard to figure out the ones I was not so confident about. &lt;/p&gt;

&lt;p&gt;The easy tasks were to fetch the image received from the server, including its title, likes and comments when the page loads. The tasks that were more challenging for me to figure out were to make the “count likes” work properly, and append new comments to the page.&lt;/p&gt;

&lt;p&gt;Putting the technical part aside, one thing that bothered me during the challenge was that I had to keep sharing my screen the entire time. At the same time I understand the reasoning behind that, I felt like someone was spying on me.&lt;/p&gt;

&lt;p&gt;The other thing I want to mention here is my experience with the lectures so far. I will be honest with you. Some lectures I felt that I was following along and learning so much, but other I was completely lost. It may be different for each person, but I noticed that I was able to follow the lectures a bit better whenever I was able to complete the labs related to that specific lecture beforehand. Overall, the first week was the toughest to follow I guess because the amount of labs I had to finish in such a short time (my bootcamp started on ThanksGiving week, so we had 3 days to go over everything for that week). Things got better in the following weeks and I was able to follow along better.&lt;/p&gt;

&lt;p&gt;The last thing I will add here is related to time management. The bootcamp is very intense and time consuming, so I am having a hard time to combine personal with bootcamp life. Adding  more complexity to that, I moved from NY to LA 6 weeks ago, which makes my days start very early. Don’t get me wrong, I am not complaining here. I kind of like the way it is as I like to get things done early. &lt;/p&gt;

&lt;p&gt;My issue with the time management thing is that there is so much to learn that I feel like 24 hour days are not enough. Sometimes I caught myself spending hours trying to figure out something, or studying about a specific lab that I end up not giving the same amount of attention to other subjects that are equally important. &lt;/p&gt;

&lt;p&gt;That’s it for today’s post. I will keep you update as I make my brain more used to coding and move forward with the bootcamp.  &lt;/p&gt;

&lt;p&gt;Thanks for having me! &lt;/p&gt;

&lt;p&gt;  FePaiva&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>programming</category>
      <category>challenge</category>
      <category>braziliandevs</category>
    </item>
  </channel>
</rss>
