Test Framework for Mango
Is there an existing framework for testing the mango core and/or modules? I have pulled the most recent code from the public git repo but didn't find any test code. I am wondering because our company has developed a module and would like to automate some of the testing for it and the future modules we will create.
FWIW, I bump this since we are in a similar situation.
There is no test framework currently being used. This is mostly because there are no tests that have been written. This is something we are looking at doing in the future, if you are interested in working with us to implement tests we can get something started sooner.
I am interested in working with you. Do you want to discuss things right here or via PM?
I think we should discuss this in public in case anyone else wants to get involved.
Just to be clear, you are referring to the current Mango Automation core code from here: https://github.com/infiniteautomation/ma-core-public and not the legacy M2M architecture?
We are working in the development branch and you will see we have recently converted to using Maven for dependency management and will eventually be using it for our Builds too. This is good news for this discussion because we can automate the testing that way.
I am happy to spend some of my time laying out the framework and base classes for testing but the major problem has always been we don't have the time or resources to write tests for the existing code. What are your priorities for testing? Modules? Core? What are your requirements for the tests?
This is the type of thing we can do in small parts so if you have a specific need we can address that first and then start fleshing out other tests over time.
Thanks for your interest in Mango.
Sadly, we are tied to the legacy M2M architecture (Mango M2M v. 1.2.4). Are you familiar with it? I have had just a cursory look into the current Mango Automation code so I do not know which parts changed substantially / which parts stayed the same sufficiently. I am sure they diverged quite a bit... Do you think it would be feasible to start on a common subset of the code if there is any? I could think of Spring Testing framework (v. 1.2.4 uses Spring 2.5.3 IIRC) as a start for the Spring parts that did not change(?).
My priority would be to write tests that faciliate new data source implementations, e.g. event based data sources could be checked with a controlled timer in terms of data point setting. Also, to have known system states (i.e. data bases), I thought of using http://dbunit.sourceforge.net.
I will be on holidays the next week so in case you think this is worthwile, let me know and I will check back.
I am familiar with the M2M code, Mango contains most if not all of the M2M code, we moved a large portion of code out into modules. The web layer is probably the most divergent while the VO RT and DAO layers are probably still fairly consistent in terms of method signatures.
I still think it is worth considering working together because there will be a decent amount of overlap. For example, when testing a DataSource Mango still has most of the M2M methods with the addition of some new ones. It shouldn't be too much of a stretch to think we could build a Test library that when linked to M2M or Mango would work.
I'll spend some time thinking of what this common interface would be while you are on holidays. Let me know when you get back.
I've just committed our first round of tests for the new REST framework. It uses Spring 4 so it might be a little too advanced for the original M2M framework but it will give you an idea of how testing is going to work with M2M2. This code can be found in the development branch of the core-public git project, the link is https://github.com/infiniteautomation/ma-core-public/tree/development/Core/src-test/com/serotonin/m2m2
This is work in progress so it will be evolving over the coming weeks.
excuse me for the delay. It was a busy time the last few weeks and I am now evaluating internally whether we are at the same stage we were when I first posted here...
Thanks for the link, I will be watching this branch.
in the current ma-core-public (2.7.12) I found packages under "src-test" and "src-unit" in CORE.
For my view: are there other places of test logic?
phildunlap last edited by
For the core I believe that's all.