Test Driven Development using the AIMMSUnitTest Library

  • 19 April 2019
  • 8 replies

Userlevel 4
Badge +6

This article discusses some elements from the popular software methodology Test Driven Development in relation to the AIMMS Library AIMMSUnitTest.

  1. Gather requirements from stakeholders

    • What are small examples?

    • What are the edge cases, including error cases, performance?

  2. Implement requirements as unit tests and see them fail!

  3. Development

    1. Write the code for the functions

    2. Execute tests and see them pass!

    3. Refactor until performance is acceptable.

  4. Repeat


8 replies

Is there common practices to test procedures as well (potentially with cases loaded)?

Userlevel 6
Badge +6

Hi @benjaminleroy 

Please check out this post best practice post by our colleague @Jan-Willem.  It also contains a reference to our Unit Test Library that is available for all developers of AIMMS applications; we use it for building the SC applications.


Userlevel 5
Badge +6

We are working on a best practices article that can also help!

Thanks @luispinto. My team is currently working on building up the automated testing suite for AIMMS, so please feel free to reach out if you want so engagement with the articles even when they’re just drafts.

Userlevel 4
Badge +5

Hi @benjaminleroy, you may want to take a look at the unit test project for the Data Exchange library, which is built around the AimmsUnitTest library and uses many of its features in a practical setting. 

You can download it from here: https://documentation.aimms.com/dataexchange/using.html



Thanks for the great resources (I’ll need to dig into the breadth of tests in the Data Exchange library). I’m most interested in tools to allow automated testing & automated code coverage. Coming from open source software, it would also be great to see how AIMMS type processing integrates into github actions, etc. 

Also, it’s sometimes hard to see how library based testing can be extended to model based testing (maybe Data Exchange’s tests will help me see this).

Userlevel 2
Badge +3

Is there a way to generate a code coverage report from log/AimmsUnit.xml? This would be helpful to setup some pre-commit hooks on production code.

Userlevel 4
Badge +5

Hi @Sree 

There is no code coverage included in the AimmsUnitTest library, as this would require engine support which is currently not available. 

I would suggest that you use the Ideation section to submit the idea to add code coverage support to the engine.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator