web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Suggested Answer

Can TestRunner Be Run Only in Sandbox and/or Automatically on Extension Publish?

(0) ShareShare
ReportReport
Posted on by 56
Hi everyone,
 
I’m currently learning and trying to deepen my understanding of working with TestRunner codeunits in Business Central, and I have two related questions:
 
1. Is it possible to automatically run a TestRunner codeunit every time an extension is published to a sandbox environment?
   Ideally, I’d like the TestRunner to execute immediately after publishing.
 
2. Can this behavior be restricted to sandbox environments only?
    I want to ensure that the TestRunner runs in sandbox environments but does not execute when the extension is published to production.
 
I’ve looked into triggers like 'OnInstallAppPerCompany', but I’m unsure if this is the recommended approach or if there are better patterns (especially for environment-specific execution).
 
Has anyone implemented something similar or can suggest best practices?
 
Thanks in advance!
I have the same question (0)
  • Suggested answer
    Yash_Mistry Profile Picture
    315 on at
    Hello,

    I have one suggestion: rather than wanting to run the test codeunit every time you publish, you can use the built-in VS Code feature to run test codeunits directly from VS Code without publishing. Just run them from there.



    Note: Make sure you have SubType set to Test, and the procedure type is also set to [Test].


     
    Hope this helps resolve your issue.
    If this solution was helpful, please consider marking it as Verified Answer.
     
    Thanks,
    Yash Mistry
  • SR-19090744-0 Profile Picture
    56 on at
    @Yash_Mistry Thank you for your answer. I now understand how to run tests directly in VS Code. However, I’m still not clear on the purpose of a TestRunner. Could you elaborate on when and why it should be used?
  • Mathewjhones Profile Picture
    6 on at
    This usually happens when the dimension isn’t properly configured or linked in the posting setup. Make sure the dimension is active, assigned correctly to the relevant master data (like customer, vendor, or item), and included in the account structure or posting profile. Also, try refreshing or revalidating the setup after changes sometimes the system doesn’t reflect updates immediately.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,809 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,122 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 689 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans