I am just beginning WatiN and in a lot of blogs I see attributes like [TestMethod] or simply [Test] used.
For Example:
MSForge Blog Post
etc. etc.
but when I attempt:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;
using WatiN.Core.UnitTests;
using WatiN.Core.Constraints;
using System.Diagnostics;
namespace Lemmings
{
class Login
{
[TestMethod]
...
...
}
}
[TestMethod]/[Test] is not recognized. I haven't seen anyone state that it is a custom attribute (it would also be strange if everyone was using the same custom attribute that was named the same thing) so I don't think that is likely.
What am I missing?
Note: For simple scripts [STAThread] works but if I want to use something like "ie.goto" VS2008 complains.
Any help is appreciated. Thank you.
Mel,
The Test and testmethod are custom attributes that are used by unit testing tools so they know that the method is a test. The Test attribute is used by nUnit and test method is used by the Visual Studio testing tools.
For more information you should look into the getting started documenation on www.nunit.org, and download the nunit test runner.
Oh you will also need a reference to nunit and a reference to the NUnit.Framework assemmbly. If you are using visual studio 2008 professional you can just create a new test project and add a unit test.
Related
I'm trying to learn how to develop my own enricher (I believe I do understand the basic, in terms of how enrichers relate to automation chains and so on). However, I'm having problems:
I can use existing enrichers with, for example,
Document.FetchByProperty and everything will work
But once I include my own custom enricher, I get the error (link below)
I couldn't figure out what I'm doing wrong, so I've took existing custom enricher from Nuxeo sample project, and got the same error
Any help is welcome!
Log link: https://answers.nuxeo.com/api/files/2b14d403-aa8a-4ac3-81ca-c9ee13623c2a
I've also asked the same question here:
https://answers.nuxeo.com/general/q/af5a6369c91942b5a81bf61549b467f2/Automation-and-a-custom-enricher
Make sure that you are compiling the enricher code with the same version of Nuxeo libraries as is the version of the target platform.
For example sample project is using the latest version (currently 11.1-SNAPSHOT) and the result code will not be compatible with Nuxeo platform 9.2. Especially abstract methods can have problems.
So there should be this section in pom.xml with <version>9.2</version> in your case:
<parent>
<groupId>org.nuxeo</groupId>
<artifactId>nuxeo-addons-parent</artifactId>
<version>9.2</version>
</parent>
The reason why the java.lang.AbstractMethodError is thrown here is in JsonGenerator. Nuxeo 9.2 uses org.codehaus.jackson.JsonGenerator while newer Nuxe versions use com.fasterxml.jackson.core.JsonGenerator.
Then this method signature (in 9.2):
public void write(org.codehaus.jackson.JsonGenerator jsonGenerator, DocumentModel documentModel) throws IOException;
... is not compatible with this (in 10.3 for example):
public void write(com.fasterxml.jackson.core.JsonGenerator json, DocumentModel document) throws IOException;
And Java is then not able to find correct write() method implementation and throws AbstractMethodError.
I have inherited a Java / Maven / Cucumber project. I am fairly new to Cucumber.
Inside one of the folder I have a class like this...
import com.intuit.karate.junit4.Karate;
import org.junit.runner.RunWith;
#RunWith(Karate.class)
public class RoadsRunner {
}
Then in the same subdirectory / package I have a .feature file.
with a number of scenario's.
Feature: Check transaction
Background:
* url apiHost + '/api/v1'
* configure headers = {'X-TransactionID': '#(Math.random().toString())' }
Scenario: Get Classes
# get classes
Given path '/myUrl/classes'
And param processName = 'myProcess'
When method get
Then status 200
Question One.
I am using Eclipse. Is there a way I can debug through the test in a similar way that I would debug a Java app?
I have downloaded myself the Cucumber Eclipse plugin but can't quite figure out how to use it.
Question Two.
Without using a custom plugin to debug is there anything I can add to the scenarios to maybe print extra debug information.
thanks
The Cucumber Eclipse plugin gives you 2 things:
IDE syntax coloring / formatting support
Being able to right-click and run a Feature directly without the JUnit "runner"
Karate is Java behind the scenes so you can debug and set break-points, but it may not be as seamless as you expect. In 0.6.0 you have the option of placing a conditional break-point in Karate code that runs before / after each test step - see screen-shot.
So as you rightly called out, printing to the log might be the most effective way to work through complicated test scripts. Please refer to the print keyword - which is exactly what you are looking for.
2 more points:
the optional HTML report includes all HTTP request / response logs - which is great for troubleshooting a test.
I would love for the Karate UI (currently in alpha) to become stable sooner and be the best option for debugging, please do submit feedback and contribute if you can.
EDIT: we now have the Visual Studio Code IDE support with first-class debug support: https://github.com/intuit/karate/wiki/IDE-Support#vs-code-karate-plugin
EDIt2: If you want to debug Java code, that is possible with the new IntelliJ plugin: https://plugins.jetbrains.com/plugin/19232-karate
As per the documentation here, At this moment best way to debug Karate Steps is using Visual Studio Code for developing tests and VS Code Karate Plugin for debugging.
Visual Studio Code is Free, built on open Source and runs on all platforms including mac/linux and windows.
Please note this
The Karate UI has been retired and is not available in 0.9.5 onwards !
Use the VS Code Debug Support instead.
As per the comment by Peter Thomas, Eclipse/IntelliJ may also support debugging but I am unable to find any development there.
I'm trying to commission an HDI cluster using the .Net SDK. The tutorial is pretty self explanatory, but when I follow along, I seem to be missing a reference.
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Security;
using System.Text;
using System.Threading.Tasks;
using Hyak.Common;
using Microsoft.Azure;
using Microsoft.Azure.Common.Authentication;
using Microsoft.Azure.Common.Authentication.Models;
using Microsoft.Azure.Management.HDInsight;
using Microsoft.Azure.Management.HDInsight.Job;
using Microsoft.Azure.Management.HDInsight.Job.Models;
using Microsoft.Azure.Management.HDInsight.Models;
using Newtonsoft.Json;
namespace CreateHDICluster
{
internal class Program
{
private static ProfileClient _profileClient;
....
}
}
results in a 'The type or namespace name 'ProfileClient' could not be found (are you missing a using directive or an assembly reference?)'
Best guess, whatever version of whatever package the ProfileClient class belongs to no longer contains this class - the tutorial doesn't specify a version and a few of them packages are pre-release.
Does anybody have this working? To what does the ProfileClient class belong?
Thanks
This appears to be a bug, as you have the correct references in your project. Note the open sourced GitHub repo and the class definition for ProfileClient:
https://github.com/Azure/azure-sdk-for-net/blob/21db6e5490e66af39a9c6dbf0ad10650d9ca037b/src/Authentication/Common.Authentication/Common/ProfileClient.cs
This file exists within the namespace: Microsoft.Azure.Common.Authentication
I suggest filing an issue with the repo. Also note that the packages requested to bring in, particularly Microsoft.Azure.Common.Authentication is in prerelease
I believe this issue you found in the article's sample was due to the removal of ProfileClient from the Authentication package -- the article's sample is now updated.
If you're still interested, you could take a look at the updated sample in the article.
I hope this helps!
I think I'm missing a using statement:
using System;
using System.Activities;
using System.ServiceModel;
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Workflow;
using Microsoft.Xrm.Sdk.Workflow.Activities;
using Microsoft.Xrm.Sdk.Query;
Workflow.EntityLogicalName;
Extra info:
I'm using the crm 2013 SDK.
Workflow is recognized and is in the Microsoft.Xrm.Sdk.Workflow.Activities reference.
I'm trying to get this sample to work: http://www.mscrmconsultant.com/2012/06/run-ondemand-workflow-from-c-code-in.html
Make sure that you have added following references:
Microsoft.Xrm.Sdk
Microsoft.Xrm.Sdk.Workflow
If you have these references then Generate the Entity Wrapper for workflows using CRM Explorer. and then replace
Workflow.EntityLogicalName
with
Entities.Workflow.EntityLogicalName
I'm trying to make a C# console app that adds messages to a queue. I'm following the examples about Azure Service Bus given here: http://www.windowsazure.com/en-us/develop/net/how-to-guides/service-bus-queues/
My program does nothing at the moment:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.ServiceBus;
using Microsoft.ServiceBus.Messaging;
namespace testConsole
{
class Program
{
static void Main(string[] args)
{
}
}
}
The problem I'm having is that when I add the Microsoft.ServiceBus.dll reference (as explained in the above link, 1-add dll reference and 2-add using statements) I'm getting an error upon compiling: "The type or namespace name 'ServiceBus' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)"
I even looked into the Microsoft.ServiceBus.dll with reflector tool and it does contain Microsoft.ServiceBus namespace. Version number of the dll is 1.6.0.0 and runtime version v4.0.30319.
Any help appreciated.
-pom-
A common issue when using Storage and AppFabric services with a non-web applications is that the default Target Framework for Windows Forms app and Console App is .NET Framework 4.0 Client Profile. Change your project's Target Framework to ".NET Framework 4.0" (full) and it will work.
The problem that I've was that there are two packages Microsoft.Azure.ServiceBus and Azure.Messaging.ServiceBus. and I was using the wrong one, so maybe was that.
In the link the package used it's Azure not Microsoft as you are importing in your project.
It's this one
using Azure.Messaging.ServiceBus;