Modify

Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#23219 closed task (worksforme)

Document unit testing for plugin authors

Reported by: gaben Owned by: team
Priority: normal Milestone:
Component: Wiki content Version:
Keywords: unit test testng junit Cc:

Description

I developed a plugin for JOSM some time ago. It's written in Kotlin and utilizes TestNG. However, I recently realized it might not work at all because everything was prepared with JUnit in mind.

Can someone help me figure out how it's possible to test plugins, possibly with TestNG? I'm not committed to TestNG; it would just be nice to have so I wouldn't need to rewrite what I currently have.

After all, I couldn't find documentation for plugin authors on writing unit tests, let it be TestNG or JUnit. I'm happy to create the pages, but I currently lack the knowledge. Just today, I discovered that there is a josm-unittest.jar lib for this purpose...

Attachments (0)

Change History (4)

comment:1 by taylor.smock, 2 years ago

The josm-unittest.jar is specifically distributed for that purpose, yes.

The following classes should be used in order:

Last edited 2 years ago by taylor.smock (previous) (diff)

comment:2 by gaben, 2 years ago

I moved the project to JUnit 5. It took me a day, but it was worth it. Now automagically everything started working :D Thank you!

comment:3 by taylor.smock, 2 years ago

Resolution: worksforme
Status: newclosed

We have a short section on wiki:DevelopersGuide/DevelopingPlugins#Automatedtesting about automated testing, which pretty much comes down to "look at these examples".

comment:4 by gaben, 2 years ago

Hmm, I missed that section. Anyway, I added a sentence about my findings.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain team.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.