Creating a test folder for a module?

I’m new to OpenMRS and have solved a few tickets before. I’m trying to take up the issue: https://issues.openmrs.org/browse/OA-7 , which requires me to generate a test folder for the OAuth2 Module. Somehow I can’t seem to get around this step. I created a test file /omod/src/test/org/openmrs/web/controller/MetadataControllerTest.java . (manually created all the folders in between)

I pasted the following into my main pom:

<dependency>
	<groupId>org.openmrs.test</groupId>
	<artifactId>openmrs-test</artifactId>
	<version>${openMRSVersion}</version>
        <type>pom</type>
        <scope>test</scope>
</dependency>

and this into the api and omod poms:

<dependency>
	<groupId>org.openmrs.api</groupId>
	<artifactId>openmrs-api</artifactId>
	<version>${openMRSVersion}</version>
	<type>test-jar</type>
        <scope>test</scope>
</dependency>

as instructed here: https://wiki.openmrs.org/display/docs/Module+Unit+Testing But the test doesn’t get run at all. What am I missing?

Thank you.

I hope this article to be of some help :slight_smile:

Thank you for the resource. However, as the test isn’t even getting detected, I think I may need to point to the test somehow. I don’t know how to do that, unfortunately.

Can you raise a pull request with all your changes and we take a look?

1 Like

Here’s my PR: https://github.com/openmrs/openmrs-module-oauth2/pull/23 . Thank you for the offer!

Did you intentionally create the class named ModuleListControllerTest in a file named MetadataControllerTest.java?

Ah, that’s an embarrassing mistake… I’ve updated my repo. I still get the same issue though.

You are missing java in the path of your test. It should be …/src/test/java/org/openmrs/web/controller

Its working now! Thank you @dkayiwa!