Getting org.testng.TestNGException: No free nodes found in:[DynamicGraph Exception - webdriver

I want to write same class more than once in my testng.xml.
for e.g i have two methods login() and logout() in Login class.
First i want to execute Login class's login() method then OtherClass's method() and finally Login class's logout() method
<test name="scenario1">
<classes>
<class name="com.webaut.Login">
<methods>
<include name="login" />
</methods>
</class>
<class name="com.webaut.OtherClass">
<methods>
<include name="method" />
</methods>
</class>
<class name="com.webaut.Login">
<methods>
<include name="logout" />
</methods>
</class>
</classes>
</test>
After executing my suit i get an "org.testng.TestNGException: No free nodes found in:[DynamicGraph Exception"
I could have used #DataProvider, but my methods are different so please suggest any alternative.

It appears that each class can only be declared once in the list, even if different methods are included on each declaration, otherwise you will see this error message :( Using latest TestNG 6.8.8. I was able to get this to work with #Test(priority=#) with the specific priority on each test method. See http://testng.org/doc/documentation-main.html#annotations.
My use case: crud tests for entities. Each Entity has its own test class with 4 methods (so I can test only a single entity CRUD in isolation), but I also want to run the overall suite (will fail due to integrity constraints and different generated ID keys unless they are run in exactly the right order).
Same question asked at org.testng.TestNGException: No free nodes found in:[DynamicGraph.

Related

What is equivalent of RegisterInstance<Interface>(new Class()) design time?

I am trying to implement design time Unity configuration (e.g.: using app.config). I am struggling with the very example of how to use the tag the "configuring instances" section.
Their sample of run-time configuration is:
EmailService myEmailService = new EmailService();
myContainer.RegisterInstance<IMyService>(myEmailService);
but no equivalent design-time configuration given. If I do:
<container>
<instance type="IMyService" value="EmailService" />
</container>
I will naturally get a "TypeConverter cannot convert from System.String" exception. Am I supposed to create some sort of type converter merely so that I could declare an instance? Is there an easier way?

Flex SOAP Collection decoding

Does anybody know why the Flex 4(.6) SOAP decoder adds the decoded arraycollection in the first element of the array(collection)based-property in the object?
BarCollection extends from ArrayCollection
Expected:
Object
-- someProperty:BarCollection
--[0] item:Foo
--[1] item:Foo
Got:
Object
-- someProperty:BarCollection
-- [0] ArrayCollection
--[0] item:Foo
--[1] item:Foo
The collection is registered via the
SchemaTypeRegistry.getInstance().registerCollectionClass -method
SchemaTypeRegistry.getInstance().registerCollectionClass(new QName("http://www.world.com/Foo", "BarCollection"), BarCollection);
Thanks for your answer!
Making the property a public variable of type ArrayCollection seems to work.
I did not managed to make it work with instantiating the field in the getter.
You did mean something like this?
private var _collection:CustomCollection;
public function get collection():CustomCollection {
if(!_collection)
_collection = new CustomCollection()
return _collection;
}
public function set collection(value:CustomCollection):void {
_collection = value;
}
But it seems that this only works on pure ArrayCollections.
My CustomCollection extends CollectionBase, which extends ArrayCollection.
If I switch to the custom collection, instead of the ArrayCollection, the tricks listed above doesn't seem to work.
If I have some time, I'll run trough the XML decoder again.
JoriDor,
I retraced my steps and found that a second difference between what I created and what I got from the sample cited below appears to be the true cause.
My ArrayCollection instance variable was created by getter/setter functions. When I changed it to a public variable, like the sample code, it worked! This is very disappointing as I must now consider altering my VO classes.
Not to give up too easily, I imagine that the mx.rpc.xml classes are using reflection (describeType()), so maybe I can see what can be done about changing the handling of <accessor> versus <variable> tags.
...30 minutes later, and thanking Adobe for open-sourcing Flex... I found XMLDecoder.getExistingValue() uses describeType and does account for getter/setter (aka "accessor"). My constructor created an empty ArrayCollection. Well, XMLDecoder.setValue does not know whether to replace this AC or to add items to it. It does the latter. Moved the AC instantiation until the first call to the getter (checking for null of course), and now it works!
I hope that fixes it for you. Key parts of XML Decoder to visit if you're inclined: setValue(), getExistingValue(), and then the problem issue performed by promoteValueToArray().
Retracted portion starts...
I too am finding this same behavior. I don't know if this would count as an answer, but I have code that does work, taken from this site. The key difference that I can discern between my code/data and what is posted at that site is the manner in which I declare my collection/array in the schema.
In my schema, I had declared a collection in this way:
<complexType name="Things">
<sequence>
<element name="thing" type="ids:Thing" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
</complexType>
<complexType name="ParentThing">
<complexContent>
<sequence>
<element name="things" type="Things"/>
</sequence>
<complexContent>
</complexType>
In the code from the site linked above, the collection is declared more directly:
<xs:complexType name="example">
<xs:sequence>
...
<xs:element name="items">
<xs:complexType>
<xs:sequence>
<xs:element name="item" type="item" maxOccurs="5"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
(In case you're thrown off, "example" is a type and an element in the sample code. This threw me off while investigating how the sample code worked. (I prefer the convention of capitalizing types/classes only.))
Anyhow, the sample code works, and the schema difference seemed to be the only difference that mattered. Looking at the XML instances (his and mine), there wasn't a difference to see. Each collection is parented by an element with a pluralized name. That is <Things> has <thing> instances, while <items> has <item> instances.
I'd be interested to know what your schema and/or XML instance looks like and whether changing it to match the example above (if schema changes are possible in your case) fixes the issue.

Binding a ConverterParameter to a Resource file in Silverlight 4

I'm trying to create a common converter that will take in a string from a resource resx file (the app has to be localizable) as a parameter.
<TextBlock
ToolTipService.ToolTip="{Binding IsInUse, ConverterParameter={Binding Path=WhereUsedIndicatorTooltips, Source={StaticResource resource}}, Converter={StaticResource whereUsedIndicatorTooltipConverter}}" />
Where resource is declared at the top of this page in XAML as:
<UserControl.Resources>
<resources:myResource x:Key="resource" />
</UserControl.Resources>
At runtime I get this exception:
System.Windows.Markup.XamlParseException:
Provide value on
'System.Windows.Data.Binding' threw an
exception. [Line: 47 Position: 42]
---> System.InvalidOperationException: Operation is not valid due to the
current state of the object.....
I'm aware from this StackOverflow question that the ConverterParameter is not bindable and is not a DependencyObject. Is there a workaround to this problem, besides putting the text in the XAML?
I found a solution from Brandon Truong. This works very well.
I put my FrameworkElement with DependencyProperty converter in:
<UserControl.Resources>
<utilConverters:myTooltipConverter x:Key="myTooltipConverter" Tooltips="{Binding Path=tooltips, Source={StaticResource resource}}" />
</UserControl.Resources>
I got same error here ,
**
ElementName=RadCalendarMonths,Path=SelectedDate,StringFormat='MMMM
yyyy',ConverterCulture={Binding Path=CurrentCultureInfo,
Source={StaticResource ResourceWrapper}}}"/>
I used Converter Culture property Binded! Opps! I can't do that because the property ConverterCulture is not a DependencyProperty. If a property is not instance of DependencyProperty you cant use binding on it.
If you look at Property(F4) Pane on VS2010 you can see that some properties support Binding some properties does not! Some properties not seen there because some properties are read only as u know.
So using resource is a logical way to solve it.

New to Structure Map - Getting StructureMap Exception Code: 202 No Default Instance defined for PluginFamily

Am trying out structuremap for the first time and am getting the following compiler error,
StructureMap Exception Code: 202
No Default Instance defined for PluginFamily Super.SuperCore.Core.DataAccess.IPersonRepository, Super.SuperCore, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
The place where am calling the interface:
private IPersonRepository _iPersonRepository;
public void Init() {
_iPersonRepository = ObjectFactory.GetInstance<IPersonRepository>();
}
My Interface Declaration:
[PluginFamily("Default")]
public interface IPersonRepository
{
List<string> getAllNames();
}
My StructureMap.config:
<?xml version="1.0" encoding="utf-8" ?>
<StructureMap>
<Assembly Name="Super.SuperWeb" />
<Assembly Name="Super.SuperCore" />
</StructureMap>
Can anyone point out where exactly am I going wrong.
First, that's not a compiler error, that's an exception, there is a very large difference, I won't go into that though.
In your configuration, you appear to be mixing and matching configuration methods. I typically pick one and stick to it. Here's the documentation
If you want to go the attribute route, you have to tell SM to scan for classes with attributes
If you want to go the xml route, make sure your structuremap.config is getting copied to the folder with the exe. I don't think you should have to, but you can explicitly load from the xml config like this
ObjectFactory.Initialize(x =>
{
x.AddConfigurationFromXmlFile("StructureMap.config");
});
If you want something that is strongly typed and compiler checked, try the registry dsl, it's the more modern configuration mechanism.

How Can I Make the XmlIgnore Attribute Method-Specific in a WebService (ASP.Net)?

I understand that I can make the property nullable or use a bool called [PropertyName]Specified to determine whether the property is serialized to XML, but I would like the auto-generated examples to hide these elements in one method's definition, and show them in another. This way the user knows whether they'll be there or not.
For example,
here is what displays now (same for both):
Web Service Method1 Example
...
<Object>
<Column Value="int" xsi:nil="true" />
</Object>
...
Web Service Method2 Example
...
<Object>
<Column Value="int" xsi:nil="true" />
</Object>
...
here is what I want to display:
Web Service Method1 Example
...
<Object>
<Column Value="int" />
</Object>
...
Web Service Method2 Example
...
<Object />
...
Is this even possible without creating different Classes?
No, it's not. You're serializing instances of classes. This is independent of web methods.
The web service infrastructure doesn't fit what you're looking for. In WSDL, an operation uses messages which have parts which are of types which are described in an XML schema. In order for two operations to be the same except for one element (column), they must use messages referring to different types.
Alternatively, you could have one of your methods accept a parameter of a class without the extra column, and have the other use that same parameter, plus a separate parameter which is just the extra column.
Best way, then, is just to have one class inherit the other and add the Column property.

Resources