{"id":1892,"date":"2024-12-30T12:37:12","date_gmt":"2024-12-30T04:37:12","guid":{"rendered":"https:\/\/www.tonghin.com.my\/blog\/?p=1892"},"modified":"2024-12-30T12:37:14","modified_gmt":"2024-12-30T04:37:14","slug":"internship-week-11-schema-optimisation-and-testing-enhancements","status":"publish","type":"post","link":"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/","title":{"rendered":"Internship (Week 11): Schema optimisation and testing enhancements"},"content":{"rendered":"\n<p>From the first day, Mr. Peter pushed an updated version to fix the configuration error. He also assisted me in modifying the testing environment to make it more understandable and efficient. This included improving the controller naming to reduce confusion. In addition, based on our last discussion, I redesign the schema to reduce the number of objects for better efficiency. I rename the item details for clarity and soon update the relevant transfer services and initialised test data. Then, I proceed to conduct transfer tests for the all the processes, as well as initialised more transfer and item data. I also updated the item configuration to ensure unique data for each record so that I could proceed with my tests. Meanwhile, Mr. Peter mentioned that transfers would occur only in MongoDB, without SQL database involvement. As a result, I remove all references by excluding the &#8220;Mongo&#8221; naming of transfers. He also pointed out that the initialisation for stores and items should not happen multiple times. Furthermore, Mr. Peter suggested adding error tests to account for missing item required in specific parts.<\/p>\n\n\n\n<p>Besides that, I continue working on transfer order tests as well by adding more possible error tests. I also implement public static methods for initialising store data. After that, I continue on completing the logic for creating and canceling transfer DO. Soon, Mr. Peter reviewed my tests, he then found out that there are some item data referenced with many tests which cannot be ignored. Mr. Peter stated that each item data should only be used for one test. He then suggested if this intialised data make confusion, it is better to separate the controller test with different part. He also recommended that error messages should not be hardcoded but should be added to the ErrorMessage class instead. Additionally, he advised moving the transfer files from the &#8220;Orders&#8221; folder to the &#8220;Transfers&#8221; folder for better maintainability. Mr. Peter highlighted that using barcodes to identify specific line items is unacceptable since the orders might have duplicate item orders. So, I decided to use the &#8220;No&#8221; attribute for uniqueness. Mr. Peter also suggested creating tests for failure scenarios when I have free time. Mr. Peter also emphasized that on every error tests, there will be no updates occur on the collections where proper assertions are necessary. <\/p>\n\n\n\n<p>Moreover, I focus on hardcoding the transfer order error messages and updating the assertion tests for throwing errors. Once all the tests passed successfully, I then continue on the transfer DO by updating its service and restructure the transaction logic for both transfer order and DO. Next, I begin working on transfer DO tests by referring to the transfer order tests. I initially initialising data with another transfer DO data and I start the tests for the create command. Later, Mr. Peter mentioned that using &#8220;No&#8221; for the line item could be risky and recommended using the ObjectId for each LineItem instead. He then reviewed the line item schema and suggested moving it into its own transfer file. Mr. Peter also reviewed my logic and pointed out confusion in handling multiple exception catches. He advised changing exceptions from Exception to InvalidOperationException or removing additional exceptions entirely for clarity. <\/p>\n\n\n\n<p>Apart from that, I replaced the &#8220;No&#8221; input with LineItemId in commands, services and tests. To ensure that the ObjectId data could pass tests, I request my friend to send me the relevant ObjectIdConverter file and updated the startup to support serialisation settings. After successfully completing the transfer order tests by adding another throw error tests for LineItemId, I continue on creating the error messages for transfer DO and add them to error assertion tests as well. Once the create tests were successful, I move on to the cancel tests. Mr. Peter reviewed my transfer work and suggested amendments to the transfer schema for better maintainability by reducing the number of objects. He questioned why data instances were used instead of utilising the TestFactory class, so I update the implementation. During the discussion, the offsets should be handled during transfer receive and I understand role of transfer receive. I then pushed my changes to my branch, and the suggestions and additional requirements from Mr. Peter will be addressed next week.<\/p>\n\n\n\n<h4>Conclusion<\/h4>\n\n\n\n<p>Overall, I feel a deep sense of growth and accomplishment as I tackle complex technical challenges. The journey has been enriching and fulfilling, motivating me to continually strive to improve while appreciating the value of teamwork and mentorship.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>From the first day, Mr. Peter pushed an updated version to fix the configuration error. He also assisted me in modifying the testing environment to make it more understandable and efficient. This included improving the controller naming to reduce confusion. In addition, based on our last discussion, I redesign the schema to reduce the number &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Internship (Week 11): Schema optimisation and testing enhancements&#8221;<\/span><\/a><\/p>\n","protected":false},"author":15,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Internship (Week 11): Schema optimisation and testing enhancements |<\/title>\n<meta name=\"description\" content=\"The journey has been enriching and fulfilling, motivating me to continually strive to improve while appreciating the value of teamwork and mentorship.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Internship (Week 11): Schema optimisation and testing enhancements |\" \/>\n<meta property=\"og:description\" content=\"The journey has been enriching and fulfilling, motivating me to continually strive to improve while appreciating the value of teamwork and mentorship.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\" \/>\n<meta property=\"og:site_name\" content=\"Tong Hin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-12-30T04:37:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-12-30T04:37:14+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"4 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\",\"name\":\"TONG HIN MACHINERY\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/channel\/UC60EoxJMNbu8mV0LuEGfrBg\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/wp-content\/uploads\/2020\/10\/web_logo_180_180.jpg\",\"width\":180,\"height\":180,\"caption\":\"TONG HIN MACHINERY\"},\"image\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Tong Hin&#039;s Blog\",\"description\":\"Sharing About Technology\",\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.tonghin.com.my\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#webpage\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\",\"name\":\"Internship (Week 11): Schema optimisation and testing enhancements |\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\"},\"datePublished\":\"2024-12-30T04:37:12+00:00\",\"dateModified\":\"2024-12-30T04:37:14+00:00\",\"description\":\"The journey has been enriching and fulfilling, motivating me to continually strive to improve while appreciating the value of teamwork and mentorship.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/\",\"name\":\"Internship (Week 11): Schema optimisation and testing enhancements\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/fb4d75677cd7632e197b8b04dd488c68\"},\"headline\":\"Internship (Week 11): Schema optimisation and testing enhancements\",\"datePublished\":\"2024-12-30T04:37:12+00:00\",\"dateModified\":\"2024-12-30T04:37:14+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/12\/30\/internship-week-11-schema-optimisation-and-testing-enhancements\/#webpage\"},\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"articleSection\":\"Experiential\",\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/fb4d75677cd7632e197b8b04dd488c68\",\"name\":\"Lee Wai Lun\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/ddc37519924feb741e1cc09e5393f95c?s=96&d=mm&r=g\",\"caption\":\"Lee Wai Lun\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1892"}],"collection":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/comments?post=1892"}],"version-history":[{"count":16,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions"}],"predecessor-version":[{"id":1921,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1892\/revisions\/1921"}],"wp:attachment":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/media?parent=1892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/categories?post=1892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/tags?post=1892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}