Writing integration tests for REST API Tool

35 views
Skip to first unread message

Karl Heinz Marbaise

unread,
Aug 11, 2015, 3:42:35 PM8/11/15
to Jenkins Developers
I'm currently in developing a REST API tool (https://github.com/RisingOak/jenkins-client)  which gets information from jenkins about different aspects and consume the REST API...but now I'm at the point where i need to write appropriate tests which means i need to setup Jenkins in a test way...

I have found things like this:

    @Rule
    public JenkinsRule jenkinsRule = new JenkinsRule();

   FreeStyleProject fsp = jenkinsRule.getInstance().createProject(FreeStyleProject.class, "TestProject");
   fsp.scheduleBuild(0, new Cause.UserIdCause(),
                    new ParametersAction(new StringParameterValue("BUILD", "" + i)));

So the question is how can i inject things like ChangeSet items etc. like informations which are coming from version control systems like git, svn etc. or does exist a better solution for this?

Can someone give me a hint ? Or better idea?

Thanks in advance.

Kind regards
Karl Heinz Marbaise

Mirko Friedenhagen

unread,
Aug 11, 2015, 3:59:29 PM8/11/15
to jenkin...@googlegroups.com

Hello Karl-Heinz,

you create test jobs and let Jenkins parse the changelog for you. Take a look at
https://github.com/jenkinsci/jswidgets-plugin/tree/master/src/test/resources/hudson/plugins/jswidgets/PluginIT/jobs/svntest for an example.
Regards
Mirko
--
Sent from my mobile

--
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/207e3311-5538-44ae-a27a-1cc8a8333d91%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Karl Heinz Marbaise

unread,
Aug 12, 2015, 3:14:14 PM8/12/15
to Jenkins Developers
Hi Mirko,

first thanks for the hint but unfortunately i need the information external which i can extract already by REST API but for this i need the way to do some testing of the REST API if all objects etc. are filled correctly ....

Kind regards
Karl Heinz Marbaise

The question is: 

Ullrich Hafner

unread,
Aug 12, 2015, 5:51:01 PM8/12/15
to jenkin...@googlegroups.com
Wouldn’t such test be better part of our acceptance test suite: https://github.com/jenkinsci/acceptance-test-harness

Here you can setup Jenkins with all required plug-ins, configure the system and the job as test fixture. You even can use external systems embedded in a docker container.

signature.asc
Reply all
Reply to author
Forward
0 new messages