Nant Script Task using Cruise Control - nant

im using script task in nant Script, in script task i have written C# code in which i'm trying to write to console as below
console.writeline("Hello");
and also i have a method and its return type.
Actually i'm calling this Nant script from Cruise Control web dashboard.
Now my question is i can see only the return type of method in nant ouptut on Cruise Control Web Dash Board but i dont see console.writeline("Hello") message, so how can i get console message also on cruise control dashboard under nant Output? Is there any way to show console messages on cruise control Web dash Board
,

You need to use the NAnt Log methods to write your output, e.g.
<script language="C#">
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
// ...
project.Log(Level.Info, "Moving directory {0} to {1}", source, destination);
}
]]>
</code>
</script>

Related

powershell azure function app throws an exception "Unable to find type [HttpResponseContext]" when debugging in VS 2022

I created a PowerShell azure Function App with the default/sample function in it.
On the function app 'overview' page I clicked the 'download app content' and downloaded the 'content and visual studio project' including the app settings.
I put the content into an empty folder on my dev computer and opened it with Visual Studio 2022.
Updated the .net.sdk.functions nuget package to 4.1.1 and set the target framework to 4.8
When I start the debugging the function loads and listens, but when I open the URL it throws an exception: "Unable to find type [HttpResponseContext]"
It looks like the 'using namespace System.Net' line in the powershell code doesn't work. (the code/debugging works on the same computer from VSCode, but I would prefer using VS2022)
Any help to make this work would be appreciated. Thank you in advance.
This is part of the .csproj file:
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
This is the code:
using namespace System.Net
# Input bindings are passed in via param block.
param($Request, $TriggerMetadata)
# Write to the Azure Functions log stream.
Write-Host "PowerShell HTTP trigger function processed a request."
# Interact with query parameters or the body of the request.
$name = $Request.Query.Name
if (-not $name) {
$name = $Request.Body.Name
}
$body = "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response."
if ($name) {
$body = "Hello, $name. This HTTP triggered function executed successfully."
}
# Associate values to output bindings by calling 'Push-OutputBinding'.
Push-OutputBinding -Name Response -Value ([HttpResponseContext]#{
StatusCode = [HttpStatusCode]::OK
Body = $body
})
Scenario 1:
Created PowerShell Core 7.2 Versioned Azure Function Http Trigger in the Azure Portal and downloaded it from the Overview blade with the following [Download App Content > Content & VS Project - Include app settings in the download].
Scenario 2:
When we create the same project from VS Code locally, it is not creating any .csproj file and if it is published without .csproj to Azure Portal Function App, Azure is sending the .csproj file in its Content and Visual Studio Project option with the net461 as target framework.
Error:
<Message>Exception while executing function: Functions.HttpTrigger1 -> PowerShell script error -> Unable to find type [HttpResponseContext].</Message>
....
<StatusCode>InternalServerError</StatusCode>
According to Azure Functions PowerShell Official Doc, .NET Framework is not supported in the PowerShell Runtime, but Azure is sending the framework version to the .csproj file.
We raised the triage ticket to the Microsoft on this issue and follow the updates from this GitHub ticket.

Print console errors (with response code 4xx or 5xx) in logger file in protractor automation

I want to print console error with response code 4xx or 5xx in a logger file while executing automation script in protractor. Now I am using the following code in my afterEach. It prints everything from the console.
browser.manage().logs().get('browser').then(function(browserLog) {
console.log('log: ' + require('util').inspect(browserLog));
});
Thr protractor tests, are executed over node, so you can use node's file system ('fs' module) commands.
for example the appendFile methode
How to append to a file in Node?

Do I need to enable javascript for PhantomJS when using Selenium Webdriver?

I have a testsuite in NUnit running on both IE and Chrome webdrivers. But when I wanted to try headerless PhantomJS (Ghostdriver) I can't get it to excute the actions I want to perform.
Having issues with easy stuff like
[TestFixture]
class PhantomJSTest{
protected IWebDriver driver;
[SetUp]
public void Setup() {
driver = new PhantomJSDriver(#"..\..\..\..");
}
[Test]
public void PhantomTest() {
driver.Navigate().GoToUrl(adress);
driver.FindElement(selector).Click();
}
[TearDown]
public void Teardown() {
driver.Close();
driver.Quit();
}
}
When the click is performed something should be set in my db, so when going back to that page manually I should be able to see it. The NUnit test itself is set to succeeded, but the action never happens. This is especially apparent when trying to do something based on the earlier action. Any help would be appreciated! =)
I would recommend you following activities:
1) try to relaunch your selenium hub with node(-s) based on phantomJs.
2) try to use instead of
driver.Navigate().GoToUrl(adress);
this one:
driver.get(URL);
driver.findElement(selector).click();
3) also see phantomJs documentation to get all phantomJs capabilities:
GhostDriver extra Capabilities
phantomjs.page.settings.SETTING = VALUE - Configure page.settings on
PhantomJS internal page objects (windows in WebDriver context) . Reference
phantomjs.page.customHeaders.HEADER = VALUE - Add extra HTTP Headers
when loading a URL . Reference
PhantomJSDriver (Java-binding) Capabilities
phantomjs.binary.path - Specify path to PhantomJS executable to use
phantomjs.ghostdriver.path - Specify path to GhostDriver main/src.js
script to use; allows to use a different version of GhostDriver then
the one embed in PhantomJS
phantomjs.cli.args - Specify command line arguments to pass to the
PhantomJS executable
phantomjs.ghostdriver.cli.args - Specify command line argument to
pass to GhostDriver (works only in tandem with
phantomjs.ghostdriver.path)
More details one can get at GhostDriver page
Also look through phantomJs command line options . This info might be helpful for you as well.
Hope this helps you.

msdeploy via powershell and psake fails

So I'm trying to use powershell and psake for my build and deployment. I've tried without any success to call the following psake task.
Exec { msdeploy.exe "-verb:sync"
"-source:package="D:\path-to-package\zip-file-name.zip"
"-dest:auto,computername=http://my-server-name-here:8090/MsDeployAgentService2/" -setparam:Name="IIS Web Application Name,Value=iis-web-app-name-here" "-allowUntrusted" }
So in an effort to get things moving I removed the offending setparam:Name="IIS Web Application Name,Value=iis-web-app-name-here". It worked but took the IIS Web Application Name parameter from the ..SetParameters.xml as expected.
<setParameter name="IIS Web Application Name" value="Default Web Site/project.name_deploy" />
There's clearly something wrong with the syntax of setparam:Name="IIS Web Application Name,Value=iis-web-app-name-here" but I've tried a dozen (or more) variations including
-setparam:"IIS Web Application Name=iis-web-app-name-here" > omitting the name,value
-setparam:"IIS` Web` Application` Name=iis-web-app-name-here" > using back ticks
I really can't work out what I'm doing wrong and may have to resort back to using an msbuild file to get things moving.
The error I receive is : > all arguments must begin with -
I believe you need to quote the parameters as follows:
setparam:Name="IIS Web Application Name",Value="iis-web-app-name-here"
Note the additional quotes before the comma and after the equals sign following Value.

selenium tests aplication path problem test not run on selected url

I try to start my selenium test using command line but test are fired to http://mycomputer and not to http://mycomputer/myapplication
D:\projectsnet\Production\MyWebTests\tools\selenium-server>java -jar selenium-
server.jar -Dhttp.proxyHost=mycomputer -Dhttp.proxyport=4444 -htmlSuite "*firefox" "ht
tp://mycomputer/myapplication/" "D:\mypathtotestssuites\0001-testsuite.html" "c:\temp\result.html"
In test cases I have got link
<link rel="selenium.base" href="http://mycomputer/myapplication/" />
This is by design.
If you are doing development against http://mycomputer/myapplication/ then I would recommend that you do http://mycomputer as your baseURL and then add
open | /myapplication/
To the top of your tests.