This repository has been archived by the owner on Nov 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#244 sample things for refactor - not working yet
- Loading branch information
1 parent
933eef5
commit 0b55684
Showing
8 changed files
with
300 additions
and
21 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
bb-junit/src/main/java/com/cognifide/qa/bb/junit/listener/ReportCollectorListener.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.cognifide.qa.bb.junit.listener; | ||
|
||
public class ReportCollectorListener { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>bobcat</artifactId> | ||
<groupId>com.cognifide.qa.bb</groupId> | ||
<version>1.4.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>bb-reports-allure</artifactId> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.cognifide.qa.bb</groupId> | ||
<artifactId>bb-reports</artifactId> | ||
<version>${project.version}</version> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>io.qameta.allure</groupId> | ||
<artifactId>allure-junit4</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
39 changes: 39 additions & 0 deletions
39
bb-reports-allure/src/main/java/com/cognifide/qa/bb/logging/allure/AllureModule.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/*- | ||
* #%L | ||
* Bobcat | ||
* %% | ||
* Copyright (C) 2018 Cognifide Ltd. | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
package com.cognifide.qa.bb.logging.allure; | ||
|
||
import com.cognifide.qa.bb.logging.allure.reporter.AllureReporter; | ||
import com.cognifide.qa.bb.logging.reporter.provider.CustomReportBinder; | ||
import com.google.inject.AbstractModule; | ||
import com.google.inject.multibindings.Multibinder; | ||
|
||
/** | ||
* Guice module that will allow Allure Reporter to be run | ||
*/ | ||
public class AllureModule extends AbstractModule { | ||
|
||
@Override | ||
protected void configure() { | ||
Multibinder<CustomReportBinder> customReportersBinder = Multibinder.newSetBinder(binder(), | ||
CustomReportBinder.class); | ||
customReportersBinder.addBinding() | ||
.toInstance(new CustomReportBinder("allure", AllureReporter.class)); | ||
} | ||
} |
138 changes: 138 additions & 0 deletions
138
...orts-allure/src/main/java/com/cognifide/qa/bb/logging/allure/reporter/AllureReporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/*- | ||
* #%L | ||
* Bobcat | ||
* %% | ||
* Copyright (C) 2018 Cognifide Ltd. | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
package com.cognifide.qa.bb.logging.allure.reporter; | ||
|
||
import com.cognifide.qa.bb.logging.TestInfo; | ||
import com.cognifide.qa.bb.logging.entries.AssertionFailedEntry; | ||
import com.cognifide.qa.bb.logging.entries.BrowserInfoEntry; | ||
import com.cognifide.qa.bb.logging.entries.BrowserLogEntry; | ||
import com.cognifide.qa.bb.logging.entries.ErrorEntry; | ||
import com.cognifide.qa.bb.logging.entries.EventEntry; | ||
import com.cognifide.qa.bb.logging.entries.ExceptionEntry; | ||
import com.cognifide.qa.bb.logging.entries.InfoEntry; | ||
import com.cognifide.qa.bb.logging.entries.ScreenshotEntry; | ||
import com.cognifide.qa.bb.logging.entries.SoftAssertionFailedEntry; | ||
import com.cognifide.qa.bb.logging.entries.SubreportEndEntry; | ||
import com.cognifide.qa.bb.logging.entries.SubreportStartEntry; | ||
import com.cognifide.qa.bb.logging.reporter.AbstractReporter; | ||
import io.qameta.allure.Allure; | ||
import io.qameta.allure.AllureLifecycle; | ||
import io.qameta.allure.model.TestResult; | ||
import java.util.Properties; | ||
import java.util.UUID; | ||
|
||
public class AllureReporter extends AbstractReporter { | ||
|
||
private final ThreadLocal<String> testCases = new InheritableThreadLocal<String>() { | ||
@Override | ||
protected String initialValue() { | ||
return UUID.randomUUID().toString(); | ||
} | ||
}; | ||
|
||
private final AllureLifecycle lifecycle = Allure.getLifecycle(); | ||
|
||
@Override | ||
public void suiteStart() { | ||
//Nothing now | ||
} | ||
|
||
@Override | ||
public void suiteEnd() { | ||
//Nothing now | ||
} | ||
|
||
@Override | ||
public void testStart(TestInfo testInfo) { | ||
final String uuid = testCases.get(); | ||
final TestResult result = createTestResult(uuid, testInfo); | ||
lifecycle.scheduleTestCase(result); | ||
lifecycle.startTestCase(uuid); | ||
} | ||
|
||
@Override | ||
public void testEnd(TestInfo testInfo) { | ||
|
||
} | ||
|
||
@Override | ||
public void errorEntry(ErrorEntry errorLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void exceptionEntry(ExceptionEntry exceptionLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void screenshotEntry(ScreenshotEntry screenshotLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void infoEntry(InfoEntry infoEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void eventEntry(EventEntry eventLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void subreportStart(SubreportStartEntry subreportStartLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void subreportEnd(SubreportEndEntry subreportEndLogEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void browserInfoEntry(BrowserInfoEntry browserInfoEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void assertion(AssertionFailedEntry assertionFailedEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void softAssertion(SoftAssertionFailedEntry softAssertionFailedEntry) { | ||
|
||
} | ||
|
||
@Override | ||
public void properties(Properties properties) { | ||
|
||
} | ||
|
||
@Override | ||
public void browserLogEntry(BrowserLogEntry browserLogEntry) { | ||
|
||
} | ||
|
||
private TestResult createTestResult(String uuid, TestInfo testInfo) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...ports/src/main/java/com/cognifide/qa/bb/logging/reporter/provider/CustomReportBinder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/*- | ||
* #%L | ||
* Bobcat | ||
* %% | ||
* Copyright (C) 2018 Cognifide Ltd. | ||
* %% | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
* #L% | ||
*/ | ||
package com.cognifide.qa.bb.logging.reporter.provider; | ||
|
||
import com.cognifide.qa.bb.reporter.Reporter; | ||
|
||
/** | ||
* Allows to create custom bindings for report generators. | ||
* Pair name (for configuration) and class is required | ||
*/ | ||
public class CustomReportBinder { | ||
|
||
private final String name; | ||
|
||
private final Class<? extends Reporter> className; | ||
|
||
public CustomReportBinder(String name, Class<? extends Reporter> className) { | ||
this.name = name; | ||
this.className = className; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public Class<? extends Reporter> getClassName() { | ||
return className; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.