🖌️
Product Process Documentation
  • Product Process Documentation
  • Definition of Done (DoD)
    • General checkpoints
      • Specific checkpoints by team
    • Important process: QA review & PO review
      • QA Review
      • PO Review
  • Work Items
    • Product Backlog Item (PBI)
    • Bug
      • Basic rules for creating a bug
      • How to report a Bug
    • Bugs Management
  • Code Standards
  • Different Test Levels
    • Unit Test
      • Frontend Unit Testing
        • What is a Unit Test?
        • How do I know if I am developing a good unit test?
        • AAA (Arrange, Act and Assert)
        • Overloaded test suits
        • Setup & Teardown
          • JEST Mocks
          • FakeTimers
        • Istanbul Annotations
        • C8 Annotations
        • JEST Runner (Debug unit tests with Jest)
    • Component Test
      • Frontend Component Testing
        • What is Component Testing?
        • Best practices
        • Bad practices
        • Setup
          • Sandbox
          • Mocks, Services and Providers
          • Test scenario
    • Integration Test
      • Frontend Integration Testing
        • What is a Integration Test?
        • AAA (Arrange, Act and Assert)
        • Best Practices
        • Bad practices
        • Setup & Teardown
        • How to create a scenario
          • Create the migrated app
          • Add to project
        • How to debug
        • Common problems
      • Testing Driven Development Guide and recommendations
    • Functional Test
    • Security Testing
      • Security Testing Tools
      • Frontend Security Testing
    • Performance testing
    • Best Practices
    • Test Documentation
  • Run test projects
    • General steps
    • Specific steps by team
  • DevOps
    • Pipelines
    • Builds
    • Specific information by team
    • Test plan
    • Service Hooks for Azure DevOps Notifications
      • Slack Notifications
      • Microsoft Teams Notifications
  • Dashboards
    • General
    • QA Dashboards
  • Release Process
    • General Steps
    • Specific steps by team
  • Migration Cells
    • Basics of testing process
  • Release process
  • References
Powered by GitBook
On this page
  • Example following the standards
  • Notes

Was this helpful?

  1. Different Test Levels

Unit Test

PreviousDifferent Test LevelsNextFrontend Unit Testing

Last updated 3 years ago

Was this helpful?

Unit testing is one of the most important levels of test because check the code at the lowest level. This meaning that each line of code should be tested at this level. This level normally is the responsibility of the developer and always when a new code will be added in any project must exist unit tests associated.

Additionally, this level of test helps with the concept called code coverage, this concept is a measure to describe the degree to which the source code has been tested. The coverage could be of different levels for example statement coverage, decision coverage, branch coverage, etc. (See ).

Related to the standards to follow in WebMap it is possible to mention the next ones:

  • Any project related to unit testing must use Behavior-Driven-Development (BDD) to take advantage of the benefits of this methodology. (See ).

  • Related to the last point, the tool to use must be the library of the Quality Mate team called Mobilize.QualityMate.BDD.

  • It is important to try to maintain update Mobilize.QualityMate.BDD in the last stable version

  • The level of coverage should accomplish the concept of branch coverage, this must be checked using the build after merging any change.

  • Always is necessarily follow the good practices to write unit testing. (See ).

  • Follow the basic good practices to create any test case. (See ).

  • Document the test case using the basic tags and summaries. (See )

Example following the standards

// <copyright file="UnitTestExample.cs" company="Mobilize.Net">
//        Copyright (C) Mobilize.Net info@mobilize.net - All Rights Reserved
//
//        This file is part of the Mobilize Frameworks, which is
//        proprietary and confidential.
//
//        NOTICE:  All information contained herein is, and remains
//        the property of Mobilize.Net Corporation.
//        The intellectual and technical concepts contained herein are
//        proprietary to Mobilize.Net Corporation and may be covered
//        by U.S. Patents, and are protected by trade secret or copyright law.
//        Dissemination of this information or reproduction of this material
//        is strictly forbidden unless prior written permission is obtained
//        from Mobilize.Net Corporation.
// </copyright>

namespace Mobilize.UnitTest.Example
{
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using Mobilize.QualityMate.BDD;
    using Mobilize.QualityMate.BDD.Annotations;

    [TestClass]
    [Feature("Description of the feature to test")]
    public class UnitTestExample : Feature
    {
        /// <summary>
        /// Document in a better way the scenario to test.
        /// <seealso href="https://theLinkOfTheTestCaseInAzureDevOps"/>
        /// </summary>
        [TestCategory("Unit Testing")]
        [Scenario("Describe an example to follow the standars")]
        public void ADescriptiveNameRelatedWithTheScenarioToTest()
        {
            this.RunScenario(     
                given => this.FirstStep(),
                when => this.SecondStep(),
                then => this.ThirdStep());
        }

        /// <summary>
        /// Document each method if it is necessary
        /// </summary>
        private void FirstStep()
        {
            // Setup or init the aspects or context to use in the test
        }

        private void SecondStep()
        {
            // Some event occurs or something change
        }

        private void ThirdStep()
        {
            // Ensure some outcomes
            Assert.IsTrue(true);
        }
    }
}

Notes

  • It is valid to add any other NuGet or dependency in the project depending on the necessity.

  • Many teams create a base class with the common steps or configurations in order to use in the other classes to the unit tests.

Good practices
Test Documentation
Reference about code coverage
References about BDD
Good practices to write unit testing