I am getting an error "Could not invoke constructor" after I tried to test the code through FitNesse.
What can I do to solve this problem?
I have followed instructions from "https://www.softwaretestinghelp.com/getting-started-with-fitnesse-a-collaboration-tool-for-testers-and-developers/" website.
This is the code I wrote to test:
public class Calculator {
public int first, second;
public void setFirst(int first) {
this.first = first;
}
public void setSecond(int second) {
this.second = second;
}
public int addition() {
return (first+second);
}
}
This is what I wrote in FitNesse :
!define TEST_SYSTEM {slim}
!path F:\Eclipse\Workspace\TestFitNesse\bin
| Calculator |
|first |second|addition?|
|4 |2 |6 |
Below is the result I get when I click on the 'Test' button:
Link to view the screenshot of the error
I was just trying to work thru that exact example and getting the same error. It was really frustrating.
The site is incorrect in how it tells you to add the !path value.
It tells you to set it to :
c:\Users\<username>\workspace\test\bin
That is incorrect because:
Running the tests successfully will create the \bin directory so you don't need to create that directory.
The actual path should be:
c:\users\<username>\workspace\test\
We have to include the \test\ portion because the site directs us to create our class in a package named test (at the top of the TestMath java file).
However, if you didn't include that in your .java file then you won't need that portion of the path.
The site also does not tell you explicitly that you need to compile the .java into a .class file either. So, you do need to compile the TestMath.java (using javac) and the drop the TestMath.class file into the directory above.
After you do that, it should work.
I just saw your path is set to:
!path F:\Eclipse\Workspace\TestFitNesse\bin\
If that is what your path is set to, then you need it changed to :
!path F:\Eclipse\Workspace\TestFitNesse\
Of course, if you have included your class in a package by including something like:
package test;
Your path will need to look like:
!path F:\Eclipse\Workspace\TestFitNesse\test\
Then you will drop your compiled .class file in there and it will work.
Related
I am using a pre-built C++ library in my Unreal project using a dynamic library file (let's say it's called MyPluginLib.dll). The library is contained in a plugin, let’s call it MyPlugin.
Building, packaging, playing in editor works fine. However, a packaged build doesn’t start, giving the following error: Code execution cannot proceed, MyPluginLib.dll was not found.
The packaging process places MyPluginLib.dll file in MyGame\Plugins\MyPlugin\Binaries. However, the execution process is seemingly looking for it in MyGame\Binaries – moving the library there manually solves this issue.
Why is the OS unable to find the dll in the first folder? Is there something wrong in the build.cs, or my folder structure?
The folder structure of the plugin folder is as follows:
Includes in Plugins\MyPlugin\Source\ThirdParty\MyPluginLib\
Binaries in Plugins\MyPlugin\Binaries\(PLATFORM)\
The plugin’s Build.cs looks like this:
public class MyPlugin : ModuleRules
{
public MyPlugin(ReadOnlyTargetRules Target) : base(Target)
{
PCHUsage = ModuleRules.PCHUsageMode.UseExplicitOrSharedPCHs;
string PluginRoot = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", ".."));
string PlatformString = Target.Platform.ToString();
string LibraryDirectory = Path.Combine(PluginRoot, "Binaries", PlatformString);
PublicIncludePaths.Add(Path.Combine(PluginRoot, "Source", "ThirdParty", "MyPluginLib"));
if ((Target.Platform == UnrealTargetPlatform.Win64))
{
PublicAdditionalLibraries.Add(Path.Combine(LibraryDirectory, "MyPluginLib.lib"));
RuntimeDependencies.Add(Path.Combine(LibraryDirectory, "MyPluginLib.dll"), StagedFileType.NonUFS);
}
else if (Target.Platform == UnrealTargetPlatform.Linux)
{
// linux binaries...
}
}
Would appreciate any help.
Check your packaged games files, unreal loves to not include certain thing in packaged builds regarding plugins.
I would look to hook into the output of msbuild (and/or dotnet build).
I've found a way of getting the text passed to the output window in Visual Studio. I can write a Visual Studio Extension (VSIX) that contains an IClassifier. If I add an IClassifierProvider like this:
[ContentType("output")]
[Export(typeof(IClassifierProvider))]
public class MyClassifierProvider : IClassifierProvider
{
public IClassifer GetClassifier(ITextBuffer textBuffer)
{
return new MyClassifer();
}
}
Then in the MyClassifier:
public class MyClassifier : IClassifier
{
public IList<ClassificationSpan> GetClassificationSpans(SnapshotSpan span)
{
// I will get the build output here, line by line
}
public event EventHandler<ClassificationChangedEventArgs> ClassificationChanged;
}
So I can get the build output in the GetClassificationSpans method, but it means I need to return a classification of the line. I'm not interested in this. I just want to capture the build output and do something else with it. For example, I could want to write all warnings to a file.
This makes me wonder if the IClassifier route is the way to go.
I thought I could hook into some Roslyn API, but from what I read, this is useful to analyze the code. What I want is to get the complete build output, with all statements (i.e. what you see in the Output window).
So now I'm looking at writing a VSIX, but don't think IClassifier is my best option.
What I want to do?
I want to create and consume java objects in PowerBuilder and call methods on it. This should happen with less overhead possible.
I do not want to consume java webservices!
So I've a working sample in which I can create a java object, call a method on this object and output the result from the called method.
Everything is working as expected. I'm using Java 1.8.0_31.
But now I want to attach my java IDE (IntelliJ) to the running JVM (started by PowerBuilder) to debug the java code which gets called by PowerBuilder.
And now my question.
How do I tell PowerBuilder to add special options when starting the JVM?
In special I want to add the following option(s) in some way:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
The JVM is created like following:
LONG ll_result
inv_java = CREATE JavaVM
ll_result = inv_java.CreateJavaVM("C:\Development\tms java\pbJavaTest", FALSE)
CHOOSE CASE ll_result
CASE 1
CASE 0
CASE -1
MessageBox ( "", "jvm.dll was not found in the classpath.")
CASE -2
MessageBox ( "", "pbejbclient90.jar file was not found." )
CASE ELSE
MessageBox ( "", "Unknown result (" + String (ll_result ) +")" )
END CHOOSE
In the PowerBuilder help I found something about overriding the static registry classpath. There is something written about custom properties which sounds like what I'm looking for.
But there's no example on how to add JVM options to override default behavior.
Does anyone have a clue on how to tell PowerBuilder to use my options?
Or does anyone have any advice which could guide me in the right direction?
Update 1
I found an old post which solved my initial issue.
If someone else want to know how it works take a look at this post:
http://nntp-archive.sybase.com/nntp-archive/action/article/%3C46262213.6742.1681692777#sybase.com%3E
Hi, you need to set some windows registry entries.
Under HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\Powerbuilder\9.0\Java, there
are two folders: PBIDEConfig and PBRTConfig. The first one is used when
you run your application from within the IDE, and the latter is used
when you run your compiled application. Those two folders can have
PBJVMconfig and PBJVMprops folders within them.
PBJVMconfig is for JVM configuration options such as -Xms. You have to
specify incremental key values starting from "0" by one, and one special
key "Count" to tell Powerbuilder how many options exists to enumerate.
PBJVMprops is for all -D options. You do not need to specify -D for
PBJVMProps, just the name of the property and its value, and as many
properties as you wish.
Let me give some examples:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\PowerBuilder\9.0\Java\PBIDEConfig\PBJVMprops]
"java.security.auth.login.config"="auth.conf"
"user.language"="en"
[HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\PowerBuilder\9.0\Java\PBRTConfig\PBJVMconfig]
"0"="-client"
"1"="-Xms128m"
"2"="-Xmx512m"
"Count"="3"
[HKEY_LOCAL_MACHINE\SOFTWARE\Sybase\PowerBuilder\9.0\Java\PBRTConfig\PBJVMprops]
"java.security.auth.login.config"="auth.conf"
"user.language"="en"
Regards,
Gokhan Demir
But now there's another issue...
PB isn't able to create EJB Proxies for my sample class which is really simple with java 1.8.0_31. They were created with the default version, which is 1.6.0_24.
public class Simple
{
public Simple()
{
}
public static String getValue()
{
return "blubber";
}
public int getInt32Value()
{
return 123456;
}
public double getDoubleVaue()
{
return 123.123;
}
public static void main(String[] args)
{
System.out.println(Simple.getValue());
}
}
The error is the following. :D
---------- Deploy: Deploy of project p_genapp_ejbclientproxy (15:35:18)
Retrieving PowerBuilder Proxies from EJB...
Generation Errors: Error: class not found: (
Deployment Error: No files returned for package/component 'Simple'. Error code: Unknown. Proxy was not created.
Done.
---------- Finished Deploy of project p_genapp_ejbclientproxy (15:35:19)
So the whole way isn't a option because we do not want to change the JAVA settings in PB back and forth just to generate new EJB Proxies for changed JAVA objects in the future...
So one option to test will be creating COM wrappers for JAVA classes to use them in PB...
I've used package manager to install Squishit.Less 0.9.3, and I have two files
style.less - #import "test.less";
test.less - body{background-color: pink;}.
In my page I have:
<%= Bundle.Css().Add("~/less/style.less").ForceRelease().Render("~/less/combined.css") %>
But the output I get is: #import"test.less"; - the less processor hasn't tried to get the import for some reason?
I've tried ProcessImports but that made no difference.
I just verified in a sample project that it works correctly.
You should NOT need to call ProcessImports - the less preprocessor should do this automatically. ProcessImports is for #imports in standard CSS, which aren't processed by default.
I suspect what happened is that NuGet didn't add the file that registers the preprocessor. As a result the less preprocessor is never called. If you look under App_Start you should see a file called SquishItLess.cs with the following contents:
[assembly: WebActivator.PreApplicationStartMethod(typeof(MyProject.App_Start.SquishItLess), "Start")]
namespace MyProject.App_Start
{
using SquishIt.Framework;
using SquishIt.Less;
public class SquishItLess
{
public static void Start()
{
Bundle.RegisterStylePreprocessor(new LessPreprocessor());
}
}
}
If this file is missing, you can either add it or add the Bundle.RegisterStylePreprocessor line in your Global.asax.cs' Application_Start method.
If you're installing to a VB project this is a known issue (https://github.com/jetheredge/SquishIt/issues/232) and will be addressed when the plug is pulled on .net 3.5 support.
I have a ClassLibrary Project which is my business layer - Demo.Business
For this class library,
I have folder in the class library as below
TRT
|
TRT.cs
TRTDetails.cs
TRTFiles(Folder)
|
**TRTFile.txt**
In TRT.cs class i have a method
public void UpdateDetails()
{
var typeSeq = from val in TRTDetails.Read**(#"TRTFile.txt")**
}
Now i have added reference of this class library "Demo.Business.dll" to my console application - "DemoProcess.exe".
In the above Console Application I am calling the method "UpdateDetails()" as follows:
public void CallMethod()
{
UpdateDetails();
}
How can I specify the path of the file "TRTFile.txt" in the method "UpdateDetails()" in class library?
I tried using System.IO.Path.GetDirectoryName
(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)
Which always gives the path of executing application.
i.e
C:\\Projects\\Demo.Process\\bin\\Debug
How can i get the path as
C:\\Projects\\Demo.Business\\TRT\\TRTFiles............
There are two ways to do this:
I.
This can be done using relative path. If your's dll is also situated in Debug folder, the following path = #"..\..\..\Demo.Business\TRT\TRTFiles\" will do the work.
First ..\ will get us to C:\\Projects\\Demo.Process\\bin\\.
Second ..\ will get us to C:\\Projects\\Demo.Process\\.
Third ..\ will get us to C:\\Projects\\.
II.
Or by using classes used for writing visual studio extensions (Extensibility, EnvDTE namespaces, etc.), they provide functionality to get all information about your project and it's content. But it's complicated.