Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Gson builder in ContextExporter #418

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@
import eu.tsystems.mms.tic.testframework.webdrivermanager.DesktopWebDriverRequest;
import eu.tsystems.mms.tic.testframework.webdrivermanager.WebDriverRequest;
import org.openqa.selenium.By;
import org.openqa.selenium.MutableCapabilities;
import org.openqa.selenium.Platform;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.logging.LoggingPreferences;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.testng.Assert;
Expand Down Expand Up @@ -177,4 +179,18 @@ public void testT08_ChromeExtensions() {

}

/**
* This test generates special caps to test a successful export of all test context in `ContextExporter`.
* If a report of all integration tests is generated this test has no impact.
* https://github.com/telekom/testerra/issues/409
*/
@Test
public void testT09_SpecialCapsForContextExport() {
DesktopWebDriverRequest request = new DesktopWebDriverRequest();
MutableCapabilities capabilities = request.getMutableCapabilities();
LoggingPreferences logPrefs = new LoggingPreferences();
capabilities.setCapability("goog:loggingPrefs", logPrefs);
WEB_DRIVER_MANAGER.getWebDriver(request);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import com.google.common.net.MediaType;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.inject.Injector;
import eu.tsystems.mms.tic.testframework.common.Testerra;
import eu.tsystems.mms.tic.testframework.internal.IdGenerator;
Expand Down Expand Up @@ -71,6 +72,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.Level;

import java.lang.reflect.Modifier;
import java.time.Instant;
import java.util.Arrays;
import java.util.Date;
Expand All @@ -89,7 +91,7 @@ public class ContextExporter implements Loggable {
private final Map<Status, ResultStatusType> RESULT_STATUS_MAPPING = new LinkedHashMap<>();
private final Map<Class, FailureCorridorValue> FAILURE_CORRIDOR_MAPPING = new LinkedHashMap<>();
private final Report report = injector.getInstance(Report.class);
private final Gson jsonEncoder = new Gson();
private final Gson jsonEncoder = new GsonBuilder().excludeFieldsWithModifiers(Modifier.PRIVATE).create();

public MethodContext.Builder buildMethodContext(eu.tsystems.mms.tic.testframework.report.model.context.MethodContext methodContext) {
MethodContext.Builder builder = MethodContext.newBuilder();
Expand Down