I am using VS2010 for development and unit testing. one of my module reads some dlls from specific folder (say ".\Plugin"). When I run unit test , it fails saying part of path not found "\TestResult\Out\Plugin". This is because I dont have "Plugin" in out directory.
How do I create "Plugin" folder in Out directory on every test run.
Related
This is an educational Java/Swing app (JDK 16.0.2) which I'm trying to manufacture for MacOS distribution.
I'm using jpackage (jdk-16) to build the installer/launcher. Learning the Terminal/Xcode command line interface has been....interesting.
When I test the installer on the sw mfg. host intel-iMac, it launches correctly, including showing the app's splashscreen and icon set.
But, when I run the same installer on a different intel-iMac then launch, the launcher can't find the main class: (bug replicated on a MacBook Pro)
Excerpt from launcher TerminalExec session:
Error: Could not find or load main class workspace2D.DataflowGeometry2D
Caused by: java.lang.ClassNotFoundException: workspace2D.DataflowGeometry2D
What could cause the launcher to fail to find main() except on the mfg. host iMac?
The installed .cfg file has:
app.mainclass=workspace2D/DataflowGeometry2D
which is the correct reference satisfying the launcher in the first test case.
I finally figured this out. The "jpackage" documentation is weak as far as the necessary preconditions in your file structure for your Java project. All the examples they show are "toy" projects ("HelloWorld")
thus avoiding how a typical app-project as structured.
My mistake was creating my MacOS_Manufacturing folder (a target location for the .jar and for the installer .dmg) OUTSIDE the Project folder.
The --input parameter to jpackage names a folder on the sw mfg. computer whose entire contents will be copied onto the installed computer --> MyApp.app/Contents/app folder. I was naming the Project/bin folder as the "--input", which was copying all the .class files and datafiles -- but NOT the .jar. What threw me off is that my DataflowGeometry2D.class files was sitting right there on the installed computer, and yet the launcher couldn't find it???
The launcher is looking for main-class INSIDE the jar, not as a standalone .class file.
I moved the target location for the .jar on the sw mfg. computer to be inside the Project/bin folder. That guarantees it is copied onto the installed computer during the install.
I have a test automation project where basically I run cucumber test via gradle task. What's weird is that the build folder is generated on .daemon folder instead of the project directory. E.g.
/Users/my_user/.gradle/daemon/5.6
Whereas it should be on:
/Users/my_user/my_project/build
Weirdly enough this seems to only happen on my local. Is there anything I might have missed on setting up the gradle?
I am using spring-boot. I have my tests segregated in the following manner
tests
|java
|endtoend
|org.mycompany.tests
|integration
|org.mycompany.tests
|unit
|org.mycompany.tests
When I run a mvn test or package everything inside tests folder are running. I want to run the test within individual folders. Intellij is able to run unit, integaration and endtoend separately.
I saw posts for running tests within a package. All my different test folders have the same package structure. So filtering by test packages will not help me.
If intellij is able to run the folders individually, I think I am just missing the command to run it from the cmd line. Please advise.
I am testing this very simple Go code on MacOS using VS Code. The project consists of these sample packages / files:
azure.com/myproj/cmd/service/main/main.go
azure.com/myproj/cmd/service/service.go
azure.com/myproj/cmd/service/tests/test.go
azure.com/myproj/internal/common/common.go
On the terminal command line, everything builds and all tests pass:
go build . // (works in every folder)
go test . // (tests work and pass)
However, from VS code I have 2 problems:
1. Imports from package to package do not work at all. For example:
package test
import (
service "azure.com/myproj/cmd/service" // VS complains on this line when running the test.
)
The command that VS code runs is not just "go test . ". It passes extra parameters that include what seems to be a cached path, which I tried deleting from the file system, but it did not have an effect. This is what VS.code's Output tab contains:
Go Tests tab:
unknown import path "azure.com/myproj/cmd/service":
cannot find module providing package
azure.com/myproj/cmd/service
Go tab:
/Users/computername/go/src/azure.com/projname/cmd/service/tests
>Finished running tool: /usr/local/bin/go test -c -o
/var/folders/q5/hm9v_6x53lj0gj02yxqtkmd40000gn/T/vscode-goKGOMES/go- code-check azure.com/myproj/cmd/service/tests
can't load package: package
azure.com/myproj/cmd/service: unknown import path
"azure.com/myproj/cmd/service": cannot find module
providing package azure.com/myproj/cmd/service
I do not understand what VS code is doing above with hm9v_6x53lj0gj02yxqtkmd40000gn and how I can change it. It looks like a cache.
So to summarize: When testing through VS Code, i do not understand why it's using the command that it is to run the tests (above), and why it can not find the imports, which the regular "go build . " and "go test . " commands have no problem with through the terminal.
Once again: From the terminal command line everything builds and all tests pass.
Seems to clearly be a VS Code related issue.
I found the answer to my problem. VS did not like the file path structure for the project. Here are the changes I made:
Moved main.go from azure.com/myproj/cmd/service/main/main.go up a level to azure.com/myproj/cmd/service/main.go
Moved the service implementation (service.go) into the internal folder: azure.com/myproj/internal/service/service.go
Moved the tests into the internal folder:
azure.com/myproj/internal/service/test/service_test.go
How VS code is able to run the tests without complaining of the imports not being found.
So now I only have the main.go in my /cmd/service folder. Everything lives in Internal, including tests. I suspect that burying main.go into a subfolder is what was confusing VS Code.
So my situation is that I finally finished configuring TeamCity for CI. I got it to run my unit tests with some friendly help on SO.
However, many unit tests fail because there needs to be a config file alongside the unittests.dll once it's built and ready to run.
I've written a simple Command Line step with:
copy %system.teamcity.build.checkoutDir%\xx.configfile <destination>
The destination is the problem, I need it to be the Out directory teamcity creates.
TC creates SYSTEM_<machinename> <datetime>\OUT. An example:
C:\TeamCity\buildAgent\temp\buildTmp\SYSTEM_GIDEON 2015-07-02 16_51_09\Out
In there is my unittests.dll and I want to copy my config file there. What environment var or (anything else) can I use in the command line script?
The (1) Build Tests is a Step then I want to run the (2) Copy Config Step Then (3) Run Tests. After step (1) I have that xxx\xxx\Out directory and I need that directory from some variable.
I'm using Teamcity 9.0.2
Your problem is not to do with TeamCity I don't think, it's to do with the way that MSTest works. You need your .config file to be a DeploymentItem and have your tests deploy it to the directory that MSTest will run the tests in.
To be honest I'm surprised that you don't have this problem running locally, and it makes me think that you must be using some other test runner (like ReSharper) to run the tests if you have not seen this problem on your local machines.