Skip to content

Commit e9d52e6

Browse files
committed
new tests after contribution by chombourger (private ticket 6369: APIs for listing project test plans and test cases)
1 parent 6ea6990 commit e9d52e6

6 files changed

Lines changed: 99 additions & 3 deletions

File tree

rest-api/v1/curl/testproject/getAllTestProjects.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
# Posting data from a file named 'foobar' would thus be done with --data @foobar.
1111
#
1212
echo 'Testing TestLink REST API - GET /testprojects'
13-
curl -i -X GET -u dev01xxx:dev01 http://localhost/development/tlrepo/lib/api/rest/v1/testprojects
13+
curl -i -X GET -u dev01xxx:dev01 http://localhost/development/test_tl/testlink/lib/api/rest/v1/testprojects
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/sh
2+
# curl -i -X POST -u dev01:dev01 http://localhost/development/tlrepo/lib/api/rest/v1/testprojects
3+
# -i include headers
4+
# -X (HTTP) Specifies a custom request method to use when communicating with the HTTP server
5+
# -u user:password
6+
# --data If you start the data with the letter @, the rest should be a file name to read the data from,
7+
# or - if you want curl to read the data from stdin.
8+
# The contents of the file must already be URL-encoded.
9+
# Multiple files can also be specified.
10+
# Posting data from a file named 'foobar' would thus be done with --data @foobar.
11+
#
12+
echo 'Testing TestLink REST API - GET /testprojects/94/testcases'
13+
curl -i -X GET -u admin:noway http://localhost/development/test_tl/testlink/lib/api/rest/v1/testprojects/94/testcases
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/usr/bin/sh
2+
# curl -i -X POST -u dev01:dev01 http://localhost/development/tlrepo/lib/api/rest/v1/testprojects
3+
# -i include headers
4+
# -X (HTTP) Specifies a custom request method to use when communicating with the HTTP server
5+
# -u user:password
6+
# --data If you start the data with the letter @, the rest should be a file name to read the data from,
7+
# or - if you want curl to read the data from stdin.
8+
# The contents of the file must already be URL-encoded.
9+
# Multiple files can also be specified.
10+
# Posting data from a file named 'foobar' would thus be done with --data @foobar.
11+
#
12+
echo 'Testing TestLink REST API - GET /testprojects/94/testplans'
13+
curl -i -X GET -u admin:noway http://localhost/development/test_tl/testlink/lib/api/rest/v1/testprojects/94/testplans

rest-api/v1/php/testproject/getProjects.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
// curl -i -X GET -u dev01:dev01 http://localhost/development/tlrepo/lib/api/rest/v1/testprojects
2525
// -i include headers
2626
// -X (HTTP) Specifies a custom request method to use when communicating with the HTTP server
27-
$pest = new Pest('http://localhost/development/tlrepo/lib/api/rest/v1/');
27+
$pest = new Pest('http://localhost/development/test_tl/testlink/lib/api/rest/v1/');
2828
}
2929

30-
$password = $user = 'dev01';
30+
$password = $user = 'admin';
3131
$pest->setupAuth($user, $password);
3232

3333
echo '<b>Access ALL TESTPROJECTS</b><br>';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* @filesource getTestPlansInTestProjects.php
4+
* Bare bones test for REST API GET /testprojects
5+
*
6+
* @author Francisco Mancardi (francisco.mancardi@gmail.com)
7+
*
8+
*/
9+
require '../../../common/pest/Pest.php';
10+
11+
if(!isset($_REQUEST['env']))
12+
{
13+
die('env not provided: valid options: bit,gito - call URL?env=');
14+
}
15+
16+
if($_REQUEST['env'] == 'bit')
17+
{
18+
$pest = new Pest('http://localhost/development/bitbucket/testlink/lib/api/rest/v1/');
19+
}
20+
21+
if($_REQUEST['env'] == 'gito')
22+
{
23+
// How to test using cUrl
24+
// curl -i -X GET
25+
// -i include headers
26+
// -X (HTTP) Specifies a custom request method to use when communicating with the HTTP server
27+
$pest = new Pest('http://localhost/development/test_tl/testlink/lib/api/rest/v1/');
28+
}
29+
30+
$password = $user = 'admin';
31+
$pest->setupAuth($user, $password);
32+
33+
echo '<b>Access ALL TEST CASES present in a test project </b><br>';
34+
$thing = json_decode($pest->get('/testprojects/94/testcases'));
35+
echo '<pre>';var_dump($thing);echo '<pre><br>';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
/**
3+
* @filesource getTestPlansInTestProjects.php
4+
* Bare bones test for REST API GET /testprojects
5+
*
6+
* @author Francisco Mancardi (francisco.mancardi@gmail.com)
7+
*
8+
*/
9+
require '../../../common/pest/Pest.php';
10+
11+
if(!isset($_REQUEST['env']))
12+
{
13+
die('env not provided: valid options: bit,gito - call URL?env=');
14+
}
15+
16+
if($_REQUEST['env'] == 'bit')
17+
{
18+
$pest = new Pest('http://localhost/development/bitbucket/testlink/lib/api/rest/v1/');
19+
}
20+
21+
if($_REQUEST['env'] == 'gito')
22+
{
23+
// How to test using cUrl
24+
// curl -i -X GET
25+
// -i include headers
26+
// -X (HTTP) Specifies a custom request method to use when communicating with the HTTP server
27+
$pest = new Pest('http://localhost/development/test_tl/testlink/lib/api/rest/v1/');
28+
}
29+
30+
$password = $user = 'admin';
31+
$pest->setupAuth($user, $password);
32+
33+
echo '<b>Access ALL TEST PLANS present in a test project (Accessible to user ??) </b><br>';
34+
$thing = json_decode($pest->get('/testprojects/94/testplans'));
35+
echo '<pre>';var_dump($thing);echo '<pre><br>';

0 commit comments

Comments
 (0)