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

Debug batch job / Unit testing

(0) ShareShare
ReportReport
Posted on by 1,559

Hi Friends,

I want to do some unit testing/debug on batch job. Instead going through setting up of configuration on both client and server AOS, is there an easy way to do this?

 

I simply just want a quick run of batch, batch job is a class extended on RunBaseBatch, has 'main' and 'run' methods.

 

Many thanks,

River

*This post is locked for comments

I have the same question (0)
  • Anton Venter Profile Picture
    20,656 Super User 2026 Season 1 on at

    Hi, you can set your breakpoints and run the job from your AX client instead of in the batch. Sometimes issues occur only in batch not from the AX client. You are then forced to debug the job when it is executing in batch. Does your issue only occur in batch?

  • DanielBal Profile Picture
    10 on at

    I think it is the same to debug CIL Code.

    Open Visual Studio, look for on Application Explorer, the batch job class and open the source code.

    After Set a breakpoint in the code and Attach the Visual Studio debugger to the Microsoft Dynamics AX server process (Ax32Serv.exe).

    When code execution hits the breakpoint that you set, the context switches to Visual Studio and you can continue to step through the code.

    I 've noticed that the recursive code is not executed

    Regards,

    Adolfo Castillo

  • Verified answer
    Iulian Cordobin Profile Picture
    8,201 on at

    Is your client machine's different from the  aos machine? In either cases actually, you only need to setup your client machine like mentioned in this post http://blogs.msdn.com/b/x/archive/2009/06/25/step-by-step-checklist-for-debugging-batch-jobs-in-dynamics-ax.aspx

  • Ganriver1 Profile Picture
    1,559 on at

    Hi Anton,

    You mean to create a job, and create instance of class to run it?

    Here is main() method:

    ----------------------

    public static void main(Args _args)

    {

       myBatchTestClass instance = new myBatchTestClass();

       ;

       if(_args && _args.record() && _args.dataset() == tablenum(myBatchSession))

       {

           instance.setBatchSession(_args.record());

       }

       if (!instance.prompt())

           return;

       instance.run();

    }

    --------------------------

    How can I run it in job? BTW, I don't know much about this batch.

    Thanks,

  • Ganriver1 Profile Picture
    1,559 on at

    HI Adolfo,

    I am working with AX 2009, VS 8, will it work?

    River

  • Verified answer
    Community Member Profile Picture
    on at

    You have a main() method, so you can just run the class from the AOT (rightclick > open) and should be able to debug it.

  • Ganriver1 Profile Picture
    1,559 on at

    Hi Jens,

    I did, but, it pop up form to ask for input. Just wondering how it works when run as batch,

    obviously, the main method is not called.

    Thanks.

  • Verified answer
    Dick Wenning Profile Picture
    8,705 Moderator on at

    have the ax debugger installed, and uncheck cil at user options.

    add your breakpoint and start the batch, but is should start directly

    8524.Capture.GIF

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

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans