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 :
Microsoft Dynamics AX (Archived)

Automated Testing AX: UserConnection and Deadlocks

(0) ShareShare
ReportReport
Posted on by

Hello everybody,

we're doing extreme automated testing in AX here (Unit-Test and Process-Test), and I am on some issues regarding deadlocks using number sequences.

I tracked the issue down to the usage of the UserConnection class that is for example used to get new number sequences.

Does anyone have an idea how I can mock the UserConnection class so that is not using another connection? The tests need to run in one tts block because we need to abort all created data at the end of every TestCase....

Kind regards

Andi

*This post is locked for comments

I have the same question (0)
  • Tommy Skaue Profile Picture
    Moderator on at
    RE: Unit-Testing AX: UserConnection and Deadlocks

    I have not done much unit testing in AX, but I am thinking I would be cautious to unit test anything that is dependent on integration with the database. From what I've learned about unit testing is that you want to avoid dependency in unit tests if at all possible. I'm just thinking out loud, so if I'm way off, please just ignore me. ;-)  

  • Community Member Profile Picture
    on at
    RE: Unit-Testing AX: UserConnection and Deadlocks

    Yep you're right. I said Unit-Test but meant testing of processes like create sales order, then post it, and check if the invoice got created... sorry :)

  • Tommy Skaue Profile Picture
    Moderator on at
    RE: Automated Testing AX: UserConnection and Deadlocks

    It would be awesome if you could inject some other dependencies and mock the DB layer to test the process, but I guess that is decades away. Will be interesting to see who else comments on this. Sorry for just elaborating and not pushing solutions here.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

#2
NNaumenko Profile Picture

NNaumenko 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans