Please help!!
I try to use the ExtentHtmlReporter to create a costume report name like "MyReport.html" but it generate an "index.html" file instead.
By the way I'm using ExtentReports 4.1.0. and C# in VS 2019.
Here is my code
//var htmlReporter = new ExtentHtmlReporter("C:\\DevEnvironment\\MyReport.html");
var htmlReporter = new ExtentHtmlReporter(#"C:\DevEnvironment\MyReport.html");
htmlReporter.Config.Theme = Theme.Standard;
htmlReporter.Config.DocumentTitle = "My Test Report";
htmlReporter.Config.ReportName = "Positive and Negative Test";
_extent.AddSystemInfo("Environment", "OS Widows");
_extent.AddSystemInfo("User Name", "Qlee");
_extent.AttachReporter(htmlReporter);
Thanks for your help.
This is the expected behavior with the version4 HtmlReporter. It creates upto 4 files depending upon the attributes that are created. This is also true for all new version4 reporters, to maximize performance and obviously to keep each file focused on its specific tasks.
If you would like the old behavior, use the version3 port of HtmlReporter:
var v3html = new ExtentV3HtmlReporter()
Related
I'm trying to automate the creation of an exact copy of an Analysis Services database using Microsoft.AnalysisServices namespace. My code is:
using (var server = new Server())
{
server.Connect(connString);
var newDb = server.Databases.GetByName(dbName).Clone();
newDb.Name = newDbName;
newDb.ID = server.Databases.GetNewID();
server.Databases.Add(newDb);
newDb.Update(UpdateOptions.ExpandFull);
server.Disconnect();
}
However it seems it creates an empty database instead because from SSMS i'm not able to see any tables, datasources and similar (check my screenshot here).
Is there a way to fix this? Thanks.
#gmarchi
You need to clone the child Model object using Model.clone() method as well to make to make it work. You can add Model using code like below -
var connString = "Provider=MSOLAP;Data Source=asazure://westus2.asazure.windows.net/xxxxxxxxxxxx:rw";
var dbName = "AW Internet Sales";
var newDbName = "CloneDb";
using (var server = new Server())
{
server.Connect(connString);
var newDb = server.Databases.GetByName(dbName).Clone();
var newModel = server.Databases.GetByName(dbName).Model.Clone();
newDb.Name = newDbName;
newDb.ID = server.Databases.GetNewID();
newDb.Model = newModel;
server.Databases.Add(newDb);
newDb.Update(UpdateOptions.ExpandFull);
server.Disconnect();
}
Please find below the screenshot after the code run.
Please let me know if you have any questions.
Thanks.
I have read a lot of questions and answers, but are not really satisfied and successful
My Problem: write with Kotlin to a sdcard to a specific directory
Working is
var filenamex = "export.csv"
var patt = getExternalFilesDirs(null)
var path = patt[1]
//create fileOut object
var fileOut = File(path, filenamex)
//create a new file
fileOut.createNewFile()
with getExternalFIlesDirs() I get the external storage and the sdcard. With path = patt[1] i get the adress of my sd-card.
this is
"/storage/105E-XXXX/Android/data/com.example.myApp/files"
This works to write data in this directory.
But I would like to write into an other directory, for example
"/sdcard/myApp"
A lot of examples say, this should work, bit it does not.
So I tried to take
"/storage/105E-XXXX/myApp"
Why doesn't it work? Ist the same beginning of storage /storage/105E-XXXX/, so it is MY sd-card.?
As I mentioned, it works on the sd-card, so it is not a problem of write-permission to the sdcard?
Any idea?
(I also failed with FileOutputStream and other things)
Try Out this..
var filenamex = "export.csv"
var path = getExternalStorageDirectory() + "//your desired folder"
var fileOut = File(path, filenamex)
fileOut.createNewFile()
RavenDB throws InvalidOperationException when IsOperationAllowedOnDocument is called using embedded mode.
I can see in the IsOperationAllowedOnDocument implementation a clause checking for calls in embedded mode.
namespace Raven.Client.Authorization
{
public static class AuthorizationClientExtensions
{
public static OperationAllowedResult[] IsOperationAllowedOnDocument(this ISyncAdvancedSessionOperation session, string userId, string operation, params string[] documentIds)
{
var serverClient = session.DatabaseCommands as ServerClient;
if (serverClient == null)
throw new InvalidOperationException("Cannot get whatever operation is allowed on document in embedded mode.");
Is there a workaround for this other than not using embedded mode?
Thanks for your time.
I encountered the same situation while writing some unit tests. The solution James provided worked; however, it resulted in having one code path for the unit test and another path for the production code, which defeated the purpose of the unit test. We were able to create a second document store and connect it to the first document store which allowed us to then access the authorization extension methods successfully. While this solution would probably not be good for production code (because creating Document Stores is expensive) it works nicely for unit tests. Here is a code sample:
using (var documentStore = new EmbeddableDocumentStore
{ RunInMemory = true,
UseEmbeddedHttpServer = true,
Configuration = {Port = EmbeddedModePort} })
{
documentStore.Initialize();
var url = documentStore.Configuration.ServerUrl;
using (var docStoreHttp = new DocumentStore {Url = url})
{
docStoreHttp.Initialize();
using (var session = docStoreHttp.OpenSession())
{
// now you can run code like:
// session.GetAuthorizationFor(),
// session.SetAuthorizationFor(),
// session.Advanced.IsOperationAllowedOnDocument(),
// etc...
}
}
}
There are couple of other items that should be mentioned:
The first document store needs to be run with the UseEmbeddedHttpServer set to true so that the second one can access it.
I created a constant for the Port so it would be used consistently and ensure use of a non reserved port.
I encountered this as well. Looking at the source, there's no way to do that operation as written. Not sure if there's some intrinsic reason why since I could easily replicate the functionality in my app by making a http request directly for the same info:
HttpClient http = new HttpClient();
http.BaseAddress = new Uri("http://localhost:8080");
var url = new StringBuilder("/authorization/IsAllowed/")
.Append(Uri.EscapeUriString(userid))
.Append("?operation=")
.Append(Uri.EscapeUriString(operation)
.Append("&id=").Append(Uri.EscapeUriString(entityid));
http.GetStringAsync(url.ToString()).ContinueWith((response) =>
{
var results = _session.Advanced.DocumentStore.Conventions.CreateSerializer()
.Deserialize<OperationAllowedResult[]>(
new RavenJTokenReader(RavenJToken.Parse(response.Result)));
}).Wait();
I am writing on a testframework where the report should include the webdriver version of the test run. When using selenium there is the getEval("Selenium.version") method. But I find no way to read the version when using webdriver. Does anyone know a solution?
It's possible by reading the VERSION.txt properties file. This seems hacky, but it's what the WebDriver developers do in SeleniumServer.java:
final Properties p = new Properties();
p.load(getSeleniumResourceAsStream("/VERSION.txt"));
String rcVersion = p.getProperty("selenium.rc.version");
String rcRevision = p.getProperty("selenium.rc.revision");
String coreVersion = p.getProperty("selenium.core.version");
String coreRevision = p.getProperty("selenium.core.revision");
BuildInfo info = new BuildInfo();
String versionString = String.format("v%s%s, with Core v%s%s. Built from revision %s",
rcVersion, rcRevision, coreVersion, coreRevision, info.getBuildRevision());
Note that this requires a static import:
import static org.openqa.selenium.browserlaunchers.LauncherUtils.getSeleniumResourceAsStream;
Actual path to file with version in selenium is:
/META-INF/maven/org.seleniumhq.selenium/selenium-java/pom.properties
Properties p = new Properties();
p.load(LauncherUtils.class.getResourceAsStream("/META-INF/maven/org.seleniumhq.selenium/selenium-java/pom.properties"));
p.getProperty("version");`
I am hoping someone might be able to help me. I'm working on a Contact Manager built using a custom SharePoint 2007 list with a Silverlight 4 UI embedded in a content editor web part.
I am currently able to retrieve the data from the list and display it in a datagrid on the UI and everything works well.
Now I am trying to add the the ability to add new items to the list using the following code but the items do not save.
I've remotely debugged the following code using the Debug -> Attach to Process option and everything seems to execute successful without any errors but it does not save the item to SharePoint.
In order to simplify and get a working insert function I changed all the SharePoint fieds to single line text with the exception of the notes (multiline) and none of the fileds are required.
The sharepoint site does require Windows authentication but it seems to be working correctly as I am able to display it as well as add new items manually using the standard SharePoint forms.
Lastly, I have added the xml for the Batch element at the bottom which I copied as output while debuging.
Please let me know if there is any additional information I might be missing.
Thanks in advance for any assistance you might be willing to provide.
Charles
public string sharepoint_soap_namespace = "http://schemas.microsoft.com/sharepoint/soap/";
public string sharepoint_rowset_namespace = "#RowsetSchema";
public string service_lists_url = "http://myDomain/_vti_bin/lists.asmx";
public string listName = "MyContacts";
public void TestCreateContact()
{
Uri serviceUri = new Uri(service_lists_url);
BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.None);
binding.MaxReceivedMessageSize = 2147483647; // This has to be the same as in the ServiceReferences.ClientConfig file.
EndpointAddress endpoint = new EndpointAddress(serviceUri);
ListsSoapClient testCreateClient = new ListsSoapClient(binding, endpoint);
XElement batch = new XElement("batch",
new XElement("Method",
new XAttribute("ID", "1"),
new XAttribute("Cmd", "New"),
CreateFieldElement("ows_ID", "New"),
CreateFieldElement("ows_Title", "John"),
CreateFieldElement("ows_SupportFor","USA"),
CreateFieldElement("ows_LastName","Doe")
));
testCreateClient.UpdateListItemsCompleted +=
new EventHandler<UpdateListItemsCompletedEventArgs>(createSoapClient_UpdateListItemsCompletedEventArgs);
testCreateClient.UpdateListItemsAsync(listName, batch);
testCreateClient.CloseAsync();
}
private XElement CreateFieldElement(string fieldName, string fieldValue)
{
XElement element = new XElement("Field",
new XAttribute("Name", fieldName),
fieldValue);
return element;
}
Just a quick update to let everyone know I was able to answer my own question.
It seems that in the batch XElement I was using the wrong field names.
CreateFieldElement("ows_SupportFor","USA"),
I was using "ows_SupportFor" instead of "SupportFor" without the "ows_" prefix.
Cheers,
Charles