Questions about unit tests

39 views
Skip to first unread message

Jochen Fuerbacher

unread,
Jun 9, 2015, 3:42:48 AM6/9/15
to jenkin...@googlegroups.com
Hello,

I am currently writing unit tests for my jenkins plugin and I have some questions.

1. Is it normal when I run the unit tests, that my plugin isn't installed on the "unit test" jenkins instance automatically? I know that for each unit test a fresh jenkins instance get started. So are these instances really total clean - without any plugin installed (also mine)?

2. I used the annotation @LocalData to import predefined jenkins jobs. Problem: Test methods with this annotation don't get detected as unit tests. Example: In a class in have 2 methods annotated with @Test and 1 method with @LocalData. When I run this class as unit test, only the 2 methods with @Test get tested, the other method is ignored. I use JenkinsRule.

Thank you for your help.

Robert Sandell

unread,
Jun 11, 2015, 5:53:40 AM6/11/15
to jenkin...@googlegroups.com
1. No, that's not normal. The jenkins instance should have your plugin and all plugins that you depend on, as well as the optional dependencies.

2. You should annotate the method with both @Test and @LocalData

/B

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/fa5e04ec-5fd9-41af-8cae-394a9569738b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Robert Sandell
Software Engineer
CloudBees Inc.
Reply all
Reply to author
Forward
0 new messages