Hi All,
Acumatica has a strong focus on the Platform and Development tools, that can help all our clients and partners to provide better product faster and with lower cost.
One of the nice and free tool that Acumatica provides as part of platform is Acumatica Test Framework. Acumatica test Framework is a set of tools and libraries that can be used for unattended black-box testing of any product or customization that is based on Acumatica Platform right in your favorite browser. For interacting with UI controls and components Acumatica Test Framework uses Selenium Web Driver. You can read more about Selenium here.
The high level diagram of Test Framework components is described here:
If we go in details you can see here Acumatica Test Framework Architecture.
As you can see here the core thing of the test framework is Element IDs – Each HTML element has own ID how browser can find it. Out page generator tool will extract all IDs and generate some sort of Object representaiton of the page using controls and IDs.
Later you can write a test using the classes generated. IDs will be passed by Acumatica Test Framework to Selenium Web Driver so it can find control by ID and execute as user it agains the browser.
The usage flow is like this:
- You have Acumatica ERP instance with required module or customization that you want to test.
- Using Page Wrapper Generation Tool you create a set of classes that will represents Acumatica page structure including controls, buttons, grids, columns, panels and so on. This tool is related on Acumatica platform and can dynamically analyse all standard and custom pages including customization. You need to create wrappers for each page that you want to test.
- Test Framework contains all required classes and methods that you can use to work with browser pages and controls. For example you can open selectors, search values, type or past values, click buttons, wait for long run operations and so on.
- Based on Wrappers and Framework classes you write your own Tests (that is classes) that will contains test logic.
- Using Test Runner you can lunch required tests. Test runner will load all test libraries and using interaction with Selenium Web Driver will open browser and execute all required steps.
- Selenium Web Driver is intermediate layer between test and browser. This tool knows browser API and can simulate user clicks with mouse and keyboards on each control separately. Also it can get values back to validate result.
- Browser is embedded in test SDK, as it requires specific version of browser to run smoothly. When you run test you will see browser window and can check how your test is running.
Test SDK can be downloaded from Acumatica. Please note that version of Test SDK should be equal to version of your Acumatica. SDK for version 5.30.2233 you can find here.
Good thing that Test SDK contains documentation, getting started training and a lot of examples. Just check file SDK – README.pdf.
Use this PDF file to go step by step with Getting started and you will be able to create your own first testing project.
GL Test Example:
Runner configuration:
Have a nice Testing!
Hi Sergey,
I am getting error to run test automation in the very first line.
Below code, which is giving error :
————————————
Features.OpenScreen();
Test Log:
———-
– Operation: Open screen: VCP10000
+ Error: #message
NoSuchElementException: Could not find a web element by the locator: css=#listModules [data-id=’-1′]:visible
Please suggest something in order to resolve the issue.
Thank you..
Hi Gaurav,
There can e three possibilities for the test to fail at the first step.
1. The instance is not Logging or we donot have the code to login before trying to go to Features screen. For that check whether your test has -PxLogin.LogIn(“admin”, “123”);
or;
2. The wrappers are not updated. Check the screen number its searching “VCP10000” is actually present in your instance or not. Enable/Disable Features screen is CS100000 in our wrappers. In this case you have to update the wrappers.
I will recommend to check with simple lines of code as mentioned in the demo test above-
JournalEntry journalEntry = new JournalEntry();
journalEntry.OpenScreen();
If journalEntry screen is opening or having same error.
Thanks Swagata,
It was working all the machine except one machine. It seems a configuration issue.
I seem to have a problem when I Process a Check on the AP505000. and it opens the report now I want to continue to the payment to check some values after the check has been printed. but the Automated Testing fails with the following exceoption.
– Step 3: Process the Actual Payment on the Process Payments / Print Checks Screen
– Operation: Click toolbar button: Process
– Operation: Wait for long operation to complete. Timeout: 360000ms
– Error: #message
WaitException: Long operation failed, did not start or resulted in a redirect, timer control is not available
#teststacktrace
Core.Exceptions.WaitException: Long operation failed, did not start or resulted in a redirect, timer control is not available
at Core.Wait.Wait.WaitForLongOperationToComplete(Int32 timeOutInMilliseconds, Boolean expectedStatus, String expectedMessage) in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Wait.cs:line 75
at Core.Wait.Wait.WaitForLongOperationToComplete(Boolean expectedStatus, String expectedMessage) in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Wait.cs:line 96
at GeneratedWrappers.Acumatica.AP505000_APPrintChecks.c__DisplayClass64_0.b__0() in C:\Users\User\source\repos\TestsMekormaAPHub\TestsMekormaAPHub\Extensions\AP\AP505000_APPrintChecks.cs:line 120
at Controls.BaseControl.InvokeWaitAction() in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Controls\DefaultControl\BaseControl.cs:line 255
at Controls.ToolBarButton.ToolBarButton.ClickOn(ToolBarButton control) in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Controls\ToolBarButton\ToolBarButton.cs:line 63
at Controls.ToolBarButton.ToolBarButton.Navigate(Action`1 action) in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Controls\ToolBarButton\ToolBarButton.cs:line 34
at Controls.ToolBarButton.ToolBarButton.Click() in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Libraries1\Controls\ToolBarButton\ToolBarButton.cs:line 49
at GeneratedWrappers.Acumatica.AP505000_APPrintChecks.Process(Boolean status, String message) in C:\Users\User\source\repos\TestsMekormaAPHub\TestsMekormaAPHub\Extensions\AP\AP505000_APPrintChecks.cs:line 121
at Tests.Test.TestElectronicSignaturesSDK1() in C:\Users\User\source\repos\TestsMekormaAPHub\TestsMekormaAPHub\Tests\Test.cs:line 64
at Tests.Test.Execute() in C:\Users\User\source\repos\TestsMekormaAPHub\TestsMekormaAPHub\Tests\Test.cs:line 24
at Execution.TestRunner.Run(String test) in C:\Bld6\AC-FULLCOMMON81-TB\tests\Selenium\Execution\TestRunner.cs:line 44
#url
http://localhost/AcumaticaDBApHub/Main?ScreenId=AP505200&PayTypeID=CHECK&PayAccountID=10200WH+++&Action=R
#screenId
AP505200
#timestamp
10/6/2022 12:08:30 AM
#applicationstacktrace
Hi,
Since the Process is leading to a new window that why it is not able to located whether the Action is fully executed or not.
You can override the wait action for Process() by putting
Process.ToolBar.Process.WaitActionOverride = Wait.WaitForNewWindowToOpen;
just above the line where you are calling Process().
Hope it helps.
Thanks
Thanks Swagata,
It was working all the machine except one machine. It seems a configuration issue.
Sorry.. Wrong window
Hi Sergey,
How can we automate test for mobile device ?
Thanks & Regards,
Gaurav Katiyar
As far as I know, we don’t have shared tools to test mobile app.
Hi Sergey,
For the Client addons, we are creating separate test projects.
Is it a best way to create client wise separate test projects.
In these projects, Can we extend our core/base wrappers, Extensions and Test Classes using core/base test project DLL ?
Thanks & Regards,
Gaurav Katiyar
Thanks & Regards,
Gaurav Katiyar
Overall, I think it is good practice to create a separate projects for different customizations or addons.
Hi Sergey,
In these customization test projects, Can we extend our core/base wrappers, Extensions and Test Classes using core/base test project DLL ?
Thanks & Regards,
Gaurav Katiyar
Hi Gaurav,
Test SDK was made for purpose of creating a separate test project to test customer addons or customizations.
Here is possible way to do so, also you can find this info in “SDK – README.pdf” file coming with TestSDK archive:
1. Publish customizations\add addons to Acumatica instance and generate new wrappers to use objects from addons\customizations
2. Create extension classes for newly wrappers and include them in your project.
3. Create a Test classes to be run.
Hope it helps.
Regards,
Hi Sergey,
Can we extend our core/base wrappers, Extensions and Test Classes using core/base test project DLL ?
Thanks & Regards,
Gaurav Katiyar
Sergey, thanks a lot for this article. This adds credibility to the quality of our software. Customers will like this. Great for testing some customizations.
Thanks a lot.
Toon Six
Toonsix@intercs.com
Skype: toon.six@live.com
C: 973 727 9665