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

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Test Framework works o...
Finance forum

Test Framework works only in DAT company

(0) ShareShare
ReportReport
Posted on by 5

When running tests from a test case a system defaults to a DAT company. I need to run them in a company where test data exist.

Using changeCompany causes an exception "company XXX does not exist". It looks like access to other companies is restricted.

Here is an example of my code 

[SysTestTargetAttribute(classStr(igsEcoResProductCrossTableManager), UtilElementType::Class)]
class igsLengthControlTest extends SysTestCase

...

[SysTestMethodAttribute]
public void exportModel()
{...

}

What am I doing wrong?

I have the same question (0)
  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Test Framework works only in DAT company

    The unit tests are run on a different partition, which has no data by default. So you have to have such tests that create the data, or otherwise have some data on that partition.

    Have you checked the ATL (Acceptance Test Library) tool that Microsoft has shipped recently? It contains rich features for easy test data generation from x++ code.

    https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/perf-test/acceptance-test-library

  • Bukvoed Profile Picture
    5 on at
    RE: Test Framework works only in DAT company

    Thanks for a tip, I will try it.

    What I don't understand how can I test if no number sequence is setup.

    Or they are created by default also?

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Test Framework works only in DAT company

    ATL handles that.

  • Bukvoed Profile Picture
    5 on at
    RE: Test Framework works only in DAT company

    Number sequencies are not set up. Is there are anz way to handle this via ATL?

    4370.MicrosoftTeams_2D00_image.png

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Test Framework works only in DAT company

    Did you check the ATL sample classes? I'm quite sure that module parameters including number sequences can be initialized with existing ATL code. And you can always create your own ATL classes to generate any missing data.

  • Bukvoed Profile Picture
    5 on at
    RE: Test Framework works only in DAT company

    I have found an answer here.

    You have to add the attribute SysTestCaseAutomaticNumberSequencesAttribute above your class.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans