Giter Site home page Giter Site logo

unittesting's Introduction

Please see Unit Testing in the Mendix documentation for details.

unittesting's People

Contributors

allard-mx avatar jefhellemansmendix avatar joostverhoog avatar melvingrootenboers avatar mendixmurshed avatar mennodehaas avatar mitchelmx avatar mweststrate avatar nimatrueway avatar ozgemendix avatar roelandsalij avatar timvansteenbergen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unittesting's Issues

Commons HttpClient isn't packages with the module

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

Determine when a unit test is running

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.

Rollback microflow tests after execution only works with a Setup microflow

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.

Support running Unit tests by order.

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.

Screenshot 2024-02-28 075200

The selected image 'NavigationLayouts.Images.logo' no longer exists.

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.

image

Prefix

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

Language

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?

Replace dependency on ObjectHandling by Communitycommons

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

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

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).

Compatibility with Mx 7.10

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()); 

New release

When will a new release be published in the Appstore? Need the separate transaction for setup MFs.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.