Skip to content

D365FO Unit Testing Performance Degradation After Import-D365Bacpac (T2 Bacpac) #901

@jpiquot

Description

@jpiquot

Description

After importing a T2 bacpac using Import-D365Bacpac, D365FO unit tests take approximately 3 minutes longer to execute compared to a fresh Cloud Platform VM environment.

Environment

  • Environment: Cloud Platform VM (LCS)
  • Database: GOLDEN T2 bacpac imported via Import-D365Bacpac
  • Test Framework: D365FO unit testing framework

Steps to Reproduce

  1. Create a new Cloud Platform VM from LCS (10.0.45)
  2. Create a new D365FO project with the default test class
  3. Run the unit tests
    • Result: Tests complete in approximately 45 seconds
  4. Refresh the VM database with a GOLDEN T2 bacpac using Import-D365Bacpac
  5. Run the same unit tests (that do nothing else than assert an error) again
    • Result: Tests now take 3 minutes and 45 seconds to complete

Expected Behavior

Unit tests should maintain similar execution times (~45 seconds) after importing a bacpac, comparable to a fresh environment.

Actual Behavior

Unit tests take 3 minutes longer (3m 45s total) after bacpac import, representing an 8x performance degradation.

Analysis

The 3-minute delay suggests a potential SQL connection timeout issue:

  • The default SQL timeout is typically 3 minutes
  • This points to possible connection configuration problems with the restored database
  • The tests may be attempting to connect and waiting for timeout before proceeding

Question

Is there a specific configuration that needs to be changed after using Import-D365Bacpac to avoid this performance issue?

Possible areas to investigate:

  • SQL connection strings
  • Database compatibility settings
  • User permissions or login configurations
  • Query Store or execution plan cache
  • Database statistics or indexing

Additional Context

This issue is reproducible and consistent across multiple bacpac imports from T2 environments.

// Prefer the name of the class or area being tested with the Test suffix.
// The test class must transitively extend the SysTestCase class.
// You can find more information here: https://docs.microsoft.com/en-us/dynamicsax-2012/developer/unit-test-framework
public class DummyIntTest extends SysTestCase
{

    // Test methods must be public, take no parameters and return void.
    // Their names can start with test, or they can be adorned with the SysTestMethod attribute.
    [SysTestMethod, Hookable(false)]
    public void MyTest()
    {
        // Use the assert* functions to check the outcomes.
        this.assertNotNull(null);
    }

    // This is a test method because of the test prefix.
    [Hookable(false)]
    public void testSomething()
    {
        this.assertTrue(false);
    }

    public void setup()
    {
        // This method will be called before every test method.
        super();
    }

    public void tearDown()
    {
        // This method will be called after each test method
        super();
    }

    public void setupTestCase()
    {
        // This method is run before any test method
        super();
    }

    public void teardownTestCase()
    {
        // This method is run post all test methods.
        super();
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions