Permalink
Browse files

Added the Author View

  • Loading branch information...
email2vimalraj committed Apr 12, 2017
1 parent c458e8a commit 19b34e5732b0f4ca0aa4ea7ba1db366bcec90985
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -143,7 +143,7 @@ synchronized void addScreencast(Test test, Screencast screencast) throws IOExcep
});
}
protected TestAttributeTestContextProvider<Author> getAuthorContextInfo() {
protected TestAttributeTestContextProvider<Author> getAuthorContextInfo() {
return authorContext;
}
@@ -234,6 +234,7 @@ private synchronized void notifyReporters() {
x.setTestList(testCollection);
x.setCategoryContextInfo(categoryContext);
x.setAuthorContextInfo(authorContext);
x.setExceptionContextInfo(exceptionContextBuilder);
x.setSystemAttributeContext(systemAttributeContext);
x.setTestRunnerLogs(testRunnerLogs);
@@ -2,6 +2,7 @@
import java.util.List;
import com.aventstack.extentreports.model.Author;
import com.aventstack.extentreports.model.Category;
import com.aventstack.extentreports.model.Test;
@@ -38,6 +39,13 @@
* @param categoryContext collection containing categories and all associated tests
*/
void setCategoryContextInfo(TestAttributeTestContextProvider<Category> categoryContext);
/**
* Allows sharing the complete list of author and associated tests with the reporter
*
* @param authorContext collection containing author and all associated tests
*/
void setAuthorContextInfo(TestAttributeTestContextProvider<Author> authorContext);
/**
* Allows sharing the complete list of exceptions and associated tests with the reporter
@@ -29,9 +29,7 @@ public void setAttributeContext(T attr, Test test) {
boolean b = testList
.stream()
.filter(t -> t.getID() == test.getID())
.findFirst()
.isPresent();
.anyMatch(t -> t.getID() == test.getID());
if (!b)
testOptionalTestContext.get().setTest(test);
@@ -46,7 +44,7 @@ public void setAttributeContext(T attr, Test test) {
}
}
public List<TestAttributeTestContext> getCategoryTestContextList() {
public List<TestAttributeTestContext> getTestAttributeTestContextList() {
return testAttrCollection;
}
@@ -23,6 +23,7 @@
import com.aventstack.extentreports.configuration.Config;
import com.aventstack.extentreports.configuration.ConfigLoader;
import com.aventstack.extentreports.configuration.ConfigMap;
import com.aventstack.extentreports.model.Author;
import com.aventstack.extentreports.model.Category;
import com.aventstack.extentreports.model.Test;
@@ -47,9 +48,10 @@
protected ConfigMap configContext;
protected ExceptionTestContextImpl exceptionContext;
protected TestAttributeTestContextProvider<Category> categoryContext;
protected TestAttributeTestContextProvider<Author> authorContext;
protected SystemAttributeContext systemAttributeContext;
protected SessionStatusStats sc;
public AbstractReporter() {
setStartTime(Calendar.getInstance().getTime());
}
@@ -129,6 +131,14 @@ public void setCategoryContextInfo(TestAttributeTestContextProvider<Category> ca
return categoryContext;
}
public void setAuthorContextInfo(TestAttributeTestContextProvider<Author> authorContext) {
this.authorContext = authorContext;
}
public TestAttributeTestContextProvider<Author> getAuthorContextInfo() {
return authorContext;
}
@Override
public void setTestRunnerLogs(List<String> testRunnerLogs) {
this.testRunnerLogs = testRunnerLogs;
@@ -0,0 +1,83 @@
<#if authorContext?? && authorContext?size != 0>
<div id='author-view' class='view hide'>
<section id='controls'>
<div class='controls grey lighten-4'>
<!-- search -->
<div class='chip transparent' alt='Search Authors' title='Search Authors'>
<a href="#" class='search-div'>
<i class='material-icons'>search</i> Search
</a>
<div class='input-field left hide'>
<input id='search-tests' type='text' class='validate browser-default' placeholder='Search Authors...'>
</div>
</div>
<!-- search -->
</div>
</section>
<div class='subview-left left'>
<div class='view-summary'>
<h5>Authors</h5>
<ul id='author-collection' class='author-collection'>
<#list authorContext as author>
<li class='author displayed active'>
<div class='author-heading'>
<span class='author-name'>${ author.name }</span>
<span class='author-status right'>
<#if author.passed != 0>
<span class='label pass'>${ author.passed }</span>
</#if>
<#if author.failed != 0>
<span class='label fail'>${ author.failed }</span>
</#if>
<#if author.others != 0>
<span class='label others'>${ author.others }</span>
</#if>
</span>
</div>
<div class='author-content hide'>
<div class='author-status-counts'>
<#if author.passed != 0><span class='label green accent-4 white-text'>Passed: ${ author.passed }</span></#if>
<#if author.failed != 0><span class='label red lighten-1 white-text'>Failed: ${ author.failed }</span></#if>
<#if author.others != 0><span class='label yellow darken-2 white-text'>Others: ${ author.others }</span></#if>
</div>
<div class='author-tests'>
<table class='bordered table-results'>
<thead>
<tr>
<th>Timestamp</th>
<th>TestName</th>
<th>Status</th>
</tr>
</thead>
<tbody>
<#list author.getTestList() as test>
<tr>
<td>${ test.startTime?datetime?string["${timeStampFormat}"] }</td>
<td class='linked' test-id='${ test.getID() }'>${ test.hierarchicalName }</td>
<td><span class='test-status ${ test.status }'>${ test.status }</span></td>
</tr>
</#list>
</tbody>
</table>
</div>
</div>
</li>
</#list>
</ul>
</div>
</div>
<div class='subview-right left'>
<div class='view-summary'>
<h5 class='author-name'></h5>
</div>
</div>
</div>
</#if>
@@ -6,7 +6,8 @@
<#assign extentxUrl=config.containsKey('extentx-url')?then(config.getValue('extentx-url'), '')>
<#assign systemAttributeContext=report.getSystemAttributeContext().getSystemAttributeList()>
<#assign categoryContext=report.getCategoryContextInfo().getCategoryTestContextList()>
<#assign categoryContext=report.getCategoryContextInfo().getTestAttributeTestContextList()>
<#assign authorContext=report.getAuthorContextInfo().getTestAttributeTestContextList()>
<#assign exceptionContext=report.getExceptionContextInfo().getExceptionTestContextList()>
<#assign parentCount=report.statusCount.parentCount>
@@ -53,6 +54,7 @@
<#include 'test-view/test-view.ftl'>
<#include 'category-view/category-view.ftl'>
<#include 'author-view/author-view.ftl'>
<#include 'exception-view/exception-view.ftl'>
<#include 'dashboard-view/dashboard-view.ftl'>
<#include 'logs-view/testrunner-logs-view.ftl'>
@@ -8,6 +8,9 @@
<#if categoryContext?? && categoryContext?size != 0>
<li class='waves-effect'><a href='#!' view='category-view' onclick="configureView(1)"><i class='material-icons'>label_outline</i></a></li>
</#if>
<#if authorContext?? && authorContext?size != 0>
<li class='waves-effect'><a href='#!' view='author-view' onclick="configureView(3)"><i class='material-icons'>person</i></a></li>
</#if>
<#if exceptionContext?? && exceptionContext?size != 0>
<li class='waves-effect'><a href='#!' view='exception-view' onclick="configureView(2)"><i class='material-icons'>bug_report</i></a></li>
</#if>
Oops, something went wrong.

0 comments on commit 19b34e5

Please sign in to comment.