From version < 1.14 >
edited by XWikiGuest
on 2013/06/11 13:55
To version < 2.1 >
edited by Sorin Burjan
on 2013/06/11 13:55
< >
Change comment: Import: final save

Summary

Details

Page properties
Title
... ... @@ -1,0 +1,1 @@
1 +Test Reporting Application LiveTable Results
Parent
... ... @@ -1,0 +1,1 @@
1 +XWiki.WebHome
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.XWikiGuest
1 +xwiki:XWiki.Sorin
Hidden
... ... @@ -1,1 +1,1 @@
1 -false
1 +true
Content
... ... @@ -1,0 +1,113 @@
1 +{{include document="XWiki.LiveTableResultsMacros"/}}
2 +{{velocity wiki="false"}}
3 +#if($xcontext.action == 'get' && "$!{request.outputSyntax}" == 'plain')
4 + #set($test = $request.test)
5 + #set($product = $request.product)
6 + #set($sortColumn = $request.sort)
7 + #set($sortDir = $request.dir)
8 + ## $sortColumn
9 + ## $sortDir
10 + ## &sort=test&dir=asc
11 + #set($orderBy = "execution.${sortColumn} ${sortDir}")
12 + $response.setContentType('application/json')
13 + ##
14 + ## Manually generate the JSON
15 + ##
16 + #set($map = {})
17 + #set($rows = [])
18 + ##
19 + #set($offset = $mathtool.toInteger($request.get('offset')))
20 + ## offset starts from 0 in velocity and 1 in javascript
21 + #set($offset = $offset - 1)
22 + #if (!$offset || $offset < 0)
23 + #set($offset = 0)
24 + #end
25 + ##
26 + ## $offset
27 + #set($discard = $map.put('reqNo', $mathtool.toInteger($request.reqNo)))
28 + ## #set($discard = $map.put('tags', []))
29 + #set($dataQuery = "select execution.test, execution.product, execution.browser, execution.database, execution.user, execution.date, execution.passed, execution.jira from Document as doc, doc.object(QA.ExecutionClass) as execution where doc.fullName <> 'QA.ExecutionTemplate'")
30 + ##
31 + #set($countQuery = "select count(execution) from Document as doc, doc.object(QA.ExecutionClass) as execution where doc.fullName <> 'QA.ExecutionTemplate'")
32 + ##
33 + #if("$!test" != '' && "$!product" == '')
34 + #set($dataQuery = $services.query.xwql("${dataQuery} and execution.test = :test order by $orderBy").bindValue('test', $test))
35 + #set($countQuery = $services.query.xwql("${countQuery} and execution.test = :test").bindValue('test', $test))
36 + #end
37 + #if("$!product" != '' && "$!test" == '')
38 + #set($dataQuery = $services.query.xwql("${dataQuery} and execution.product = :product order by $orderBy").bindValue('product', $product))
39 + #set($countQuery = $services.query.xwql("${countQuery} and execution.product = :product").bindValue('product', $product))
40 + #end
41 + #set($count = $countQuery.execute())
42 + ## $count
43 + #set($discard = $map.put('totalrows', $count))
44 + #set($limit = $mathtool.toInteger($request.get('limit')))
45 + #set($items = $dataQuery.setLimit($limit).setOffset($offset).execute())
46 + #set($discard = $map.put('returnedrows', $mathtool.min($items.size(), $limit)))
47 + #set($discard = $map.put('offset', $mathtool.add($offset, 1)))
48 + ## #set($discard = $map.put('offset', $offset))
49 + ##
50 + #foreach($item in $items)
51 + #set($row = {})
52 + ## We need this in order to make the row show up in the LiveTable
53 + #set($discard = $row.put('doc_viewable', 'true'))
54 + #set($testDocument = $xwiki.getDocument($item.get(0)))
55 + #if(!$testDocument.isNew())
56 + #set($discard = $row.put('test', "<a href=""$testDocument.getURL()"">$testDocument.getName()</a>"))
57 + #else
58 + #set($discard = $row.put('test', "<a href=""$testDocument.getURL()"">$testDocument</a>"))
59 + #end
60 + ##
61 + #set($productDocument = $xwiki.getDocument($item.get(1)))
62 + #if(!$productDocument.isNew())
63 + #set($productName = $productDocument.getObject('QA.ProductClass').getProperty('name').getValue())
64 + #set($productVersion = $productDocument.getObject('QA.ProductClass').getProperty('version').getValue())
65 + #set($discard = $row.put('product', "<a href=""$productDocument.getURL()"">$!productName $!productVersion</a>"))
66 + #else
67 + #set($discard = $row.put('product', "<a href=""$productDocument.getURL()"">$productDocument</a>"))
68 + #end
69 + ##
70 + #set($browserDocument = $xwiki.getDocument($item.get(2)))
71 + #if(!$browserDocument.isNew())
72 + #set($browserName = $browserDocument.getObject('QA.BrowserClass').getProperty('name').getValue())
73 + #set($browserVersion = $browserDocument.getObject('QA.BrowserClass').getProperty('version').getValue())
74 + #set($browserIconURL = $doc.getAttachmentURL("${browserName}.png"))
75 + #set($discard = $row.put('browser', "<img src=""$browserIconURL""/> <span>$!browserName $!browserVersion</span>"))
76 + #else
77 + #set($discard = $row.put('browser', "$browserDocument"))
78 + #end
79 + ##
80 + #set($databaseDocument = $xwiki.getDocument($item.get(3)))
81 + #if(!$databaseDocument.isNew())
82 + #set($databaseName = $databaseDocument.getObject('QA.DatabaseClass').getProperty('name').getValue())
83 + #set($databaseVersion = $databaseDocument.getObject('QA.DatabaseClass').getProperty('version').getValue())
84 + #set($databaseIconURL = $doc.getAttachmentURL("${databaseName}.png"))
85 + #set($discard = $row.put('database', "<img src=""$databaseIconURL""/> <span>$!databaseName $!databaseVersion</span>"))
86 + #else
87 + #set($discard = $row.put('database', "$databaseDocument"))
88 + #end
89 + ##
90 + #set($discard = $row.put('user', "$xwiki.getUserName($item.get(4), true)"))
91 + ## use API to get the XWiki date format
92 + #set($discard = $row.put('date', $datetool.format("dd-MM-yyyy hh:mm", $item.get(5).getTime())))
93 + #if($item.get(6) == '1')
94 + #set($passedHTML = "<img src=""/xwiki/resources/icons/silk/accept.png""/><span> Passed</span>")
95 + #else
96 + #set($passedHTML = "<img src=""/xwiki/resources/icons/silk/cancel.png""/><span> Failed</span>")
97 + #end
98 + #set($discard = $row.put('passed', $passedHTML))
99 + ##
100 + #set($discard = $row.put('jira'," <a href=""$item.get(7)"">$item.get(7)</a>"))
101 + #set($discard = $rows.add($row))
102 + #end
103 + ##
104 + #set($discard = $map.put('rows', $rows))
105 +## Rows Size: $rows.size()
106 +## #foreach($item in $rows)
107 +## $velocityCount $item
108 +## #end
109 + $jsontool.serialize($map)
110 +#else
111 + Custom LiveTableResults page to compute the results for LiveTables which are used on TestSheet and ProductSheet pages
112 +#end
113 +{{/velocity}}


Custom LiveTableResults page to compute the results for LiveTables which are used on TestSheet and ProductSheet pages

Get Connected