forked from kinow/testlink-java-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestLinkAPI.java
More file actions
1220 lines (1113 loc) · 48.9 KB
/
TestLinkAPI.java
File metadata and controls
1220 lines (1113 loc) · 48.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* The MIT License
*
* Copyright (c) 2010 Bruno P. Kinoshita http://www.kinoshita.eti.br
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package br.eti.kinoshita.testlinkjavaapi;
import java.net.URL;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import org.apache.commons.configuration2.CompositeConfiguration;
import org.apache.commons.configuration2.PropertiesConfiguration;
import org.apache.commons.configuration2.SystemConfiguration;
import org.apache.commons.configuration2.builder.FileBasedConfigurationBuilder;
import org.apache.commons.configuration2.builder.fluent.Parameters;
import org.apache.commons.configuration2.convert.DefaultListDelimiterHandler;
import org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.ex.ConversionException;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.XmlRpcClient;
import org.apache.xmlrpc.client.XmlRpcClientConfigImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import br.eti.kinoshita.testlinkjavaapi.constants.ActionOnDuplicate;
import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionStatus;
import br.eti.kinoshita.testlinkjavaapi.constants.ExecutionType;
import br.eti.kinoshita.testlinkjavaapi.constants.ResponseDetails;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseDetails;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseStatus;
import br.eti.kinoshita.testlinkjavaapi.constants.TestCaseStepAction;
import br.eti.kinoshita.testlinkjavaapi.constants.TestImportance;
import br.eti.kinoshita.testlinkjavaapi.model.Attachment;
import br.eti.kinoshita.testlinkjavaapi.model.Build;
import br.eti.kinoshita.testlinkjavaapi.model.CustomField;
import br.eti.kinoshita.testlinkjavaapi.model.Execution;
import br.eti.kinoshita.testlinkjavaapi.model.Platform;
import br.eti.kinoshita.testlinkjavaapi.model.ReportTCResultResponse;
import br.eti.kinoshita.testlinkjavaapi.model.Requirement;
import br.eti.kinoshita.testlinkjavaapi.model.TestCase;
import br.eti.kinoshita.testlinkjavaapi.model.TestCaseStep;
import br.eti.kinoshita.testlinkjavaapi.model.TestPlan;
import br.eti.kinoshita.testlinkjavaapi.model.TestProject;
import br.eti.kinoshita.testlinkjavaapi.model.TestSuite;
import br.eti.kinoshita.testlinkjavaapi.model.User;
import br.eti.kinoshita.testlinkjavaapi.util.TestLinkAPIException;
/**
* TestLink API class.
*
* @author Bruno P. Kinoshita - http://www.kinoshita.eti.br
* @since 1.9.0-1
*/
public class TestLinkAPI {
/**
* TestLink URL.
*/
private URL url;
/**
* TestLink Developer Key.
*/
private String devKey;
private final TestProjectService testProjectService;
private final TestPlanService testPlanService;
private final MiscService miscService;
private final TestCaseService testCaseService;
private final TestSuiteService testSuiteService;
private final BuildService buildService;
private final RequirementService requirementService;
private final ReqSpecService reqSpecService;
private static final Logger LOG = LoggerFactory.getLogger(TestLinkAPI.class);
/**
* XML-RPC client.
*/
private XmlRpcClient xmlRpcClient;
// Constants for properties
private static final String XMLRPC_BASIC_ENCODING = "xmlrpc.basicEncoding";
private static final String XMLRPC_BASIC_PASSWORD = "xmlrpc.basicPassword";
private static final String XMLRPC_BASIC_USERNAME = "xmlrpc.basicUsername";
private static final String XMLRPC_CONNECTION_TIMEOUT = "xmlrpc.connectionTimeout";
private static final String XMLRPC_CONTENT_LENGTH_OPTIONAL = "xmlrpc.contentLengthOptional";
private static final String XMLRPC_ENABLED_FOR_EXCEPTIONS = "xmlrpc.enabledForExceptions";
private static final String XMLRPC_ENCODING = "xmlrpc.encoding";
private static final String XMLRPC_GZIP_COMPRESSION = "xmlrpc.gzipCompression";
private static final String XMLRPC_GZIP_REQUESTING = "xmlrpc.gzipRequesting";
private static final String XMLRPC_REPLY_TIMEOUT = "xmlrpc.replyTimeout";
private static final String XMLRPC_USER_AGENT = "xmlrpc.userAgent";
/**
* Constructor with parameters.
*
* <p>
* Instantiates TestLink services. It also checks the devKey and throws a TestLinkAPIException if it is invalid.
* </p>
*
* @param url The URL to set.
* @param devKey The Developer Key to set.
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
*/
public TestLinkAPI(URL url, String devKey) throws TestLinkAPIException {
this.url = url;
this.devKey = devKey;
this.xmlRpcClient = new XmlRpcClient();
// application configuration
final CompositeConfiguration appConfig = this.createApplicationConfiguration();
// XML-RPC client specific configuration, using the application
// configuration
final XmlRpcClientConfigImpl config = this.createXmlRpcClientConfiguration(url, appConfig);
this.xmlRpcClient.setConfig(config);
this.testProjectService = new TestProjectService(xmlRpcClient, devKey);
this.testPlanService = new TestPlanService(xmlRpcClient, devKey);
this.miscService = new MiscService(xmlRpcClient, devKey);
this.testCaseService = new TestCaseService(xmlRpcClient, devKey);
this.testSuiteService = new TestSuiteService(xmlRpcClient, devKey);
this.buildService = new BuildService(xmlRpcClient, devKey);
this.requirementService = new RequirementService(xmlRpcClient, devKey);
this.reqSpecService = new ReqSpecService(xmlRpcClient, devKey);
this.miscService.checkDevKey(devKey);
}
/**
* Creates application composite configuration.
*
* @return Application composite configuration.
*/
private CompositeConfiguration createApplicationConfiguration() {
CompositeConfiguration appConfig = new CompositeConfiguration();
appConfig.addConfiguration(new SystemConfiguration());
try {
FileBasedConfigurationBuilder<PropertiesConfiguration> builder = new FileBasedConfigurationBuilder<PropertiesConfiguration>(
PropertiesConfiguration.class)
.configure(new Parameters().properties().setFileName("testlinkjavaapi.properties")
.setThrowExceptionOnMissing(true)
.setListDelimiterHandler(new DefaultListDelimiterHandler(';'))
.setIncludesAllowed(false));
PropertiesConfiguration propertiesConfiguration = builder.getConfiguration();
appConfig.addConfiguration(propertiesConfiguration);
} catch (ConfigurationException ce) {
this.debug(ce);
}
return appConfig;
}
/**
* Creates XML-RPC client configuration.
*
* By default enabled for extensions is always true.
*
* @param url Application URL.
* @param appConfig Application composite configuration.
* @return XML-RPC client configuration.
*/
private XmlRpcClientConfigImpl createXmlRpcClientConfiguration(URL url, CompositeConfiguration appConfig) {
final XmlRpcClientConfigImpl xmlRpcClientConfig = new XmlRpcClientConfigImpl();
xmlRpcClientConfig.setServerURL(url);
xmlRpcClientConfig.setEnabledForExtensions(true);
xmlRpcClientConfig.setBasicEncoding(appConfig.getString(XMLRPC_BASIC_ENCODING));
xmlRpcClientConfig.setBasicPassword(appConfig.getString(XMLRPC_BASIC_PASSWORD));
xmlRpcClientConfig.setBasicUserName(appConfig.getString(XMLRPC_BASIC_USERNAME));
try {
xmlRpcClientConfig.setConnectionTimeout(appConfig.getInt(XMLRPC_CONNECTION_TIMEOUT));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setContentLengthOptional(appConfig.getBoolean(XMLRPC_CONTENT_LENGTH_OPTIONAL));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setEnabledForExceptions(appConfig.getBoolean(XMLRPC_ENABLED_FOR_EXCEPTIONS));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
xmlRpcClientConfig.setEncoding(appConfig.getString(XMLRPC_ENCODING));
try {
xmlRpcClientConfig.setGzipCompressing(appConfig.getBoolean(XMLRPC_GZIP_COMPRESSION));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setGzipRequesting(appConfig.getBoolean(XMLRPC_GZIP_REQUESTING));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
try {
xmlRpcClientConfig.setReplyTimeout(appConfig.getInt(XMLRPC_REPLY_TIMEOUT));
} catch (ConversionException ce) {
this.debug(ce);
} catch (NoSuchElementException nsee) {
this.debug(nsee);
}
xmlRpcClientConfig.setUserAgent(appConfig.getString(XMLRPC_USER_AGENT));
return xmlRpcClientConfig;
}
/**
* Logs a throwable object in debug level. Before outputting the message it checks if debug is enabled or not. If it
* is not enabled the message is not displayed and the String object is not created/concatenated, etc.
*
* @param throwable Throwable object.
*/
private void debug(Throwable throwable) {
if (LOG.isDebugEnabled()) {
LOG.debug(throwable.getMessage(), throwable);
}
}
/**
* @return XML-RPC Client.
*/
public XmlRpcClient getXmlRpcClient() {
return this.xmlRpcClient;
}
/* ------- Utility methods ------- */
/**
* @return the url
*/
public URL getUrl() {
return url;
}
/**
* @return the devKey
*/
public String getDevKey() {
return devKey;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return "TestLinkAPI [url=" + url + ", devKey=********]";
}
/* ------- TL API methods ------- */
/* XX Misc operations XX */
/**
* Checks developer key.
*
* @param devKey Developer Key.
* @return <code>true</code> if devKey is valid, <code>false</code> otherwise.
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
*/
public Boolean checkDevKey(String devKey) throws TestLinkAPIException {
return this.miscService.checkDevKey(devKey);
}
/**
* Checks if the given user exists.
*
* @param user user user name
* @return <code>true</code> if the user exists, <code>false</code> otherwise.
* @throws TestLinkAPIException if the service returns an error
*/
public Boolean doesUserExist(String user) throws TestLinkAPIException {
return this.miscService.doesUserExist(user);
}
/**
* Get user by login.
*
* @param login user login
* @return user the user
* @throws TestLinkAPIException if the service returns an error
*/
public User getUserByLogin(String login) throws TestLinkAPIException {
return this.miscService.getUserByLogin(login);
}
/**
* ping method is an alias for sayHello.
*
* @return Hello message
* @throws TestLinkAPIException if the service returns an error
*/
public String ping() throws TestLinkAPIException {
return this.sayHello();
}
/**
* Says hello to the user.
*
* @return Hello message
* @throws TestLinkAPIException if the service returns an error
*/
public String sayHello() throws TestLinkAPIException {
return this.miscService.sayHello();
}
/**
* Displays information about TL.
*
* @return About text
* @throws TestLinkAPIException if the service returns an error
*/
public String about() throws TestLinkAPIException {
return this.miscService.about();
}
/**
* Set the test mode.
*
* @param testMode test mode
* @return Test mode
* @throws TestLinkAPIException if the service returns an error
*/
public Boolean setTestMode(Boolean testMode) throws TestLinkAPIException {
return this.miscService.setTestMode(testMode);
}
/**
* Repeat the text.
*
* @param str text
* @return String repeated
* @throws TestLinkAPIException if the service returns an error
*/
public String repeat(String str) throws TestLinkAPIException {
return this.miscService.repeat(str);
}
/**
* Upload an attachment linking it to a DB table.
*
* @param fkId FK
* @param fkTable FK table name
* @param title title
* @param description description
* @param fileName file name
* @param fileType file type
* @param content content
* @return Attachment
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment uploadAttachment(Integer fkId, String fkTable, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.miscService.uploadAttachment(fkId, fkTable, title, description, fileName, fileType, content);
}
/**
* Retrieves the full path of a node. Given a nodeId of, let's say, 10, that is a test case. The return array will
* consist of Name Of Project, Name of Suite, Name of Test Case.
*
* @param nodeId node ID
* @return Array of name of nodes
* @throws TestLinkAPIException if the service returns an error
*/
public String[] getFullPath(Integer nodeId) throws TestLinkAPIException {
return this.miscService.getFullPath(nodeId);
}
/**
* Retrieves last execution result of a Test Case.
*
* @param testPlanId test plan ID
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @return Last Execution
* @throws TestLinkAPIException if the service returns an error
*/
public Execution getLastExecutionResult(Integer testPlanId, Integer testCaseId, Integer testCaseExternalId
) throws TestLinkAPIException {
return this.miscService.getLastExecutionResult(testPlanId, testCaseId, testCaseExternalId);
}
/* XX Test Project operations XX */
/**
* Creates a Test Project.
*
* @param testProjectName test project name
* @param testProjectPrefix test project prefix
* @param notes notes
* @param enableRequirements flag to enable requirements
* @param enableTestPriority flag to enable test priority
* @param enableAutomation flag to enable automation
* @param enableInventory flag to enable inventory
* @param isActive whether the project is active or not
* @param isPublic whether the project is public or not
* @return Test Project object
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
*/
public TestProject createTestProject(String testProjectName, String testProjectPrefix, String notes,
Boolean enableRequirements, Boolean enableTestPriority, Boolean enableAutomation, Boolean enableInventory,
Boolean isActive, Boolean isPublic) throws TestLinkAPIException {
return this.testProjectService.createTestProject(testProjectName, testProjectPrefix, notes, enableRequirements,
enableTestPriority, enableAutomation, enableInventory, isActive, isPublic);
}
/**
* Retrieves a Test Project by its name.
*
* @param projectName Test Project name.
* @return Test Project with given name or null if not found.
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
*/
public TestProject getTestProjectByName(String projectName) throws TestLinkAPIException {
return this.testProjectService.getTestProjectByName(projectName);
}
/**
* Retrieves the platforms of a test project.
*
* @param projectId test project ID
* @return platforms array
* @throws TestLinkAPIException if the service returns an error if an error occurs when retrieving the platforms
* @since 1.9.6-0
*/
public Platform[] getProjectPlatforms(Integer projectId) throws TestLinkAPIException {
return this.testProjectService.getProjectPlatforms(projectId);
}
/**
* Retrieves all Test Projects from TestLink.
*
* @return an array of Test Projects.
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
*/
public TestProject[] getProjects() throws TestLinkAPIException {
return this.testProjectService.getProjects();
}
/**
* Retrieves an array of Test Plans associated to a Test Project.
*
* @param projectId Test Project ID
* @return Array of Test Plans.
* @throws TestLinkAPIException if the service returns an error
*/
public TestPlan[] getProjectTestPlans(Integer projectId) throws TestLinkAPIException {
return this.testProjectService.getProjectTestPlans(projectId);
}
/**
* Uploads an attachment to a Test Project.
*
* @param testProjectId test project ID test project ID
* @param title title
* @param description description
* @param fileName file name
* @param fileType file type
* @param content content
* @return Attachment
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment uploadTestProjectAttachment(Integer testProjectId, String title, String description,
String fileName, String fileType, String content) throws TestLinkAPIException {
return this.testProjectService.uploadTestProjectAttachment(testProjectId, title, description, fileName,
fileType, content);
}
/* XX Test Plan operations XX */
/**
* Creates a Test Plan.
*
* @param planName Test Plan name.
* @param projectName Test Project name.
* @param notes Test Plan notes.
* @param isActive whether the project is active or not
* @param isPublic whether the project is public or not
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
* @return Test plan
*/
public TestPlan createTestPlan(String planName, String projectName, String notes, Boolean isActive,
Boolean isPublic) throws TestLinkAPIException {
return this.testPlanService.createTestPlan(planName, projectName, notes, isActive, isPublic);
}
/**
* Retrieves a Test Plan by its name.
*
* @param planName Test Plan name.
* @param projectName Test Project name.
* @return Test Plan.
* @throws TestLinkAPIException if the service returns an error
* @since 1.0
* @return Test plan
*/
public TestPlan getTestPlanByName(String planName, String projectName) throws TestLinkAPIException {
return this.testPlanService.getTestPlanByName(planName, projectName);
}
/**
* Retrieves Platforms of a Test Plan.
*
* @param planId Test Plan Id.
* @return Platforms
* @throws TestLinkAPIException if the service returns an error
*/
public Platform[] getTestPlanPlatforms(Integer planId) throws TestLinkAPIException {
return this.testPlanService.getTestPlanPlatforms(planId);
}
/**
* Gets stats for test plan.
*
* @param testPlanId test plan ID
* @return statistics on test plan
* @throws TestLinkAPIException if the service returns an error
*/
public Map<String, Object> getTotalsForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.testPlanService.getTotalsForTestPlan(testPlanId);
}
/**
* Removes a platform from a test plan.
*
* @param testProjectId test project ID test project ID
* @param testPlanId test plan ID
* @param platformName platform name
* @return status message
* @throws TestLinkAPIException if the service returns an error
*/
public Map<String, Object> removePlatformFromTestPlan(Integer testProjectId, Integer testPlanId,
String platformName) throws TestLinkAPIException {
return this.testPlanService.removePlatformFromTestPlan(testProjectId, testPlanId, platformName);
}
/**
* Adds a platform to a test plan.
*
* @param testProjectId test project ID test project ID
* @param testPlanId test plan ID
* @param platformName platform name
* @return status message
* @throws TestLinkAPIException if the service returns an error
*/
public Map<String, Object> addPlatformToTestPlan(Integer testProjectId, Integer testPlanId, String platformName)
throws TestLinkAPIException {
return this.testPlanService.addPlatformToTestPlan(testProjectId, testPlanId, platformName);
}
/* XX Build operations XX */
/**
* Creates a Build.
*
* @param buildId Build ID
* @param testProjectId Test Project ID
* @param testPlanId Test Plan ID
* @param customFields Custom Fields name,value pairs
* @return Response XML-RPC Response
* @throws TestLinkAPIException if the service returns as error
*/
public Map<String, Object> updateBuildCustomFields(Integer buildId, Integer testProjectId, Integer testPlanId, Map<String, String> customFields) throws TestLinkAPIException {
return this.buildService.updateBuildCustomFields(buildId, testProjectId, testPlanId, customFields);
}
/**
* Creates a Build.
*
* @param testPlanId test plan ID
* @param buildName build name
* @param buildNotes build notes
* @return Created Build
* @throws TestLinkAPIException if the service returns an error
*/
public Build createBuild(Integer testPlanId, String buildName, String buildNotes) throws TestLinkAPIException {
return this.buildService.createBuild(testPlanId, buildName, buildNotes);
}
/**
* Retrieves an Array of Builds for a given Test Plan.
*
* @param testPlanId Test Plan ID.
* @return Array of Builds.
* @throws TestLinkAPIException if the service returns an error
*/
public Build[] getBuildsForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.buildService.getBuildsForTestPlan(testPlanId);
}
/**
* Retrieves the latest Build for a given Test Plan.
*
* @param testPlanId Test Plan ID.
* @return Build.
* @throws TestLinkAPIException if the service returns an error
*/
public Build getLatestBuildForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.buildService.getLatestBuildForTestPlan(testPlanId);
}
/**
* Gets the exec counters by build.
*
* @param testPlanId test plan ID
* @return server response map
*/
public Map<String, Object> getExecCountersByBuild(Integer testPlanId) {
return this.buildService.getExecCountersByBuild(testPlanId);
}
/* XX Test Suite operations XX */
public TestSuite createTestSuite(Integer testProjectId, String name, String details, Integer parentId,
Integer order, Boolean checkDuplicatedName, ActionOnDuplicate actionOnDuplicatedName)
throws TestLinkAPIException {
return this.testSuiteService.createTestSuite(testProjectId, name, details, parentId, order, checkDuplicatedName,
actionOnDuplicatedName);
}
/**
* Retrieves Test Suites for given Ids.
*
* @param testSuiteIds List of Test Suite Ids.
* @return Array of Test Suites.
* @throws TestLinkAPIException if the service returns an error
*/
public TestSuite[] getTestSuiteByID(List<Integer> testSuiteIds) throws TestLinkAPIException {
return this.testSuiteService.getTestSuiteByID(testSuiteIds);
}
/**
* Uploads an attachment to a Test Suite.
*
* @param testSuiteId test suite ID
* @param title title
* @param description description
* @param fileName file name
* @param fileType file type
* @param content content
* @return Attachment.
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment uploadTestSuiteAttachment(Integer testSuiteId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testSuiteService.uploadTestSuiteAttachment(testSuiteId, title, description, fileName, fileType,
content);
}
/**
*
* @param testPlanId test plan ID
* @return Array of Test Suites of Test Plan.
* @throws TestLinkAPIException if the service returns an error
*/
public TestSuite[] getTestSuitesForTestPlan(Integer testPlanId) throws TestLinkAPIException {
return this.testSuiteService.getTestSuitesForTestPlan(testPlanId);
}
/**
* Get list of TestSuites which are DIRECT children of a given TestSuite
*
* @param testSuiteId test suite ID
* @throws TestLinkAPIException if the service returns an error
* @return an array of test suites
*/
public TestSuite[] getTestSuitesForTestSuite(Integer testSuiteId) throws TestLinkAPIException {
return this.testSuiteService.getTestSuitesForTestSuite(testSuiteId);
}
/**
* Get set of test suites AT TOP LEVEL of tree on a Test Project
*
* @param testProjectId test project ID
* @throws TestLinkAPIException if the service returns an error
* @return an array of test suites
*/
public TestSuite[] getFirstLevelTestSuitesForTestProject(Integer testProjectId) throws TestLinkAPIException {
return this.testSuiteService.getFirstLevelTestSuitesForTestProject(testProjectId);
}
/* XX Test Case operations XX */
/**
* Creates a Test Case.
*
* @param testCaseName test case name
* @param testSuiteId test suite ID
* @param testProjectId test project ID
* @param authorLogin author login
* @param summary summary
* @param steps steps
* @param preconditions preconditions
* @param status status
* @param importance importance
* @param execution execution
* @param order order
* @param internalId internal ID
* @param checkDuplicatedName flag to check for duplicated name
* @param actionOnDuplicatedName what to do when a duplicated name is found
* @return TestCase.
* @throws TestLinkAPIException if the service returns an error
*/
public TestCase createTestCase(String testCaseName, Integer testSuiteId, Integer testProjectId, String authorLogin,
String summary, List<TestCaseStep> steps, String preconditions, TestCaseStatus status,
TestImportance importance, ExecutionType execution, Integer order, Integer internalId,
Boolean checkDuplicatedName, ActionOnDuplicate actionOnDuplicatedName) throws TestLinkAPIException {
return this.testCaseService.createTestCase(testCaseName, testSuiteId, testProjectId, authorLogin, summary,
steps, preconditions, status, importance, execution, order, internalId, checkDuplicatedName,
actionOnDuplicatedName);
}
/**
* Update an already existing test case with the data of the given test case as a new version.
*
* @param tc new version of the test case
* @return response map
* @throws TestLinkAPIException if the service returns an error if updating the test case fails
*/
public Map<String, Object> updateTestCase(TestCase tc) throws TestLinkAPIException {
return this.testCaseService.updateTestCase(tc);
}
/**
* Create, Update or Push a list of TestCaseSteps in a Test Case.
*
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @param version version
* @param action action
* @param testCaseSteps test case steps
* @return a Map with results.
* @throws TestLinkAPIException if the service returns an error
*/
public Map<String, Object> createTestCaseSteps(Integer testCaseId, String testCaseExternalId, Integer version,
TestCaseStepAction action, List<TestCaseStep> testCaseSteps) throws TestLinkAPIException {
return this.testCaseService.createTestCaseSteps(testCaseId, testCaseExternalId, version, action, testCaseSteps);
}
/**
* Delete a list if TestCaseSteps from a Test Case.
*
* @param testCaseExternalId test case external ID
* @param version version
* @param testCaseSteps test case steps
* @return a Map with results.
* @throws TestLinkAPIException if the service returns an error
*/
public Map<String, Object> deleteTestCaseSteps(String testCaseExternalId, Integer version,
List<TestCaseStep> testCaseSteps) throws TestLinkAPIException {
return this.testCaseService.deleteTestCaseSteps(testCaseExternalId, version, testCaseSteps);
}
/**
* Adds a Test Case to a Test Plan.
*
* @param testProjectId test project ID
* @param testPlanId test plan ID
* @param testCaseId test case ID
* @param version version
* @param platformId platform ID
* @param order order
* @param urgency urgency
* @return Feature ID.
* @throws TestLinkAPIException if the service returns an error
*/
public Integer addTestCaseToTestPlan(Integer testProjectId, Integer testPlanId, Integer testCaseId, Integer version,
Integer platformId, Integer order, Integer urgency) throws TestLinkAPIException {
return this.testCaseService.addTestCaseToTestPlan(testProjectId, testPlanId, testCaseId, version, platformId,
order, urgency);
}
/**
* Retrieves Test Cases for a Test Suite.
*
* @param testSuiteId test suite ID
* @param deep flag for depth
* @param detail test case details requested
* @return Array of Test Cases of the Test Suite.
* @throws TestLinkAPIException if the service returns an error
*/
public TestCase[] getTestCasesForTestSuite(Integer testSuiteId, Boolean deep, TestCaseDetails detail)
throws TestLinkAPIException {
return this.testCaseService.getTestCasesForTestSuite(testSuiteId, deep, detail);
}
/**
* Get a test case
*
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @param version version
* @return Test Case.
* @throws TestLinkAPIException if the service returns an error
*/
public TestCase getTestCase(Integer testCaseId, Integer testCaseExternalId, Integer version)
throws TestLinkAPIException {
return this.testCaseService.getTestCase(testCaseId, testCaseExternalId, version);
}
/**
* Get a Test Case using the full external id, composed by the prefix and the external id: prefix-externalId
*
* @param fullTestCaseExternalId Full external id: prefix-externalId
* @param version version
* @return Test Case.
* @throws TestLinkAPIException if the service returns an error
*/
public TestCase getTestCaseByExternalId(String fullTestCaseExternalId, Integer version)
throws TestLinkAPIException {
return this.testCaseService.getTestCaseByExternalId(fullTestCaseExternalId, version);
}
/**
* Retrieves Test Cases for Test Plans.
*
* @param testPlanId test plan ID
* @param testCasesIds test case ID's
* @param buildId build ID
* @param keywordsIds keyword ID's
* @param keywords keywords
* @param executed flag for executed or not
* @param assignedTo assignee
* @param executeStatus execution status
* @param executionType execution type
* @param getStepInfo test case step info
* @param detail test case details
* @return Array of Test Cases of the Test Plan.
* @throws TestLinkAPIException if the service returns an error
*/
public TestCase[] getTestCasesForTestPlan(Integer testPlanId, List<Integer> testCasesIds, Integer buildId,
List<Integer> keywordsIds, String keywords, // , separated e.g.:
// database,performance
Boolean executed, List<Integer> assignedTo, String[] executeStatus, // ,
// separated
// e.g.:
// p,n,f
ExecutionType executionType, Boolean getStepInfo, TestCaseDetails detail) throws TestLinkAPIException {
return this.testCaseService.getTestCasesForTestPlan(testPlanId, testCasesIds, buildId, keywordsIds, keywords,
executed, assignedTo, executeStatus, executionType, getStepInfo, detail);
}
/**
* Get a test case ID by a test case Name
*
* @param testCaseName test case name
* @param testSuiteName test suite name
* @param testProjectName test project name
* @param testCasePathName test case path name
* @return Test Case ID.
* @throws TestLinkAPIException if the service returns an error
*/
public Integer getTestCaseIDByName(String testCaseName, String testSuiteName, String testProjectName,
String testCasePathName) throws TestLinkAPIException {
return this.testCaseService.getTestCaseIDByName(testCaseName, testSuiteName, testProjectName, testCasePathName);
}
/**
* Uploads an attachment to a Test Case.
*
* @param testCaseId test case ID
* @param title title
* @param description description
* @param fileName file name
* @param fileType file type
* @param content content
* @return Attachment.
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment uploadTestCaseAttachment(Integer testCaseId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testCaseService.uploadTestCaseAttachment(testCaseId, title, description, fileName, fileType,
content);
}
/**
* Return an array of attachments of a Test Case.
*
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @return Array of Attachments
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment[] getTestCaseAttachments(Integer testCaseId, Integer testCaseExternalId)
throws TestLinkAPIException {
return this.testCaseService.getTestCaseAttachments(testCaseId, testCaseExternalId);
}
/**
* Upload an execution attachment.
*
* @param executionId execution ID
* @param title title
* @param description description
* @param fileName file name
* @param fileType file type
* @param content content
* @return attachment
* @throws TestLinkAPIException if the service returns an error
*/
public Attachment uploadExecutionAttachment(Integer executionId, String title, String description, String fileName,
String fileType, String content) throws TestLinkAPIException {
return this.testCaseService.uploadExecutionAttachment(executionId, title, description, fileName, fileType,
content);
}
/**
* Deletes an execution.
*
* @param executionId Execution Id.
* @throws TestLinkAPIException if the service returns an error
*/
public void deleteExecution(Integer executionId) throws TestLinkAPIException {
this.testCaseService.deleteExecution(executionId);
}
/**
* Reports a Test Case result.
*
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @param testPlanId test plan ID
* @param status status
* @param buildId build ID
* @param buildName build name
* @param notes notes
* @param guess flag to guess other parameters or not
* @param bugId bug ID
* @param platformId platform ID
* @param platformName platform name
* @param customFields custom fields
* @param overwrite flag to overwrite or not
* @throws TestLinkAPIException if the service returns an error
* @return report test case result server response
*/
public ReportTCResultResponse reportTCResult(Integer testCaseId, Integer testCaseExternalId, Integer testPlanId,
ExecutionStatus status, Integer buildId, String buildName, String notes, Boolean guess, String bugId,
Integer platformId, String platformName, Map<String, String> customFields, Boolean overwrite)
throws TestLinkAPIException {
return this.testCaseService.reportTCResult(testCaseId, testCaseExternalId, testPlanId, status, buildId,
buildName, notes, guess, bugId, platformId, platformName, customFields, overwrite);
}
/**
* Reports a Test Case result.
*
* @param testCaseId test case ID
* @param testCaseExternalId test case external ID
* @param testPlanId test plan ID
* @param status status