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 :
Finance | Project Operations, Human Resources, ...
Unanswered

Using "Import task recorder " this class is generated (added code below) can I insert values in Setup data method, by reading values from excel file or i have to change test cases one by one !!

(0) ShareShare
ReportReport
Posted on by 2

[SysTestCaseDataDependencyAttribute("USMF"),SysCodeGenAttribute()]
class Sales_Order_Confirmation extends SysTestCase
{
    protected SalesTableListPageFormAdaptor SalesTableListPageForm;

    protected SalesCreateOrderFormAdaptor SalesCreateOrderForm;

    protected str SalesCreateOrder_SalesTable_CustAccount;

    protected container SalesCreateOrder_General_General;

    protected str SalesCreateOrder_SalesTable_SalesId_Copy;

    protected FormAdaptor SalesTable_InventSiteId_LookupForm;

    protected container SalesTable_InventSiteId_Lookup_Grid_Grid;

    protected FormAdaptor SalesTable_InventLocationId_LookupForm;

    protected container SalesTable_InventLocationId_Lookup_Grid_Grid;

    protected SalesTableFormAdaptor SalesTableForm;

    protected str SalesTable_SalesLine_ItemId;

    protected FormAdaptor SalesLine_ItemId_LookupForm;

    protected FormAdaptor SalesLine_ItemId_LookupForm1;

    protected SalesTotalsFormAdaptor SalesTotalsForm;

    protected real SalesTotals_SumTax;

    protected SalesEditLinesFormAdaptor SalesEditLinesForm;


    public void SetUpTestCase()
    {
        super();
        this.setupData();
    }

    [SysCodeGenAttribute()]
    protected void setupData()
    {
        SalesCreateOrder_SalesTable_CustAccount = "US-010";
        SalesCreateOrder_General_General = ["0"];
        SalesTable_InventSiteId_Lookup_Grid_Grid = ["2","4","1","first"];
        SalesTable_InventLocationId_Lookup_Grid_Grid = ["3","4","1","first"];
        SalesTable_SalesLine_ItemId = "D0001";
        SalesTotals_SumTax = 30;
    }

    [SysCodeGenAttribute(),SysTestMethodAttribute()]
    public void testMethod()
    {
        using (var c = ClientContext::create())
        {
            //Go to Accounts receivable > Orders > All sales orders.
            using (var c1 = c.navigate(menuItemDisplayStr(salestablelistpage),formStr(SalesTableListPage),Microsoft.Dynamics.TestTools.Dispatcher.MenuItemType::Display))
            {
                SalesTableListPageForm = c1.form();
                using (var c2 = c1.action("SystemDefinedNewButton_Click"))
                {
                    //Click New.
                    SalesTableListPageForm.systemDefinedNewButton().click();
                    using (var c3 = c2.attach(formStr(SalesCreateOrder)))
                    {
                        SalesCreateOrderForm = c3.form();
                        //In the Customer account field, type a value.
                        SalesCreateOrderForm.SalesTable_CustAccount().setValue(SalesCreateOrder_SalesTable_CustAccount);
                        //Expand the General section.
                        SalesCreateOrderForm.General().activate(conPeek(SalesCreateOrder_General_General,1));
                        //Note the value in the Sales order field to reference later
                        SalesCreateOrder_SalesTable_SalesId_Copy = SalesCreateOrderForm.SalesTable_SalesId().getValue();
                        using (var c4 = c3.action("SalesTable_InventSiteId_RequestPopup"))
                        {
                            //In the Site field, enter or select a value.
                            SalesCreateOrderForm.SalesTable_InventSiteId().openLookup();
                            using (var c5 = c4.attachPrivate(""))
                            {
                                SalesTable_InventSiteId_LookupForm = c5.form();
                                //In the list, select row 2.
                                SalesTable_InventSiteId_LookupForm.getGrid("Grid").changeRowInCache(SalesTable_InventSiteId_Lookup_Grid_Grid);
                                //In the list, click the link in the selected row.
                                SalesTable_InventSiteId_LookupForm.getGrid("Grid").selectRecord();
                            }
                        }
                        using (var c6 = c3.action("SalesTable_InventLocationId_RequestPopup"))
                        {
                            //In the Warehouse field, enter or select a value.
                            SalesCreateOrderForm.SalesTable_InventLocationId().openLookup();
                            using (var c7 = c6.attachPrivate(""))
                            {
                                SalesTable_InventLocationId_LookupForm = c7.form();
                                //In the list, select row 3.
                                SalesTable_InventLocationId_LookupForm.getGrid("Grid").changeRowInCache(SalesTable_InventLocationId_Lookup_Grid_Grid);
                                //In the list, click the link in the selected row.
                                SalesTable_InventLocationId_LookupForm.getGrid("Grid").selectRecord();
                            }
                        }
                        //Click OK.
                        SalesCreateOrderForm.OK().click();
                        using (var c8 = c3.attach(formStr(SalesTable)))
                        {
                            SalesTableForm = c8.form();
                            //In the Item number field, enter or select a value.
                            SalesTableForm.SalesLine_ItemId().openLookup();
                            //In the Item number field, type a value.
                            SalesTableForm.SalesLine_ItemId().setValue(SalesTable_SalesLine_ItemId);
                            using (var c9 = c8.attachPrivate(""))
                            {
                                SalesLine_ItemId_LookupForm = c9.form();
                                //Close the page.
                                SalesLine_ItemId_LookupForm.close();
                            }
                            //In the list, mark the selected row.
                            SalesTableForm.SalesLineGrid().markActiveRow();
                            using (var c10 = c8.action("SalesLine_ItemId_RequestPopup"))
                            {
                                //In the Item number field, enter or select a value.
                                SalesTableForm.SalesLine_ItemId().openLookup();
                                using (var c11 = c10.attachPrivate(""))
                                {
                                    SalesLine_ItemId_LookupForm1 = c11.form();
                                    //Close the page.
                                    SalesLine_ItemId_LookupForm1.close();
                                }
                            }
                            //On the Action Pane, click Sell.
                            SalesTableForm.Sell().activate();
                            //On the Action Pane, click Sales order.
                            SalesTableForm.SalesOrder().activate();
                            using (var c12 = c8.action("ButtonTotals_Click"))
                            {
                                //Click Totals.
                                SalesTableForm.ButtonTotals().click();
                                using (var c13 = c12.attach(formStr(SalesTotals)))
                                {
                                    SalesTotalsForm = c13.form();
                                    //Validate that the value for Sales tax is '30.0000000000000000'.
                                    this.assertEquals(SalesTotals_SumTax,SalesTotalsForm.SumTax().getValue(),"Assertion failed for control SumTax on form SalesTotals");
                                    //Click OK.
                                    SalesTotalsForm.OKButton().click();
                                }
                            }
                            //On the Action Pane, click Sell.
                            SalesTableForm.Sell().activate();
                            using (var c14 = c8.action("buttonUpdateConfirmation_Click"))
                            {
                                //Click Confirm sales order.
                                SalesTableForm.buttonUpdateConfirmation().click();
                                using (var c15 = c14.attach(formStr(SalesEditLines)))
                                {
                                    SalesEditLinesForm = c15.form();
                                    //Click OK.
                                    SalesEditLinesForm.OK().click();
                                }
                            }
                        }
                    }
                }
            }
        }
    }

}

I Have imported task recording for confirmation of a sales order , using import task recorder add in under D365 Extension in VScode  ,

from 45 to 51 , is it possibe to add Cases using excel fike (i.e read values from excel file ) in the same class

I have the same question (0)

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans