Skip to main content

Notifications

Announcements

No record found.

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?

  • Bukvoed Profile Picture
    Bukvoed 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.

  • Suggested answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 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
    Bukvoed 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

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

    ATL handles that.

  • Bukvoed Profile Picture
    Bukvoed 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
    nmaenpaa 101,156 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

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

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,431 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,503 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans