Please see Unit Testing in the Mendix documentation for details.
mendix / unittesting Goto Github PK
View Code? Open in Web Editor NEWModule to run Mendix and JUnit unit test inside a project
License: Apache License 2.0
Module to run Mendix and JUnit unit test inside a project
License: Apache License 2.0
Please see Unit Testing in the Mendix documentation for details.
Buildfile: D:\Mendix Projects\Profile Service-412915-secure-profile-service\deployment\build_core.xml
compile:
[javac] Compiling 139 source files to D:\Mendix Projects\Profile Service-412915-secure-profile-service\deployment\run\bin
[javac] D:\Mendix Projects\Profile Service-412915-secure-profile-service\javasource\unittesting\RemoteApiServlet.java:8: error: package org.apache.commons.httpclient does not exist
We would like to be able to know if a microflow is called from the unittest runner. We had several occasions where this prevented us from making a unit test.
An example:
We wanted to test a microflow which included a check on roles. Since the unit test runner does not contain a $currentUser we were not able to mock roles for it. If we had a rule for 'is unit test running' then we could change the microflow so that it does not check for roles if the source is a unit test.
I have just completed the learning path 'Quality Control and Testing' and I noticed the behavior,that the entities I create within my microflow unittest doesn't rollback. According to the step description, the rollback should prevent all changes on my entities, but new entries are added and others are deleted after the tests run.
Apparently a transaction is only started if a Setup microflow is available in the module. I don't think this behavior is wanted.
I used Mendix Studio Pro 8.5.1, UnitTest 8.0.0 and ObjectHandling 3.0.0.
I'm using this project for testing our Mendix project and it helps us to prevent a lot of issues before we go to production. I'm really glad and thankful to you guys.
When implementing the Unit testing for our project, we were getting trrouble with a defining test. Because our test steps all relate to each others and we require them running in order. To adapt the configuration, we are using the name convension that help us to sort the test steps by our desired order.
The problem is the Unit testing does not run with the correct order sometime and we get failure. It also messed up our database. Then we need to clean up our database manually by the SQL queries. That's dangeruos and annoying.
Please consider to have a way that allow us to sort all UnitTest and all TestSuite before running the UnitTesting.
Thanks.
Some Databases such as Oracle do not support fully unlimited string behavior. For more info see: https://docs.mendix.com/refguide/oracle#1-introduction. Currently in UniTest object there are strings with unlimited check which they should be limited.
When using the UnitTesting module with Mendix Studio Pro v8.5 and 8.6.1 (I haven't checked newer versions), I get the following error:
The selected image 'NavigationLayouts.Images.logo' no longer exists.
This error is thrown on a button with the text "Bedrijfsnaam", located in UnitTesting/Private/NavigationLayouts/Sidebar_Full_Responsive.
I get the error after freshly downloading the UnitTesting module from the app store.
This error is resolved by picking any existing image from the dropdown menu.
Hello,
Why is the prefix changed from Test to Test_? (7daf920)
Now I need to change all my unit test microflow names, but besides that I like to use CamelCase for my microflow names, which for me do not include underscores.
Greetings Martijn
I always use this module in my projects where the language is set to Dutch. I think for this reason all the buttons always have the caption "Microflow".
I change it every time manually, but I also like to update from the app store, but then I need to change it again.
Could you please fix it in the module?
Is it an option to replace the dependency on ObjectHandling by one on Communitycommons? This is easily done by replacing:
import ObjectHandling.XPath;
by
import communitycommons.XPath;
in two files: \javasource\unittesting\RemoteApiServlet.java and \javasource\unittesting\TestManager.java
This is something I do in every project the already uses CommunityCommons. Saves me importing ObjectHandling.
JUnit test detection fails with java.io.FilePermission on local run with emulate cloud security enabled.
In 6.10.3, new apps by default have cloud security emulation enabled. Workaround is to disable cloud security emulation, but this is not documented.
Sidenote: JUnit tests are only detected if a constant is set to true
. However, this is also undocumented.
Log output:
Unable to find JUnit test classes or methods.
access denied ("java.io.FilePermission" "C:\Users\David\Projects\Mendix\<PROJECT>-main\deployment\model\bundles\project.jar" "read")
--------
java.security.AccessControlException: access denied ("java.io.FilePermission" "C:\Users\David\Projects\Mendix\<PROJECT>\deployment\model\bundles\project.jar" "read")
at java.security.AccessControlContext.checkPermission(AccessControlContext.java:457)
at java.security.AccessController.checkPermission(AccessController.java:884)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:549)
at java.lang.SecurityManager.checkRead(SecurityManager.java:888)
at java.util.zip.ZipFile.<init>(ZipFile.java:211)
at java.util.zip.ZipFile.<init>(ZipFile.java:150)
at java.util.zip.ZipFile.<init>(ZipFile.java:164)
at unittesting.TestManager.processProjectJar(TestManager.java:418)
at unittesting.TestManager.getClassesForPackage(TestManager.java:464)
at unittesting.TestManager.getUnitTestClasses(TestManager.java:88)
at unittesting.TestManager.findJUnitTests(TestManager.java:561)
at unittesting.TestManager.updateUnitTestList(TestManager.java:526)
at unittesting.TestManager.findAllTests(TestManager.java:489)
at unittesting.actions.FindAllUnitTests.executeAction(FindAllUnitTests.java:27)
at unittesting.actions.FindAllUnitTests.executeAction(FindAllUnitTests.java:16)
at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)
at com.mendix.modules.microflowengine.actions.actioncall.JavaAction.execute(JavaAction.scala:52)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowObject.execute(MicroflowObject.java:47)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAfterBreakingIfNecessary(MicroflowImpl.java:192)
at com.mendix.modules.microflowengine.microflow.impl.MicroflowImpl.executeAction(MicroflowImpl.java:149)
at com.mendix.systemwideinterfaces.core.UserAction.execute(UserAction.java:49)
at com.mendix.core.actionmanagement.CoreAction.doCall(CoreAction.java:260)
at com.mendix.core.actionmanagement.CoreAction.call(CoreAction.java:248)
at com.mendix.core.actionmanagement.ActionManager$1.execute(ActionManager.java:168)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.actionmanagement.ActionManager.executeSync(ActionManager.java:172)
at com.mendix.core.component.InternalCore.execute(InternalCore.java:414)
at com.mendix.webui.actions.client.ExecuteAction.execute(ExecuteAction.java:144)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply$mcV$sp(ClientRequestHandler.scala:311)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
at com.mendix.webui.requesthandling.ClientRequestHandler$$anonfun$handleRequest$1.apply(ClientRequestHandler.scala:301)
at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2$$anon$1.execute(ActionDispatching.scala:143)
at com.mendix.util.classloading.Runner.doRunUsingClassLoaderOf(Runner.java:36)
at com.mendix.core.session.Worker$$anonfun$receive$3$$anonfun$2.apply(ActionDispatching.scala:145)
at scala.util.Try$.apply(Try.scala:192)
at com.mendix.core.session.Worker$$anonfun$receive$3.applyOrElse(ActionDispatching.scala:139)
at akka.actor.Actor$class.aroundReceive(Actor.scala:465)
at com.mendix.core.session.Worker.aroundReceive(ActionDispatching.scala:135)
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:516)
at akka.actor.ActorCell.invoke(ActorCell.scala:487)
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:238)
at akka.dispatch.Mailbox.run(Mailbox.scala:220)
at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(AbstractDispatcher.scala:393)
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
at scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Documentation module is outdated. It is reported that microflows containing tests must have a name that starts with ' Test_ โ. However, when looking at the associated Java source code, microflows considered must begin with 'Test' or ' UT_ ' (not case sensitive because there is a toLowerCase in the java code).
Hi,
We upgrade our Mendix version from 6.10.11 to 7.10.0. Now we updated the UnitTesting module from the appstore. When we start our application it fails when it compiles Java.
Is this version not compatible with Mx 7.10?
[javac] D:\Mendix\javasource\unittesting\RemoteApiServlet.java:20: error: package objecthandling does not exist
[javac] import objecthandling.XPath;
[javac] ^
[javac] D:\Mendix\javasource\unittesting\TestManager.java:34: error: package objecthandling does not exist
[javac] import objecthandling.XPath;
[javac] ^
[javac] D:\Mendix\javasource\unittesting\RemoteApiServlet.java:169: error: cannot find symbol
[javac] for(TestSuite suite : XPath.create(context, TestSuite.class).all()) {
[javac] ^
[javac] symbol: variable XPath
[javac] location: class RemoteApiServlet.TestSuiteRunner
[javac] D:\Mendix\javasource\unittesting\RemoteApiServlet.java:180: error: cannot find symbol
[javac] for(UnitTest test : XPath.create(context, UnitTest.class)
[javac] ^
[javac] symbol: variable XPath
[javac] location: class RemoteApiServlet.TestSuiteRunner
[javac] D:\Mendix\javasource\unittesting\TestManager.java:188: error: cannot find symbol
[javac] for(UnitTest test : XPath.create(context, UnitTest.class).eq(UnitTest.MemberNames.UnitTest_TestSuite, testSuite).all()) {
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix\javasource\unittesting\TestManager.java:380: error: cannot find symbol
[javac] res = XPath.create(context, UnitTest.class)
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix\javasource\unittesting\TestManager.java:495: error: cannot find symbol
[javac] TestSuite testSuite = XPath.create(context, TestSuite.class).findOrCreate(TestSuite.MemberNames.Module, module);
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix\javasource\unittesting\TestManager.java:502: error: cannot find symbol
[javac] XPath.create(context, TestSuite.class).not().hasReference(UnitTest.MemberNames.UnitTest_TestSuite, UnitTest.entityName).close().deleteAll();
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix/javasource\unittesting\TestManager.java:511: error: cannot find symbol
[javac] for(UnitTest test : XPath.create(context, UnitTest.class)
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix\javasource\unittesting\TestManager.java:544: error: cannot find symbol
[javac] for(UnitTest test : XPath.create(context, UnitTest.class)
[javac] ^
[javac] symbol: variable XPath
[javac] location: class TestManager
[javac] D:\Mendix\javasource\unittesting\TestManager.java:553: error: cannot find symbol
[javac] testSuite.setTestCount(XPath.create(context, UnitTest.class).eq(UnitTest.MemberNames.UnitTest_TestSuite, testSuite).count());
When will a new release be published in the Appstore? Need the separate transaction for setup MFs.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.