Skip to main content
T280

Testing Business Logic

View:
2025R14 lessons

T280: Testing Business Logic

Version: 2025R1
Category: Technical

How to Use This Course

The T280 Testing Business Logic with the Acumatica Unit Test Framework training course teaches you how you can create unit tests for extension libraries that are used in customization projects. This course is intended for application developers who customize Acumatica ERP. It explains how to complement the program code with unit tests that ensure the correctness of the program code even aer it is changed or enhanced. The course is based on a set of examples that demonstrate the general approach to creating unit tests for extension libraries developed for Acumatica ERP. The extension library used in this course is the one you developed in the training courses of the T series (which you should take before completing the current course). In this course, you will create one unit test for each graph or graph extension created for the T200 Maintenance Forms, T210 Customized Forms and Master-Detail Relationship, and T220 Data Entry and Setup Forms training courses. Aer you complete all the lessons of the course, you will be familiar with some features of Acumatica Unit Test Framework.

         We recommend that you complete the examples in the order in which they are provided in the course,
         because some examples use the results of previous ones.

What the Course Prerequisites Are

To complete this course, you should be familiar with the basic concepts of Acumatica Framework and Acumatica Customization Platform. We recommend that you complete the T200 Maintenance Forms, T210 Customized Forms and Master-Detail Relationship, and T220 Data Entry and Setup Forms training courses before you begin this course. To complete the course successfully, you should have the following required knowledge:

  • Proficiency with C#, including but not limited to the following features of the language:
  • Class structure
  • OOP (inheritance, interfaces, and polymorphism)
  • Usage and creation of attributes
  • Generics
  • Delegates, anonymous methods, and lambda expressions
  • Knowledge of the following main concepts of ASP.NET and web development:
  • Application states
  • The debugging of ASP.NET applications by using Visual Studio
  • The process of attaching to IIS by using Visual Studio debugging tools
  • Client- and server-side development
  • The structure of web forms
  • Experience with SQL Server, including doing the following:
  • Writing and debugging complex SQL queries (WHERE clauses, aggregates, and subqueries)
  • Understanding the database structure (primary keys, data types, and denormalization)
  • The following experience with IIS:
  • The configuration and deployment of ASP.NET websites
  • The configuration and securing of IIS How to Use This Course | 5

What Is in a Lesson

Each lesson consists of the concepts you are learning and the activities you are going to complete to learn these concepts.

Where the Source Code Is

You can find the source code of the customization described in this course and code snippets for the course in the UnitTesting\T280 folder of the Help-and-Training-Examples repository in Acumatica GitHub.

What the Documentation Resources Are

The complete Acumatica ERP and Acumatica Framework documentation is available at https://help.acumatica.com/ and is included in the Acumatica ERP instance. While viewing any form used in the course, you can click the Open Help button in the top pane of the Acumatica ERP screen to bring up a form-specific Help menu; you can use the links on this menu to quickly access form-related information and activities and to open a reference topic with detailed descriptions of the form elements.

Which License You Should Use

For the educational purposes of this course, you use Acumatica ERP under the trial license, which does not require activation and provides all available features. For the production use of the Acumatica ERP functionality, an administrator has to activate the license the organization has purchased. Each particular feature may be subject to additional licensing; please consult the Acumatica ERP licensing policy for details. Company Story and Mission Description | 6

Company Story and Mission Description

This topic describes the company story and explains the scope of this course.

Company Story

The Smart Fix company specializes in repairing cell phones of several types. The company provides the following services:

  • Battery replacement: This service is provided on customer request and does not require any preliminary diagnostic checks.
  • Repair of liquid damage: This service requires a preliminary diagnostic check and a prepayment.
  • Screen repair: This service is provided on customer request and does not require any preliminary diagnostic checks. To manage the list of devices serviced by the company and the list of services the company provides, two custom maintenance forms, Repair Services (RS201000) and Serviced Devices (RS202000), have been added to the company's Acumatica ERP instance. Another custom maintenance form, Services and Prices (RS203000), gives users the ability to define and maintain the price for each provided repair service. Also, the Stock Items (IN202500) form of Acumatica ERP has been customized to give users the ability to mark particular stock items as repair items —that is, the items (such as replacement screens and batteries) that are supplied to the customer as part of the repair services. The Repair Work Orders (RS301000) custom data entry form is used to create and manage work orders for repairs. On the Repair Work Order Preferences (RS101000) custom setup form, an administrative user specifies the company's preferences for the repair work orders.

Mission Description

To keep the business logic consistent, you need to develop unit tests for the developed forms. Adding these unit tests to the customization library will ensure that the implemented behavior will persist even if changes are made later to the customization library. Initial Configuration | 7

Initial Configuration

You need to perform the prerequisite actions before you start to complete the course.

To Deploy an Instance for the Training Course

The following activity will walk you through the process of preparing and deploying an Acumatica ERP instance that you can use to perform the steps in the lessons of this training course.

Story

To create any unit tests provided in the training course, you need to deploy an instance of Acumatica ERP by using the Acumatica ERP Configuration Wizard.

Process Overview

You will prepare the environment—that is, install the soware that you need to use Acumatica ERP and to configure this soware. Then you will deploy an Acumatica ERP instance with the data for the T280 Testing Business Logic with the Acumatica Unit Test Framework course.

Step 1: Preparing the Environment

          If you have completed any of the training courses of the T series and are using the same environment
          for the current course, you can skip this step.

Before you begin deploying the needed Acumatica ERP instance, do the following:

  1. Make sure that the environment that you are going to use conforms to the System Requirements for the Acumatica ERP Installation.
  2. Make sure that the Web Server (IIS) features that are listed in Configuration of IIS Web Server Features are turned on.
  3. Install the Acuminator extension for Visual Studio.
  4. Install Acumatica ERP. On the Main Soware Configuration page of the Acumatica ERP Setup wizard, select the Install Acumatica ERP and Install Debugger Tools check boxes.
                   If you have already installed Acumatica ERP without debugger tools, you should remove
                   Acumatica ERP and install it again with the Install Debugger Tools check box selected. The
                   reinstallation of Acumatica ERP does not affect existing Acumatica ERP instances. You can
                   also install the Acumatica ERP Tools separately. For details, see Acumatica ERP Installation On-
                   Premises: To Install the Acumatica ERP Tools (Optional).
    

Step 2: Deploying an Acumatica ERP Instance with the Code of the Customization Project To deploy an Acumatica ERP instance and configure it, do the following:

  1. Open the Acumatica ERP Configuration wizard, and do the following: a. Click Deploy a New Acumatica ERP Instance for T-Series Developer Courses. b. On the Instance Configuration page, do the following: Initial Configuration | 8
    a. In the Training Course box, select T280 Testing Business Logic with the Acumatica Unit Test Framework. b. In the Local Path to the Instance box, select a folder that is outside of the C:\Program Files (x86), C:\Program Files, and C:\Users folders. (We recommend that you store the website folder outside of these folders to avoid an issue with permission to work in these folders when you customize the website.) c. On the Database Configuration page, make sure the name of the database is SmartFix_T280. The system creates a new Acumatica ERP instance, adds a new tenant, loads the data to it, and publishes the customization project that is needed for this training course.
  2. Make sure that a Visual Studio solution is available in the App_Data\Projects\PhoneRepairShop folder of the Acumatica ERP instance folder.

This is the solution of the extension library that you will modify in the activities of this training course. Lesson 1: Creating a Test Project and a Test Class | 9

Course Structure