<?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 TeamAnyMind on Medium]]></title>
        <description><![CDATA[Stories by TeamAnyMind on Medium]]></description>
        <link>https://medium.com/@teamanymind?source=rss-defc94db7f34------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VVjAvSPLgey9uKOBfLMkYw.png</url>
            <title>Stories by TeamAnyMind on Medium</title>
            <link>https://medium.com/@teamanymind?source=rss-defc94db7f34------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 07:52:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@teamanymind/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[[Tech Blog] Factors on deciding what Test Management Tool to use]]></title>
            <link>https://medium.com/anymind-group/tech-blog-factors-on-deciding-what-test-management-tool-to-use-34006adc7a52?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/34006adc7a52</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Wed, 06 Oct 2021 08:30:56 GMT</pubDate>
            <atom:updated>2021-10-06T08:30:56.079Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*F5eQ2n8P_9Co3v8M-qlQhg.jpeg" /></figure><p>With the IT industry evolving/changing every single day, companies or projects, or teams are finding ways on how to keep up with the trend and not be outdated. In order to achieve that goal, aside from implementing new technology and increasing the automated processes involved, testing is also vital whether it’s manual or automated, or both.</p><p>With the right planned and organized testing involved, you can deliver features faster with higher quality and accommodate more of your user’s needs. One way to achieve that goal is by using test management tools. Hello, my name is Gerald, and I’m a QA engineer in AnyMind’s AnyManager team. I would like to share my experience and insights in using test management tools.</p><h3>What is a test management tool?</h3><p>Basically, they are tools that manage your testing from the moment the requirements are defined, to writing your test scenarios, to executing the test, until the time we deliver the finished feature or product to the users. Some of you may say, all of this can be done manually. But, for me personally, it’s an efficient way of handling your testing.</p><h3>Why use a test management tool?</h3><p>Every test management tool in the market has its pros and cons, but here are the things I’ve considered when my previous project offered me to use one:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*R7FgzoNy43IXB4hJ.jpg" /></figure><ol><li><strong>Traceability</strong></li><li>Another pro of using test management tools. Every resource from the Product Owner, Project Manager, Developers, and QAs in the project can view what tests were administered for that software development cycle.</li><li>If you can dive in deeper, everyone can actually see what are the test cases/scenarios involved in a user story, how many tests for those test cases/scenarios were executed. How many of the tests for that user story are passed, failed, or ongoing. This kind of information/data is vital on how to improving your testing moving forward.</li><li><strong>Hosting and pricing</strong></li><li>Of course, everything comes down to a price. Do you consider a tool that is cheaper but provides only a few features with limited hosting or a tool that is expensive that will provide you everything?</li><li>I’m not saying that we choose always the expensive one that provides everything. This decision should be a team and management agreement and the long-term effect of it has to be considered.</li></ol><h3>What are some of the test management tools I’ve considered and used?</h3><p>I’ve checked PractiTest, TestRail, TestLodge, QMetry &amp; Zephyr. But, taken all of the criteria I’ve set above, I’ve chosen QMetry for my previous project.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cs9uXSbO53w9Q3Bm.png" /></figure><h3>Final wrap</h3><p>I’m not saying that you should always consider there factors that I’ve listed and the tools I’ve used or considered and also let’s use the test management tools right away. At the end of the day, It is really an agreement with the management and the team with the pricing, the fit, and most importantly are we ready for it.</p><p>Hopefully, this blog can be insightful and be a big help.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15365/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34006adc7a52" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-factors-on-deciding-what-test-management-tool-to-use-34006adc7a52">[Tech Blog] Factors on deciding what Test Management Tool to use</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] How to recognize repetitive patterns and optimize them with React Hooks]]></title>
            <link>https://medium.com/anymind-group/tech-blog-how-to-recognize-repetitive-patterns-and-optimize-them-with-react-hooks-f22c68721c38?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/f22c68721c38</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Wed, 06 Oct 2021 08:30:17 GMT</pubDate>
            <atom:updated>2021-10-06T08:30:17.869Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1Brtydjhmn5o3yKq6pQDlA.jpeg" /></figure><p>Hi, my name is Pavel and I’m front-end developer at AnyMind ( <a href="https://anymindgroup.com/products/anytag/">AnyTag</a> &amp; <a href="https://anymindgroup.com/products/anycreator/">AnyCreator</a> platforms) and today I’d like to talk about how we are using <a href="https://reactjs.org/docs/hooks-intro.html">react hooks</a> to simplify our codebase, eliminate repetitive patterns and how you can recognize them.</p><p>Hi, my name is Pavel and I’m front-end developer at AnyMind ( <a href="https://anymindgroup.com/products/anytag/">AnyTag</a> &amp; <a href="https://anymindgroup.com/products/anycreator/">AnyCreator</a> platforms) and today I’d like to talk about how we are using <a href="https://reactjs.org/docs/hooks-intro.html">react hooks</a> to simplify our codebase, eliminate repetitive patterns and how you can recognize them.</p><p><em>“Can we reuse it?”</em> or <em>“You can refactor this as util function and reuse later”</em> — I believe everyone is well familiar with such code review comments, the reason for that is very simple — code reusability is one of the most important topics among software developers. The way we are implementing our components and how we are structuring our business logic is always the top of all priorities for every application development process. When we are thinking about the scalability of our codebases, reusability should be considered in the first place, with it implemented successfully we will get a better application: with less code and often more readable one.</p><p>Of course there is no silver bullet, especially when it comes to generalization of any sort, the point of view on this problem will vastly depend on the library(framework) being used or established practices, which data streaming paradigm is utilised: if it is bi-directional or uni-directional will end up of seeing different picture. The idea is to find the right balance between reusability and speed which suits you and your team, minimise the effort of implementation and provide some productivity boost, rather than looking for “the best solution possible” or trying to make every bit of code be able to fit all needs.</p><h3>closer to the matter</h3><p>On our platform, like on many others, users are interacting with a lot of Lists — visual data represented as a sequence of items, for example “posts list”, where you can scroll through and click on to get detailed information, in our case it will open a modal with details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dZWMRoMlhU2QZ5ub.png" /></figure><p>Of course, one can write such UI + logic every time if there is a need for it, but we don’t want that, we want <a href="https://en.wikipedia.org/wiki/Don%27t_repeat_yourself">DRY</a> and <a href="https://en.wikipedia.org/wiki/Separation_of_concerns">separation of concerns</a> by any means, so let’s try to abstract out business logic from the presentation level as well as recognize several repetitive patterns or shared functions among the possible use cases:</p><ul><li>Interaction Handlers (OnClick, OnEdit, OnDelete, etc.)</li><li>Local state (siblings ids, some group selection ids, some item attributes)</li><li>Utilities for accessing URL parameters (placing post_id into url is very common)</li><li>Navigation between items</li><li>Calculations (determine siblings, increment or decrement counters, apply filters)</li></ul><p>Using the Hook approach, we can define and incapsulate this logic in isolation and connect with UI we want later, start early and don’t overthink it — you can always add more customisation if needed (or remove if no use), but don’t put too much logic into one place due to possible readability and maintainability issues — better create more functions if business requirements grow and current function expanded.</p><pre>type SiblingIdType = number | null; interface ItemsType extends Record&lt;string, any&gt; { id: SiblingIdType; } const usePostDetailModal = (itemsArray: ItemsType[], paramName: string | undefined = &#39;postId&#39;) =&gt; { // access the URL parameters const { pathname, search } = useLocation(); const history = useHistory(); // local state const [openedPostId, setOpenedPostId] = useState&lt;SiblingIdType&gt;(null); const [siblingPostId, setSiblingPostId] = useState&lt;{ prevId: SiblingIdType; nextId: SiblingIdType }&gt;({ prevId: null, nextId: null }); // utilities for URL manipulation and siblings calculation const setQueryParams = (postId: SiblingIdType) =&gt; { const urlParams = getUrlParamsFromSearch(pathname, search, { [paramName]: postId }); history.replace(`${urlParams.pathname}${urlParams.search}`); }; const getSiblingPostId = (postId: SiblingIdType) =&gt; { if (itemsArray.length) { const currentIndex = itemsArray.findIndex(item =&gt; item.id === postId); const prevId = currentIndex === 0 || itemsArray.length &lt;= 1 ? null : itemsArray[currentIndex - 1].id; const nextId = postsData.length &gt; currentIndex + 1 ? postsData[currentIndex + 1].id : null; setSiblingPostId({ prevId, nextId }); } }; // handlers const handleClickPost = (id: number) =&gt; { setOpenedPostId(id); setQueryParams(id); getSiblingPostId(id); }; const handleClickNext = () =&gt; { getSiblingPostId(siblingPostId.nextId); setQueryParams(siblingPostId.nextId); setOpenedPostId(siblingPostId.nextId); }; const handleClickPrev = () =&gt; { getSiblingPostId(siblingPostId.prevId); setQueryParams(siblingPostId.prevId); setOpenedPostId(siblingPostId.prevId); }; const handleClosePostDetail = () =&gt; { setOpenedPostId(null); setQueryParams(null); }; return { // expose parameters and handlers you need ... }; };</pre><p>Then whenever you need to add such functionality to any Lists, simply call this hook, then provide items_array and paramName for URL if needed. Even if you have multiple instances on the page - there will be no issues with that 🎉</p><pre>const { openedPostIdOne, handleClickOne, ...restHandlers1 } = usePostDetailModal([🌝,🌕,🌚], &quot;url_param_1&quot;); const { openedPostIdTwo, handleClickTwo, ...restHandlers2 } = usePostDetailModal([📦,📦,📦], &quot;url_param_2&quot;); return ( &lt;&gt; &lt;ListOne&gt; ... &lt;Item onClick={handleClickOne}&gt; ... &lt;/ListOne&gt; &lt;ListTwo&gt; ... &lt;Item onClick={handleClickTwo}&gt; ... &lt;/ListTwo&gt; &lt;ModalOne title=&quot;Modal 1&quot; open={openedPostIdOne} {...restHandlers1}&gt; // content of Modal 1 &lt;/ModalOne&gt; &lt;ModalTwo title=&quot;Modal 2&quot; open={openedPostIdTwo} {...hrestHandlers2andlers2}&gt; // content of Modal 2 &lt;/ModalTwo&gt; &lt;/&gt; );</pre><p>Let’s take a look at another example: imagine you need to delete an item, but before you do — a confirmation window should appear to ensure this was intentional.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/545/0*vq_yXh6N317ZNPkR.png" /></figure><p>It sounds straightforward enough: implement the modal, provide handlers (trigger open|close, delete, to show success|fail message), keep some state(opened or closed, item id and name, loading state if needed) — as you can see that’s already a lot of boilerplate code and repetition, so we can apply Hooks approach here, for that first we can consider the logical part:</p><ul><li>Local state (id, loading, name)</li><li>Handlers to manage modal state and call mutation (onClose, onOpen, onDelete)</li></ul><p>We can stop here and already benefit from it, but if you think about the modal itself — it will be almost the same UI all over the place, with small text or title variations. Given this fact, let’s try to include a modal into the hook itself, so it will include:</p><ul><li>Local state (id, loading, name)</li><li>Handlers to manage modal state and call mutation (onClose, onOpen, onDelete)</li><li>Rendered modal</li></ul><p>Now we can put all the pieces together, just do not forget about <a href="https://en.wikipedia.org/wiki/Memoization">memoization</a> to be applied on UI returning from hook</p><pre>interface DeleteModalProps { handleDelete: () =&gt; void; dialogTitle?: string; } const useDeleteModalWithState = ({ handleDelete, dialogTitle = &#39;Are you sure you want to delete it?&#39; }: DeleteModalProps) =&gt; { const { t } = useTranslation(); const [deletingItem, setDeletingItem] = useState&lt;{ id: number; name: string; loading?: boolean }&gt;({ id: 0, name: &#39;&#39;, loading: false }); const handleClickDelete = (id: number, name: string) =&gt; { setDeletingItem({ name, id }); }; const handleCloseDialog = () =&gt; { setDeletingItem({ id: 0, name: &#39;&#39;, loading: false }); }; // we need to add memoization here to prevent the modal from unexpected re-renders const DeleteModal = useMemo( () =&gt; ( &lt;Dialog open={!!deletingItem.id} title={`${t(dialogTitle, { name: deletingItem.name })}?`} execute=&quot;Delete&quot; handleExecute={handleDelete} onClose={handleCloseDialog} loading={deletingItem.loading} disabled={deletingItem.loading} /&gt; ), // provide dependency array to help React understand when you need to re-render UI [deletingItem.id, deletingItem.name, deletingItem.loading] ); return { // expose DeleteModal, state and handlers needed ... }; };</pre><p>Then in order to use it, you just need to define the appropriate mutation and pass it to hook, the rest will be handled for you:</p><pre>const [deleteWithCaution] = useMutation(MY_MUTATION, { /* provide payload and handle error case */ }); const { DeleteModal, ...handlers } = useDeleteModalWithState({ handleDelete: deleteWithCaution, // any title or text that suits the current use case }); return ( &lt;&gt; ... &lt;Item onClick={() =&gt; handlers.handleClickDelete(itemId, itemName)} /&gt; {DeleteModal} ... &lt;/&gt; );</pre><h3>Conclusion:</h3><p>By implementing your application logic this way, you will not only help your team save some development time, but will also help you maintain consistency across similar features. If you want to reuse the same hook, you’ll have to consider keeping your data flow the same and compose components in a similar way. It will also help you shape your APIs and even predict some possible flaws due to previously implemented functions sharing similar approaches. Eventually your app will have distinctive recognisable patterns of data usage and UI composition which is just perfect for maintainability, possible architectural changes and overall nice to work with and reason about. I hope these simple practical examples and general ideas will help you make your own product better, thank you for reading.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15373/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f22c68721c38" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-how-to-recognize-repetitive-patterns-and-optimize-them-with-react-hooks-f22c68721c38">[Tech Blog] How to recognize repetitive patterns and optimize them with React Hooks</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] Recoil State Management for React]]></title>
            <link>https://medium.com/anymind-group/tech-blog-recoil-state-management-for-react-dd7d9218d172?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd7d9218d172</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 01:00:13 GMT</pubDate>
            <atom:updated>2021-10-05T01:00:13.531Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ndjo7zC0szDlZGg1G5M2cA.png" /></figure><p>Hi! I’m Chun Wei, front-end developer for the <a href="https://app.anytag.jp/">AnyTag</a> team. In this article, I would like to introduce you about <a href="https://recoiljs.org/">Recoil</a>, a state management library for <strong>React</strong>.</p><h3>What is state management</h3><p>State management is simply a way to engender communication and sharing of data across application. It creates a concreate data structure to represent your application state that you can read and write. In the simplest definition, state are the memory of the application. Since React 16.8, every React component, whether class or functional can have a state.</p><h3>Why Recoil</h3><p>There are so many state management library that can be used with React project, it can be quite challenge to decide which state management libaray to use for your project. Obviously <strong>Redux</strong> is one of the most popular React state management library as of the time. However it required a lot of boilerplate even in small application that don’t require a lot of global state management. On the other hand, <strong>React Context</strong> hook bring more simple configuration compare to Redux, but any change to the value prop causes the consumes Context component and it children to re-render.</p><p>In this case, <strong>Recoil</strong> play a good roles which simple configuration, it does not need to prop drill or set up context providers. Only the component that use the atom will be updated and optimizing renders to make your application fast.</p><h3>What make Recoil special</h3><p>Developers used to manage data with built in state management capabilities of React, but there are certain limitations of built in solutions such as:</p><ol><li>Context hook can store only one value and not an indetermine set of values.</li><li>The component state cannot be shared unless being pushed up to the common ancestor which might cause all the relevant subcomponents to re-render.</li><li>Both of these make it difficult to code split the top of the tree from the leaves of the tree.</li></ol><p>Recoil solves the limitation with its <strong>Atoms</strong> and <strong>Selectors</strong>. This approach come with:</p><ol><li><strong>Boilerplate free API, very easy to learn</strong>. Shared state has the same interface concept with React local state.</li><li><strong>Support concurrent mode</strong>. Compatibility with concurrent mode and other new React features.</li><li><strong>Code splitting</strong>. Distributed and incremental state definition which making code splitting possible.</li><li><strong>Easy state replacement</strong>. State can be replaced with derived data without having to modify the components.</li><li><strong>Async Support</strong>. Derived data can be synchronous or asynchronous wihout having modify the components.</li></ol><h3>Installation</h3><p>Recoil is a state management library for React. Before get started, you need to install React. To install recoil, we can use the follow command:</p><p>If you using <strong>npm</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vTcVCePOilkIqMm9.png" /></figure><p>Or if you’re using <strong>yarn</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HaR3ksJq6P42zn4g.png" /></figure><h3>RecoilRoot</h3><p>Components that use Recoil state need to wrap inside RecoilRoot. To appear somewhere in the parent tree, place it in root component as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*b_8sgFhwkddenbo4.png" /></figure><h3>Atoms</h3><p>Atoms represent a pieces of state. It can be updated and subcribed from any component. Updated of atom will allow all the subscribed components to re-render with a new value. You can create atoms by using the atom functions as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qz9WytrMOcAsWNRJ.png" /></figure><p>Components that need to read and write to an atom, need to use useRecoilState() hook as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9zEImtBAJp7rpmXn.png" /></figure><h3>Selector</h3><p>Selector represent a piece of derived state which can be defined as the output of passing state to a pure function that modifies the given state in some way. You can declare a selector as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mW2Hkyw51rAIkjYG.png" /></figure><p>To read the value of charCountState, we need to use useRecoilValue hook as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*asOhc5kRP8VPUYmq.png" /></figure><h3>Conclusion</h3><p>There is nothing wrong to choose with any type of state management library. Like everything else, Recoil is not ideal and has it own drawback. But what I like about Recoil is it easy to understand and simple configuration. It is true that Recoil is one of the great library that help you creating React application with more simpler and even more fun.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15336/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd7d9218d172" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-recoil-state-management-for-react-dd7d9218d172">[Tech Blog] Recoil State Management for React</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] Getting started Sentry setup with Spring Boot integration]]></title>
            <link>https://medium.com/anymind-group/tech-blog-getting-started-sentry-setup-with-spring-boot-integration-b61d209e38f4?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/b61d209e38f4</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:59:02 GMT</pubDate>
            <atom:updated>2021-10-05T00:59:02.420Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4C9FZDYLAlx3U2kdIiZTgg.png" /></figure><p>Greeting, I’m Wanchalerm Popee, a senior backend engineer of AnyTag/AnyCreator production team at AnyMind group. In this article, we’re going to set up Sentry integrated with Spring Boot, an application for monitoring and error tracking.</p><h3>Covering topics</h3><ul><li>What is Sentry?</li><li>Sentry Project Setup</li><li>Integrating Sentry with Spring Boot</li><li>Testing our first event</li><li>Grouping exceptions by application runtime environment</li><li>Capturing errors events only unhandled exceptions</li><li>Conclusion</li></ul><h3>What is Sentry?</h3><p>Sentry is the tool to monitor and track application error especially unhandled exception that may happen unintentionally. It automates the exception handling for every popular programming languages, and platforms, so it would be the best choice if you’re running the microservices and want to have centralized tracking tool in one place. To know more about Sentry, please visit the website <a href="https://www.sentry.io/">sentry.io</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*UbjOPfUKQZrSh4z1.png" /></figure><p>Supported Sentry platforms.</p><h3>Sentry Project Setup</h3><p>1.) Steps to create new Sentry account is very easy and straight forward. If you don’t have please register an account first <a href="https://sentry.io/signup/">here</a> .</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X9-GljWqlRQpZ-lq.png" /></figure><p>2.) Next is to create new project and choose the platform. In our case, let’s choose Spring Boot!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YMpa-SUFs5wOvwHB.png" /></figure><p>3.) Congratulations! Now everything is ready, and you will be able to see Sentry Dashboard like this!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IKh_ZVdkKnGn24Vc.png" /></figure><h3>Integrating Sentry with Spring Boot</h3><p>1.) Install Sentry SDK</p><p>First of all, we need to install Sentry SDK which will be used to capture data in our application’s runtime. We can simply install SDK dependency using Gradle.</p><pre>implementation &#39;io.sentry:sentry-spring-boot-starter:5.2.0&#39;</pre><p>2.) Make sure you define the sentry.dsn, which as know as <strong>Data Source Name</strong>, on application properties file ( src/main/application.yml), so our project can know where error reports should be logged to.</p><pre>sentry: dsn: <a href="https://examplePublicKey@o0.ingest.sentry.io/0">https://examplePublicKey@o0.ingest.sentry.io/0</a></pre><p>3.) Now we’re all set! Next let’s make our first event.</p><h3>Testing our first event</h3><p>1.) Before we start, I will create simple REST API to have unhandled IndexOutOfBoundsException unintentionally.</p><pre>package com.example.demosentry.controller import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RestController data class APIResponse(val ok: Boolean) @RestController class SampleController { @GetMapping(&quot;/unhandled/error&quot;) fun unhandledException(): APIResponse { // let create unhandled error exception val aList = listOf(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;) print(aList[5]) return APIResponse( ok = true ) } }</pre><p>2.) I will call my API and in the result, it should raise an exception. In meantime, the event will be passed to Sentry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QDqjfo5VfcHP1i7x.png" /></figure><p>3.) Open the Sentry dashboard and verify whether we have received the error message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gDN46IUUZbKMGHpv.png" /></figure><p>Finally! the error event has been captured! The best thing is, it’s showing the entire details together with the line number where an exception is happened.</p><h3>Grouping exceptions by application runtime environment</h3><p>It would be nice in the real world application if the exceptions can be grouped by runtime environment such as STAGING or PRODUCTION because it can help developer to easily filter the issues. Fortunately, Sentry provides this feature, and it’s very easy to set up within few seconds.</p><p>Basically, if you’re running application on multiple environments, you properly need to set active profile by passing SPRING_PROFILES_ACTIVE environment variable. In order to make it works, let&#39;s split application properties files for staging and production. Lastly, passing sentry.environment property like following will be required.</p><p>For STAGING /src/main/resources/application-staging.yml</p><pre>sentry: dsn: https://examplePublicKey@o0.ingest.sentry.io/0 environment: staging</pre><p>For PRODUCTION /src/main/resources/application-production.yml</p><pre>sentry: dsn: https://examplePublicKey@o0.ingest.sentry.io/0 environment: production</pre><p>Let’s open Sentry dashboard again and check what it looks like after the new events have been captured!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*VBGAoPYRwdi2Q5r1.png" /></figure><p>As you can see, that’s all of we need, Sentry automatically creates production and staging environment filtering for us. In my opinion as developer, this is a very useful feature because I can save my times to filter out the unwanted issues and efficiently focus on what I&#39;m looking for.</p><h3>Capturing errors events only unhandled exceptions</h3><p>Most of the time, the custom domain error may be needed for a specific application instead of regularly raising an internal server error even thought it’s handled error in our try-catch or validation. Alternatively, it can be considered as the business domain error. Those kinds of exception should not be caught and reported to Sentry because it’s not actual unexpected errors. Luckily, Sentry comes with an ability to catch only an exception’s certain type by implementing the SentryOptions.BeforeSendCallback bean.</p><p>In the next example, we will create an additional custom error called DomainException which is implementing RuntimeException. Apparently this is our business domain error which should not be reported to Sentry. Next step is, we need to implement SentryOptions.BeforeSendCallback to not catch an exception (return null) if DomainException has been raised from our runtime.</p><pre>package com.example.demosentry import io.sentry.SentryEvent import io.sentry.SentryOptions import org.springframework.stereotype.Component class DomainException(message:String): RuntimeException(message) @Component class SentryConfig : SentryOptions.BeforeSendCallback { override fun execute(event: SentryEvent, hint: Any?): SentryEvent? { if (event.throwable is DomainException) { return null } return event } }</pre><p>Also let’s add new REST API which have a handled exception properly.</p><pre>package com.example.demosentry.controller import com.example.demosentry.DomainException import org.springframework.web.bind.annotation.GetMapping import org.springframework.web.bind.annotation.RestController data class APIResponse(val ok: Boolean) @RestController class SampleController { @GetMapping(&quot;/unhandled/error&quot;) fun unhandledException(): APIResponse { // let create unhandled error exception val aList = listOf(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;) print(aList[5]) return APIResponse( ok = true ) } @GetMapping(&quot;/handled/error&quot;) fun handledException(): APIResponse { try { val aList = listOf(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;) print(aList[5]) } catch (e: Exception) { throw DomainException(&quot;there is something wrong but I know&quot;) } return APIResponse( ok = true ) } }</pre><p>Lastly, I will call my new API by Postman and open the Sentry dashboard UI to see what will happen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/0*4gms46_-3EcRhfVo.png" /></figure><p>At the result, we’re not be able to see the exception which was raised by DomainException and yeah! this is what we expected!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qugdWZzmGkDgUmSx.png" /></figure><h3>Conclusion</h3><p>Picking an application for monitoring and error tracking nowadays is very common in the real world because opening and checking log files line-by-line to find where is my error would be very painful especially the large-scale application. One of popular tool that we, AnyTag/AnyCreator team, chose is Sentry where developer can easily integrate with many programming languages, and platforms. Personally I’ve been using it a few years and feel very happy. Here are reasons.</p><ul><li>I can identify the error and solve it very quickly which is partially one of our company values, Move Faster.</li><li>Steps to setup are simple and Sentry doc is easy to read.</li><li>Pay on-demand if we exceed the quota of the plan. The less errors sent, the less we pay. Or in other words, the more we fix the error, the less we pay the cost. It sounds motivating you to fix error? 🙂</li></ul><p>Thank you for reading.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15285/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b61d209e38f4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-getting-started-sentry-setup-with-spring-boot-integration-b61d209e38f4">[Tech Blog] Getting started Sentry setup with Spring Boot integration</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] How to profile code in Python]]></title>
            <link>https://medium.com/anymind-group/tech-blog-how-to-profile-code-in-python-2ae488064771?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ae488064771</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:58:26 GMT</pubDate>
            <atom:updated>2021-10-05T00:58:26.750Z</atom:updated>
            <content:encoded><![CDATA[<p><em>This article mainly focus on Python and assumes you are already familiar with Python.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CVbBip9HeQlBZxDJqSyoOA.png" /></figure><h3>Why do we need Python Profilers?</h3><p>Nowadays, our program is getting more complex in term of both business and coding level which can contain even thousands of code lines. Finding out why the program is slow by looking at its source code is a time consuming task and not easy to do.</p><p>Moreover, when the program runs on cloud service which costs more money if the program spends more usage on computing resources.</p><p>That’s why code profiler has essential role to find bottlenecks and help to optimize our program performance.</p><p>Recently there are several ways to profile code, however in this post, we will be focusing on a basic method using a built-in profilers in Python which is <strong>CProfile</strong>.</p><h3>How to use Python cProfile?</h3><p><strong>cProfile</strong> is a built-in python module and is the most commonly used profiler currently, using it we can</p><ul><li>Get the total run time taken by the entire code.</li><li>Show the time taken by each individual step which allows to compare and find which parts need optimization.</li><li>Understand how many times certain functions are being called</li><li>View stats nicely using other library such as snakeviz</li></ul><p>Let’s look at the first simple example</p><pre>&gt; import cProfile &gt; cProfile.run(&quot;sorted([1, 2, 3])&quot;) 4 function calls in 0.000 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.000 0.000 &lt;string&gt;:1(&lt;module&gt;) 1 0.000 0.000 0.000 0.000 {built-in method builtins.exec} 1 0.000 0.000 0.000 0.000 {built-in method builtins.sorted} 1 0.000 0.000 0.000 0.000 {method &#39;disable&#39; of &#39;_lsprof.Profiler&#39; objects}</pre><ul><li><strong>ncalls</strong> is the number of calls made</li><li><strong>tottime</strong> is a total of the time spent in the given function</li><li><strong>percall</strong> refers to the quotient of tottime divided by ncalls</li><li><strong>cumtime</strong> is the cumulative time spent in this and all subfunctions</li><li><strong>filename:lineno(function)</strong> provides the respective data of each function</li></ul><p>There is no bottleneck for the example, let’s look at more interesting example below</p><pre>import random def sort_letters(number_letters=10**6): random_string = &#39;&#39; for i in range(number_letters): random_string += random.choice(&#39;abcdefghijklmnopqrstuvwxyz&#39;) return sorted(random_string)</pre><p>We can also call <strong>cProfile</strong> on the command line</p><pre>&gt; python -m cProfile profile_test.py 3000053 function calls in 1.041 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.000 0.000 __future__.py:48(&lt;module&gt;) 1 0.000 0.000 0.000 0.000 __future__.py:74(_Feature) 7 0.000 0.000 0.000 0.000 __future__.py:75(__init__) 6 0.000 0.000 0.000 0.000 hashlib.py:100(__get_openssl_constructor) 1 0.001 0.001 0.001 0.001 hashlib.py:56(&lt;module&gt;) 1 0.003 0.003 1.041 1.041 profile_test.py:1(&lt;module&gt;) 1 0.289 0.289 1.034 1.034 profile_test.py:3(sort_letters) 1 0.000 0.000 0.001 0.001 random.py:100(seed) 1000000 0.455 0.000 0.562 0.000 random.py:275(choice) 1 0.002 0.002 0.004 0.004 random.py:40(&lt;module&gt;) ...</pre><p>By looking at the output, it looks like the choice function from random module takes lot of time, we can start optimizing it from this code</p><h3>How to visualize cProfile reports?</h3><p>The common tool for visualizing data obtained by cProfile module is SnakeViz, let explore how to use it</p><p>Firstly, we can export the output of <strong>cProfile</strong> in to the dump file</p><pre>python -m cProfile -o stats.dump profile_test.py</pre><p>Next step</p><pre>snakeviz stats.dump</pre><h3>Start optimizing previous code</h3><p>From previous example, we know that random.choice function is slowing us down, it&#39;s time to replace it with other similar function</p><pre>from numpy import random def sort_letters(number_letters=10**6): letters = tuple(&#39;abcdefghijklmnopqrstuvwxyz&#39;) random_letters = random.choice(letters, number_letters) random_letters.sort() return random_letters.tostring()</pre><p>Now our program runs much more faster than before</p><h3>Conclusion</h3><p>Apart from <strong>cProfile</strong>, there are some other python module to support profiling code, but <strong>cProfile</strong> includes most of its features and is recommended to use. Stay tuned for similar topic, for example server-side profiler</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15280/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ae488064771" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-how-to-profile-code-in-python-2ae488064771">[Tech Blog] How to profile code in Python</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] Introduction to NX and Monorepos]]></title>
            <link>https://medium.com/anymind-group/tech-blog-introduction-to-nx-and-monorepos-cb920398eccf?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb920398eccf</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:57:52 GMT</pubDate>
            <atom:updated>2021-10-05T00:57:52.797Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZWj4YKpkb8EVas07kZeBGQ.png" /></figure><p>Welcome to my blog post, this is Giacomini Federico. I work as a Front-end Developer for the <a href="https://anymindgroup.com/products/anylogi/">AnyLogi</a> team. Today I would like to introduce you to <a href="https://nx.dev/">Nx</a>, a “Smart, Extensible Build Framework” for building your Web Applications.</p><p><strong>This post will go through the following points :</strong></p><ol><li>A Quick introduction to Nx and Monorepos</li><li>Why did we choose Nx for AnyLogi</li><li>Create a simple Nx Monorepo</li><li>Conclusion</li></ol><p><strong>1. A Quick introduction to Nx and Monorepos</strong></p><p>Nx is a framework that allows you to architect, test, and build your project at any scale with the most popular modern Front-end frameworks like React and Angular, and Back-end ones like NestJs or Express. To make this possible, Nx comes shipped with a large tool set that simplify your Monorepo management. If you are unfamiliar with Monorepo, it is basically a version-controlled code repository that holds many projects and libraries. The Monorepo approach has several benefits over a common one. Here are a few:</p><ul><li><strong>Shared code</strong> — It is already possible with properly fragmented repositories to share common logic across the whole company, organization or project. Monorepo makes it even easier to improve the DRY(ness) of your code as we can not just reuse common patterns, components, and types across different front end libraries but between Front-end and Back-end as well.</li><li><strong>Atomic changes</strong> — When making changes that would affect other projects/libraries, (like an API definition), all those changes can be applied and tracked on a single branch/commit, without having to track down all dependent projects and additional coordination efforts necessary.</li><li><strong>Standardization</strong> — It is easier to standardize code and tooling across the teams. You can impose branch policies to keep your main branch clean, limit access to specific branches, enforce naming guidelines, include code reviewers, and enforce best practices while sharing the same linter and prettier configurations on multiple projects and libraries in your repository.</li><li><strong>Release management</strong> — You can handle all your release pipeline once without having to setup over complicated deployment sequences across repositories using a clear and defined flow that every team can follow and avoiding the deployment knowledge within each team.</li><li><strong>Easier refactoring and dependencies</strong> — Direct access to all micro-services makes refactoring the code in a Monorepo and changing the overall code structure much quicker than moving code between repositories. By updating the dependencies on the same repository it is easier to avoid version conflicts between libraries.</li></ul><p>But why use Nx, and not just create a simple angular or react workspace ? What sets Nx apart is the very large tool set that it brings to the table, helping you across all the facets of building your Monorepo. Here are some of the useful feature of Nx :</p><ul><li><strong>Cached and Custom Operations</strong> — Nx will allow you to define and cache operations avoiding the same code to be built multiple times. When making changes to a library, you can automatically execute operations (like building, testing, linting…) on affected projects, greatly reducing build times or pipeline executions.</li><li><strong>Cross framework components</strong> — Another great feature coming with Nx is the possibility to build micro Front-ends and share the same component across React and Angular applications. You will code your component logic once, and use it as is in your project. Additionally, all projects and libraries will be created with testing tools like Cypress, Storybook and Jest.</li><li><strong>Easy to manage dependencies</strong> — Nx also extends some eslint rules to allow you to carefully decouple and isolate your library and dependencies. With the tags system and dependencies tree, you can enforce the dependencies flow you like across your projects/libraries and Nx will help you find circular dependencies or dependencies that make no sense (for example a library depending on a project). To have a quick glimpse of your project structure, you can generate a dependencies graph of the workspace.</li><li><strong>A Configurable CLI</strong> — Nx comes with a robust CLI that can be configured to work with different tools and even different languages providing commands to operate and manage all the chunks of your codebase. For example, If you are familiar with angular CLI, Nx will extend those commands to make them work with the whole NX Monorepo.</li><li><strong>Metadata-driven</strong> — Everything in Nx comes with metadata to enable tool-ability. The default values, validations, auto-completion, and other settings are all defined in a schema, instead of in code. You can also use the <a href="https://marketplace.visualstudio.com/items?itemName=nrwl.angular-console">Nx Editor Plugin</a> and change his configuration with those files.</li></ul><p><strong>2. Why did we choose Nx for AnyLogi</strong></p><p>Anylogi is a Logistics Management Platform connecting brands with WMSs, warehouses, and delivery companies around the world. The Front end is built in Angular, with a NestJs application serving as gateway to our Back-end. Since the application requires connection to multiple WMS with different guidelines and requirements, we decided to make the logic decoupled as much as possible. This would also come handy since our app consists of a variety of user types with different permissions and functionality.</p><p>In previous projects I worked on, the basic approach to handle such cases was to create an Angular directive hiding, or showing some UI elements, with conditions in code for calling or not some API. But such an approach makes scalability very difficult. The more User Roles added, the more conditions and logic was added to the FE making it hard to maintain and test the multiple cases. Another issue we faced was when creating customized user roles functionality and experiences. In some case we wanted error message for the admins to be more detailed than for users. In other we would show advanced steps or fields for admins while simplify the same process to users. All those changes would add additional conditions and fragment our application in parts that were not working together in harmony.</p><p>With Anylogi we decided to follow the Monorepo approach. Instead of having a single project with a hard to grasp logic and conditions all over the place, or multiple repositories that would need to work as one, we built a single Monorepo with Nx to handle our various projects and libraries. It makes thing quicker and easier when sharing common logic, modules, and features across our workspace, while maintaining the ability to easily customize the experience of a specific user type.</p><p>We created 3 projects based on our user roles requirements, and desired experience. We separated some common component used in those 3 projects (like the headers, logins pages etc..) in UI libraries that are used across all projects. Finally, We separated our feature logic in various feature libraries, that way, it would be simple to add or remove functionality when needed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PYqDLBZYex9ewBj2.png" /></figure><p>Thanks to Nx cached operations, we can modify a single Front-end app and deploy it independently of the others, or modify a library, rebuild the dependencies and deploy only that library affected apps.</p><p>One thing we missed and might add later is the addition of our NestJS gateway to this mono repository. Right now, our Back-end Gateway is existing on a different repository, which create some code duplication but it would work all the same if not better if we added it in our Monorepo.</p><p><strong>3. Create A Simple Nx Monorepo</strong></p><p>In this last part, we will create a simple Nx Monorepo with a project depending on a library. We are going to use angular, but you are free to set up React or View. Be sure to replace by what you want the content between bracket { }</p><p>Let’s start by creating our workspace</p><pre>npx create-nx-workspace@latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/997/0*oi76d7J1RpphowvX.png" /></figure><p>You will have to chose the name of the workspace, what to create in it, and additional option based on what you selected. I just chose angular for this example, but you free to add what you want, or add additional project/library later on. You will also be prompted to use Nx Cloud, I will not go over it in this blog, but you can find more information on the Nx website <a href="https://nx.app/">Nx Cloud</a></p><p>You can test the project by navigating in the workspace and launch the project (those names are the one you set previously) :</p><pre>cd ./{workspaceName}/ npx nx serve {applicationName}</pre><p>you should see on http://localhost:4200/ the default Nx start page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*lq-qby4AgbIYloAb.png" /></figure><p>Let’s now add a library :</p><pre>npx nx g @nrwl/angular:lib {libraryName}</pre><p>This will generate a new folder under libs named like your library, and will contain the code defining your library. By default, this will result in an angular module named like the library. But Nx will also add additional configuration in your workspace, the most important part beeing the following.</p><p>If you go to the tsconfig.base.ts at the root of the project, you will see a new line added that should look like (with the name you selected) :</p><pre>&quot;paths&quot;: { &quot;@{applicationName}/{libraryName}&quot;: [&quot;libs/{libraryName}/src/index.ts&quot;] }</pre><p>This absolute import path points to your library definition. Anything exported in this file will be sharable across your workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ATMUggsvg_JmhAhQ.png" /></figure><p>For Nx to work correctly, and your project to be clean, <strong>ANYTHING</strong> that you want to export from the library should be present in this file. Additionally, <strong>EVERY</strong> project that use this library must <strong>ONLY</strong> import and use what is defined in this file.</p><p>Let’s add a component to this library. We will use the Nx CLI to generate the boilerplate the same way Angular CLI does it. I usually use <a href="https://bradfrost.com/blog/post/atomic-web-design/">Atomic Design</a> to organize my components, but for the sake of simplicity, let’s just add it in root of the library.</p><pre>cd ./libs/{libraryName}/src/lib/ npx nx g @nrwl/angular:component {componentName}</pre><p>Voila ! We have create a component the same way we usually do and it is already declared in the library module. Let’s just add some code to this component and add it on the top of the Nx demo page. I will create a simple text header.</p><pre>&lt;div class=&quot;topnav&quot;&gt; Library Header &lt;/div&gt;</pre><p>in the .css (or whatever per-processor you chose)</p><pre>.topnav { background-color: rgb(94, 94, 255); overflow: hidden; width: 100%; }</pre><p>Double check if the component is correctly added to the library module using the name you previously chosed for your library and component. In my case it looks like this :</p><pre>`@NgModule({ imports: [CommonModule], exports: [HeaderComponent], declarations: [HeaderComponent], }) export class SharedUiModule {}`</pre><p>index.ts export * from &#39;./lib/shared-ui.module&#39;;</p><p>Check also that the module is exported in the library entry point (index.ts). If yes, let’s import our library in our main project.</p><p>Navigate to the AppModule of our application and import our library module by using the <strong>ABSOLUTE PATH</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JJQRtgRpSietZhTE.png" /></figure><p>Now simply add our component in our project app.component.html and you should see it appear :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nXzeJxgrNfcnVVcJ.png" /></figure><p>You can now also use</p><pre>npx nx dep-graph</pre><p>to generate the simple dependency graph of our project :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wlvTVMMshwXix7mM.png" /></figure><p>You can find this very simple Monorepo here <a href="https://github.com/Crocsx/nx-demo">https://github.com/Crocsx/nx-demo</a></p><p><strong>4. Conclusion</strong></p><p>There is a lot more you can set up on NX to make your project easier to manage and we only scratched the surface. I hope this short blog post give you enough information to understand the basics and the possible applications of such tool for your future project. I hope to go more in detail in future blog post and showcase many more functionality. Until then, have a great one !</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15219/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb920398eccf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-introduction-to-nx-and-monorepos-cb920398eccf">[Tech Blog] Introduction to NX and Monorepos</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] How to automate using UIlicious]]></title>
            <link>https://medium.com/anymind-group/tech-blog-how-to-automate-using-uilicious-3ce77cc77420?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ce77cc77420</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:57:20 GMT</pubDate>
            <atom:updated>2021-10-05T00:57:20.737Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U_W8eU-QagKwL86VmjLISQ.png" /></figure><p>Hi! I am Alyssa Andrea, QA Engineer of the engineering department at Anymind Group.</p><p>I’ve been a manual functional tester for 5 years. Unparalleled in my abilities to find those crazy bugs and the only happy (not sure about devs) on the team to find them. I like doing regression testing of a whole project although I run into problems doing the same job every time. So, I’ve looked for a tool that will help reduce the repetition of the work. It’s called <a href="https://uilicious.com/">UIlicious</a>.</p><p>Oh cool Automation!</p><p>The questions are: <strong>Do I know how to code? No</strong>. But this tool doesn’t need you to know the complexity of programming languages which most QAs are afraid of “ <strong>coding</strong> “.</p><p><strong>Would you</strong> repetitively click multiple times and fill in different fields when creating new users when doing regression testing or make a script and click once and do something else?</p><p>I think this is where automation would help us. Let me show the basics:</p><p>To begin with, UIlicious runs from Javascript underneath. Let me guide you through a simple login functionality using UIlicious:</p><p>A sample cool project called <a href="https://app.any-factory.com/">AnyFactory</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GY6TxjfM5CNKQGfA.png" /></figure><p>A sample script where the user can login:</p><pre>// Given that user is in the login page I.goTo(&quot;https://crazydeveloplinkhere.com/&quot;); I.fill(&quot;Email&quot;, &quot;myprivateworkemail.com&quot;); I.fill(&quot;Password&quot;, &quot;somebasicpass123&quot;); I.click(&quot;Log in&quot;);</pre><p>Let’s get complicated and note that it can be a powerful tool too <strong>if you can code</strong>: In this scenario, let’s create a function where an admin user logs in and creates another user.</p><p>Creating cool functions:</p><ul><li>Set up variables so the user doesn’t have to input email and password everytime</li><li>Added function LOGIN that we will call in different test cases</li></ul><p><strong>Login Function 1.1</strong> (login_as_admin)</p><pre>// Login function as admin // Your variable here LOGIN = { userLogin fuction() { // Given that user is in the login page I.goTo(&quot;https://crazydeveloplinkhere.com/&quot;); I.fill(&quot;Email&quot;, &quot;myprivateworkemail.com&quot;); I.fill(&quot;Password&quot;, &quot;somebasicpass123&quot;); I.click(&quot;Log in&quot;); } }</pre><p>How to call <strong>Login Function 1.1</strong> First, we have to import the function here:</p><pre>// For importing function TEST.run(&quot;Functions/login_as_admin&quot;)</pre><p>Second, call the function login:</p><pre>// For importing function TEST.run(&quot;Functions/login_as_admin&quot;) // Login as admin LOGIN.userLogin()</pre><p>Third, add the script where the admin user can add another user: This would be the way the user navigates to the User module and creates a new user.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5cJeDFF5sJvi7nNf.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kXSpPEo9YbagK4ab.png" /></figure><p>In these images, we create a script that will navigate users from the user list and create a new user:</p><pre>// Creating User I.goTo(&quot;https://staging.app.any-factory.com/users&quot;); I.must.see(&quot;+ Add User&quot;); // Validation if button text translation is showing correctly I.click(&quot;+ Add User&quot;); // Clicking the button</pre><p>User module list sample script</p><pre>// Fill user field and create new admin user I.select(&quot;Admin&quot;); I.fill(&quot;First Name&quot;, &quot;New&quot;); I.fill(&quot;Last Name&quot;, &quot;User&quot;); I.fill(&quot;Email&quot;, &quot;newuser@sample.com&quot;); I.click(&quot;Country&quot;); I.click(&quot;Thailand&quot;); I.click(&quot;Create&quot;);</pre><p>Creating new User sample script</p><p><strong>To be honest, for me</strong> automation and manual testing has its own pros and cons. Here are some:</p><p><strong>Automated Pros:</strong></p><ul><li>Can help find more bugs</li><li>It can increase speed and accurate testing in regards with results</li><li>Processes are recorded and allows to reuse and perform the test/s in daily basis</li></ul><p><strong>Automated Cons:</strong></p><ul><li>Difficult to check the UI colors, sizes, fonts and button sizes.</li><li>Test maintenance and tools might be expensive and increase the cost of the project.</li><li>It has limitations which lessens the scope of automation.</li></ul><p><strong>Manual Pros:</strong></p><ul><li>Can get fast and precise feedback in terms of UI</li><li>Less expensive</li><li>Not time consuming compare to automation that requires coding</li></ul><p><strong>Manual Cons:</strong></p><ul><li>More open to errors where tester can missed</li><li>It cannot be re-use. Tester can only track by defect or project management tools</li><li>Requires more time</li></ul><p>It also depends on the product/project you are working on. The latter, the UI always changes to that means we also have to change/update the script we made and test it manually.</p><p>From the examples above, I may not be an expert but I think doing some simple scripts and exploring the different automation tools would make our QA lives easier, better and more productive. To add, UIlicious is not the only tool that can help us. We have selenium, katalon and many more.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15213/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ce77cc77420" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-how-to-automate-using-uilicious-3ce77cc77420">[Tech Blog] How to automate using UIlicious</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] Should we use Angular Route Resolver?]]></title>
            <link>https://medium.com/anymind-group/tech-blog-should-we-use-angular-route-resolver-72b9efeb7f8?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/72b9efeb7f8</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:56:49 GMT</pubDate>
            <atom:updated>2021-10-05T00:56:49.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*ftBzr5QzUiEauU-9nlQSqg.png" /></figure><p>When developing an application with Angular, we are basically fetching data from the API with the ngOnInit hook, and then rendering it to the UI. While waiting for the api to return the complete data, the component renders the loading, skeleton. etc</p><p>We still have another way to get the data first and then redirect your component. It’s call Route Resolver.</p><p>In this article, I will share with you what is Route Resolver is and how to use it and apply it in a real-life case, should we use it or not.</p><h3>So what is Angular Resolver?</h3><p>Angular Route Resolver is used for pre-fetching some of the data when the user is navigating from one route to another. It can be defined as a smooth approach for enhancing user experience by loading data before the user navigates to a particular component.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/0*ONwLN3FRTvnXjnHx.png" /></figure><p>Example simple flow how Resolver work</p><h3>1. How to create simple Resolver</h3><p>One simple Resolver to get detail of Site:</p><pre>@Injectable({ providedIn: &#39;root&#39;, }) export class SiteSettingResolver implements Resolve&lt;any&gt; { constructor(private siteService: SiteService, private router: Router) { } handleError(error) { this.router.navigateByUrl(&#39;/404&#39;); return throwError(error); } resolve( route: ActivatedRouteSnapshot, state: RouterStateSnapshot ): Observable&lt;{ site: Site }&gt; { const siteID = route.paramMap.get(&#39;id&#39;); if (!siteID) { setTimeout(() =&gt; { this.router.navigate([&#39;/404&#39;]); }, 500); } else { return this.siteService.detail(siteID).pipe( map(resp =&gt; { return {site: resp as Site}; }), catchError(err =&gt; this.handleError(err)) ); } } }</pre><p>Next we are config router for Site Setting Module:</p><pre>{ path: &#39;site-settings&#39;, component: SiteSettingsComponent, resolve: { preFetchData: SiteSettingResolver } }</pre><p>This is Site Setting Component show us how to get data from Resolver:</p><pre>constructor(private activatedRoute: ActivatedRoute) {} get site(): Site { return this.activatedRoute.snapshot.data.preFetchData.site; }</pre><p>Now imagine an HTTP request response data in 5 seconds. After clicking a link in the application, the HTTP request starts. Routing will not be completed before that HTTP request responds with data. Therefore, if HTTP takes 5 seconds, it will also take 5 seconds for routing to complete.</p><h3>2. What if we don’t use Resolver</h3><p>So how about the usual way (Fetch the detail data of the Site in the ngOnInit hook in the component without using the resolver)?</p><p>This time. The navigation will run right through the site details page without a hitch. Furthermore, our component should add a loading indicator, skeleton loading, etc for user experience purposes.</p><p>This is example one component I don’t use Resolver. I added loading so that the user knows and waits for the data to load.</p><pre>ngOnInit(): void { this.loading.show(); this.siteService.detailSiteWeb(siteId) .subscribe((resp: Site) =&gt; { this.loading.hide(); this.site = resp; }, err =&gt; { this.router.navigateByUrl(&#39;/404&#39;); }); }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/522/0*QQS7WJX_Yek6nOOs.png" /></figure><p>Example simple flow when we don’t use Resolver</p><h3>3. Conclusion</h3><p>So with this article we can understand about how Resolver work. In my opinion any Application should be run fast and the data should load asynchronously at runtime. So we may need to consider carefully before using Resolver.</p><p>In current project I’m working on which is AnyManager I’m not using much Resolver. I&#39;m just use a resolver when I want to fetch data even before the user is directed to the URL. The resolver can include service calls that will give us the data needed to load the next page.</p><p>Here’s what we may need to keep in mind when deciding to use Resolvers:</p><ul><li>If the Resolver is not resolved, you will not be able to see your component rendered. So if you use Observable, and Observable may never complete then you won’t be able to navigate to the page.</li><li>Do not share between multiple resolvers together.</li></ul><p>Therefore, for streams that return multiple values, you should not use resolvers.<br> In my opinion, we should only use Resolver to get part of the data, then the component will continue to execute other connections.</p><h3>Ref:</h3><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15141/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72b9efeb7f8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-should-we-use-angular-route-resolver-72b9efeb7f8">[Tech Blog] Should we use Angular Route Resolver?</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] React vs. NextJS — Front-end frameworks compared]]></title>
            <link>https://medium.com/anymind-group/tech-blog-react-vs-nextjs-front-end-frameworks-compared-83ffefb700c8?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/83ffefb700c8</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:56:20 GMT</pubDate>
            <atom:updated>2021-10-05T00:56:20.039Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Tech Blog] React vs. NextJS — Front-end frameworks compared</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nEHOs4VYexnir__i.png" /></figure><p>Hello, my name is Youssef, I am a front-end developer in AnyMind’s AnyFactory team and in this blog I’d like to discuss the differences between working with React.js and Next.js. Both of which we use here at AnyMind. React has been around since 2013 and was developed internally at Facebook. Next.js’ initial release was in 2016 as an open source project. Perhaps calling both of them a front-end framework is a bit of a misnomer. React.js is more of a javascript library and Next.js is more of a React based development framework. A bit like comparing a knife and a toolbox perhaps? Maybe comparing Next.js to Create-React-App app comes a bit closer. CRA is a React scaffolding app that hides the dependencies and configurations from the developer so that they can speed up the development process without worrying about things like bundling, development servers and autoprefixing. Next.js is more of a development framework based on React and built on top of Node.js. Let’s dive a bit deeper into the differences.</p><h3>Create-react-app (☆ 90.2k)</h3><p>As mentioned, CRA hides the configuration from the user so they can get to developing faster! The downside of this is that there is no straightforward way to make a change in the configuration. You have to be satisfied with what you get out of the box. There is a solution called ejecting, which basically just unpacks all the configuration files that were hidden for you. It defeats the purpose of using CRA over plain React and this action is not reversible so this is a last resort option.</p><p>CRA was developed with fast bootstrapping in mind and out of the box it does not support things like server-side-rendering. Everything you make with CRA is client-side rendering only. Meaning, the website that is built using CRA does not contain all the content on build time. When you load the website up is when the framework will go out to look for the content and put all the HTML elements in their place. Conversely, server-side rendered apps have their content already finalized on the server before it reaches the client. This is very helpful when creating SEO reliant websites because the search engine crawlers have an easier time indexing site content that was already available due to the server side rendering.</p><p>Defining routes for your CRA application can be done by installing a routing library ( react-router) and making use of their API. The routing library has been around for a while, it&#39;s API is mature and fairly flexible. The nice thing about this library is that it easy to reason about. No complicated setup necessary and the documentation is clear.</p><p>For deployment, CRA is pretty straightforward, it defines a yarn build command to let you make a build of your code which you can then take to whatever server you like and have it point to the build&#39;s index.html file for example. The easiest way to deploy according to the CRA documentation is to install Vercel&#39;s serve npm package and have it serve your CRA build. The only caveat is when you make use of client-side routing. If, for example, you want to support having your user navigate to /product/41/edit and make use of the react-router package you will run into issues if you make use of a static file server. This will require some server configuration that you can read about <a href="https://create-react-app.dev/docs/deployment/">here</a>.</p><h3>Next.js (☆ 73.2k)</h3><p>Owned and maintained by Vercel, Next.js has very quickly gained in popularity. The reason Next.js became so popular so fast is that it facilitated server-side rendering (SSR) for developers and built upon an already well-known JS library (React). When developing e-commerce websites or other customer facing websites you want your data to be available to the user quickly and to be indexable by search engine crawlers and Next.js helps you do just that.</p><p>Besides SSR, if your use case is to have static content, like a blog, Next.js helps you write that too. You write your pages and code as normal and then at build time the framework creates HTML pages for you, that you can then deploy. This is called static site generation (SSG). Because these two techniques give users the possibility to prebuild the content on the pages, sites created with Next.js are very fast! First paints time difference between CRA and Next.js can be as big as 87%<a href="https://blog.logrocket.com/next-js-vs-create-react-app/">¹</a>.</p><p>Next.js has a file-system based router built on the concept of pages. This means that Next.js adds a pages directory for you in the project structure and files contained therein will define what you’re routing will become. For example the file: pages/blog/first-post.jswill have the this route: /blog/first-post. The downside of using Next.js is that it is not flexible in terms of using other routing approaches. You will have to work with what it gives you.</p><p>For deploying, Vercel has a recommended way of deploying your Next.js project by registering with them and making use of their hosting, but you can basically host anywhere that can run a Node.js server. When you run yarn build, the framework will build and optimize your files and create a .next/ folder that contains the files you need to deploy on a Node server. Running yarn start on your production server, with the right environment variables will then set-up your site for you and you&#39;re good to go.</p><p>If you <strong>don’t</strong> want to run your site on a Node.js server you can also ‘ next export &#39; your Next.js project into HTML files, which can then be run stand-alone, anywhere you want. With this export option you can do basically the same thing as when you deploy on Node.js server, however the Next.js documentation states that:</p><p>next export is intended for scenarios where <strong>none</strong> of your pages have server-side or incremental data requirements (though statically-rendered pages can still <a href="https://nextjs.org/docs/basic-features/data-fetching#fetching-data-on-the-client-side">fetch data on the client side</a>).</p><p>In other words, you lose some of the benefits of deploying on a Node.js server like Incremental Static Generation and Regeneration and there are some <a href="https://nextjs.org/docs/advanced-features/static-html-export#caveats">other caveats</a>. Essentially the recommendation is to just deploy onto a Node.js server unless you have a very specific use case as to not deploy onto there.</p><h3>How we use CRA &amp; Next.js at AnyFactory</h3><p>The first project we started on in AnyFactory is the <a href="https://any-factory.com/">AnyFactory Platform</a>. A cloud manufacturing platform that enables the design and creation of products. The idea is that brands can register with us to develop their products on our platform and have manufacturing and distribution handled by us. On the other hand, manufacturing parties can register with us to be matched with manufacturing orders and establish trust with potential customers.</p><p>Because this is a ‘gated’ application, meaning the user needs to log in to access our platform, there is no real need for us to invest in SEO compliant techniques or frameworks. Search engine crawlers will not be able to bypass our login screen. Important for us was to get a proof-of-concept up and running as quickly as possible. For this reason we built the AnyFactory Platform app with the Create-React-App utility and continued development from there.</p><p>More recently we launched <a href="https://popbox.space/">PopBox, an e-commerce site</a> where content creators can sell their merchandise and apparel with their own branding. Contrary to the AnyFactory platform, this site needs good discoverability so it is important to have a good SEO compliant website. A lot of the shopping on PopBox is done via mobile so the content needs to load fast. Next.js comes with pre-rendered html and less JS than a CRA app so our page speeds benefit from this. Our data is coming from a Shopify store and we deploy our project using Google Cloud. At the moment we are looking at ways to deliver content to our app even faster, but perhaps that will be discussed on our blog here at a later time.</p><h3>Summary</h3><p>If you are (still?) reading this and wondering which framework should you use for your project; let’s summarize what we discussed:</p><ul><li>Bootstrap something quickly without worrying about configurations and build servers? CRA!</li><li>E-commerce or other non-gated app that needs good SEO? Next.js!</li><li>Flexibility of choosing your own routing mechanism? CRA!</li><li>Speed? Performance? Next.js!</li><li>Wanting to come work with us at AnyFactory? Both!</li></ul><p>I hope, with this, I have been able to give you some insight into which framework you should use in which situation. Hit me up at: youssef at anymindgroup.com if you have any questions, complaints or just want to say hi. For now, I hope it was beneficial, thank you for reading! 👋</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15138/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83ffefb700c8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-react-vs-nextjs-front-end-frameworks-compared-83ffefb700c8">[Tech Blog] React vs. NextJS — Front-end frameworks compared</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tech Blog] Test-Pyramid]]></title>
            <link>https://medium.com/anymind-group/tech-blog-test-pyramid-31b683bc57bf?source=rss-defc94db7f34------2</link>
            <guid isPermaLink="false">https://medium.com/p/31b683bc57bf</guid>
            <dc:creator><![CDATA[TeamAnyMind]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 00:55:54 GMT</pubDate>
            <atom:updated>2021-10-05T00:55:54.990Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*joXE4p2RyvpgoXZrkcsViA.png" /></figure><p>Hi, I’m Minh Khoi, a front-end developer at AnyMind Group. In this article, I’m going to introduce to you what is a test pyramid in a software product, and to be more specific: a front-end project.</p><h3>The problem in software testing</h3><p>In my experience, automation tests provide the facility to record/run a series of interactions with the application and check the expected result or just simply input and output of a function. Those tests work well initially. It’s easy to write, execute but costly to maintain especially in an early stage or in a fast-growing project.</p><p>Some argue that testing is costly, redundant in a(n) early birth/fast-growing project. Because an enhancement to the system or a requirement change can easily end up breaking lots of such tests and it will slow down development progress, and you should focus more on manual testing, hire a good QA team instead of writing a bunch of automation tests.</p><p>And even in a released application, testing is costly when it comes to refactoring, optimizing the old code. Each change could lead to series of fail tests.</p><p>So I agree with that, testing is costly but it’s not redundant and in my humble opinion, a good developer should able to write a testable code and should test their code before send it to the QA. This is why the Pyramid in testing is good to know when we develop an application.</p><h3>The Pyramid in testing</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/0*xeWF83poQVkdUDm9.png" /></figure><blockquote><em>The test pyramid is a way of thinking about how different kinds of (automated) tests should be used to create a balanced portfolio. Its essential point is that you should have many more low-level UnitTests than high level BroadStackTests running through a GUI.</em></blockquote><p>The test pyramid consists of three layers that your test suite should consist of (bottom to top):</p><ol><li>Unit tests</li><li>Service/Integration tests.</li><li>User Interface tests.</li></ol><ul><li>Unit tests are low-level testing, the term ‘low-level’ means they approach the lowest scope of your code (e.g: a condition, loop, function, class). This is the foundation of your test system because unit tests make sure that a certain unit of your codebase works as intended. And the number of unit tests will and it should be largely outnumber any other type of test.</li><li>Your application will likely interact with some other parts (databases, filesystems, http calls). The interact part needs be tested and Integration Tests are there to help. You could mock and stub all collaborators with your application or allow taking real connection to test it. The goal of an integration test is to ensure that your integrated system functions as expected. So it is nice to have some tests that taking real connection of all components in your system altogether. But if you just want to test the connection of some specific part of your system, you could try to take a real connection of that part and mock the rest for a faster test.</li><li>UI tests or E2E tests is the closest with the real user interaction on your web application. User input should trigger the right actions, data should be presented to the user, the UI state should change as expected. This is the highest level of automation testing. By using a tool or framework, E2E test tell the browser what to do, click, type and then expect the behavior of application base on the action. It is good to have full coverage with unit and integration tests. However, users can face unexpected behaviors when they run an application in the browser — E2E tests are the perfect solution for that.</li></ul><p><em>Note: </em>Modern web applications using single page application frameworks (React, Vue, Angular) often come with their own tools and helpers that allow you to perform the interaction between components in your application and with the collaborators in a pretty low-level manner. Therefore the line between unit test and integration test is kind of blur nowadays. Even with vanilla javascript, you can use tools like Jasmine, Mocha, or my favorite of all — Jest to test your application both unit tests and integration tests.</p><p>Base on the pyramid, you could easily spot some important things from it.</p><ul><li>1: The more high-level you get, the fewer tests you should have.</li><li>Because of the higher level you get, the cost to write, run in the pipeline, and maintain is more expensive.</li><li>Low-level tests tend to run faster because they dont require a full DOM tree to run and easy to maintain because these test is small.</li><li>2: Write tests with different levels of detail.</li><li>You should focus on unit tests, write lots of small and fast unit test to cover all branches of the condition statement, input and output of function, etc.</li><li>Write some more integration tests to make sure your application behave correctly.</li><li>Write few high-level tests that test your application from end-to-end.</li><li>Watch out that you don’t end up with a massive test suite on integration and E2E that will be a nightmare to maintain and takes way too long to run.</li><li>3: Even we could bring up all the applications and connections from end-to-end to test. But we can not test all the styles or whether UI is matched with the design. That is why the high-level test should focus on the important scenarios.</li></ul><p><em>Note: </em>In my experience, if you get a failure in a high-level test, this likely means you have a bug in your functional code, which also means you have a missing or incorrect unit test. Therefore, after fixing that bug, you should replicate the bug with a unit test and a unit test will ensure the bug will be found if it ever happens again.</p><h3>Wrapping things up</h3><p>That’s it! I hope that there’s something useful in this article. Now go ahead and prioritize testing in your application’s test cycle. This is will pay off some days.</p><p>And remember: Eliminate bugs will save your company’s reputation.</p><p><em>Originally published at </em><a href="https://anymindgroup.com/news/tech-blog/15053/"><em>https://anymindgroup.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31b683bc57bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/anymind-group/tech-blog-test-pyramid-31b683bc57bf">[Tech Blog] Test-Pyramid</a> was originally published in <a href="https://medium.com/anymind-group">AnyMind Group</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>