Monday, 27 November 2017

Create automated test scenario using Task Recorder In AX7

With AX7 we can use the Task Recorder to generate black box test scenarios, import and use as Automated Test on VS.
Using Task Recorder your consultants, PMs and developers can generate setups, simple test and end to end tests scenarios, export and the developer can import on VS to generate automated test classes.
Below i’ll show an simple examples of the creation of a test scenario using the Task Recorder and the generation of an automated test class based on the record.
To use the task recorder, open AX using the internet browser (don’t use the run mode from VS, the task recorder doesn’t work from there).

Click on the Setting\Task recorder (icon the top-right). Give the name for your test case and description.Capture

Click to start a sub-task.2

Give the name to your sub-task related to the test scenario that you going to record.3

Record the action of the test scenario, including validations, errors, etc.4

Stop the recording and “Save as developer recording”.5

Go to VS on a new project on the Test Model and go to the menu Dynamics AX 7\Addins\Import task recording.6

Import the saved file from the task recorder on your project.7
The VS will generate automatically the Test Class (SysTestCase) for the record.9
On VS go to Test\Windows\Test Explorer.10
Your new test class will be automatically detected and will appear on the Test Explorer list. From here you can run your test class, run all, run the failed tests, etc.11

Thursday, 13 July 2017

To Keep password while logging into AX application

To keep a password while logging into AX,
Use the first method that is called while logging into AX. i.e,
Application(Class) > startuppost() method.

void startupPost()
{
dialog d;
dialogfield df, df1, df2;
userinfo user;
boolean ret;
;
d = new dialog(“Password”);
df = d.addField(typeid(userid),”UserName”);
df1 = d.addField(typeid(userid),”UserName”);
df2 = d.addField(typeid(string30),”Password”);
df.value(curuserid());
select user
where user.id == curuserid();
if(user)
{
df1.value(user.name);
}
df1.allowEdit(false);
df1.displayLength(25);
while(d.run())
{
if(!(df2.value() || df2.value() == ‘Suri’))
{
infolog.shutDown(true);
throw error(“wrong password”);
df2.doNull();
continue;
}
else
{
ret = true;
break;
}
}
if(ret == false)
{
infolog.shutDown(true);
}
}

Wednesday, 5 July 2017

Print Middle Data in a field Data in AX2012



static void Job40(Args _args)
{

   
    str firstvalue,finalvalue,a = "ABC";
    info(strRem("ABCD", "C"));
    info(subStr("ABCD", 1,1));
   
    firstvalue = subStr(a,2,2);
   
    finalvalue = strRem(a, firstvalue);
   
    info(finalvalue);
   
}


IN SSRS:

Declaration:
str                         firstvalue,finalvalue,a;

Inside the loop:

 a = SalesPurchInvoiceHeaderFooterTmp.GSTConsignee;
    firstvalue = subStr(a,3,10);
    
    SalesPurchInvoiceHeaderFooterTmp.GSTConsigneePan = firstvalue;
    
    //info(strFmt("%1", firstvalue));
    
    finalvalue = subStr(SalesPurchInvoiceHeaderFooterTmp.GSTBuyer,3,10);
    
    SalesPurchInvoiceHeaderFooterTmp.GSTBuyerPan = finalvalue;