How to use RCPTT Folder Context in Maven? - maven

Let me know about how to mavinize Folder Context in RCPTT!
FYI: I have created a folder context (my_folder_context.ctx referring to a remote folder). First I click "Apply" button after opening the .ctx file in RCPTT tool to copy the contents to AUT location than execute the test cases to get the test data.
But while automating the same I don't find any entry for *.ctx file in RCPTT-maven-plugin. For suites we have below:
<suites>
<suite>MyTestSuite</suite>
</suites>
...but the same I didn't find for *.ctx files or any way to refer the folder context from ECL script .

Yes the short answer is this is NOT possible as the foldercontext is obviously not a testcase. You can only add the test case inside test suit.And it does not make any sense to execute a foldercontext file which is not doing any thing and no result or report can be generated out of it.
By the way let me share few of my learning here:
1)Folder context can be used while recording time in rcptt but runtime it's of no use. Basically it's like a mapped directory for a remote location available inside your rcptt tool.
2)I had provided the test data location at runtime and the same I achieved through below:
Go to RCPTT->Run configurations ->VM Arguments append -D"testdatalocation" (without double quote) and provide below
in ECL script :
set-dialog-result Folder [substitute-variables "${system_property:testdatalocation}"]
or in your maven pom.xml file :
<vmArgs>
<vmArg>-Dtestdatalocation=D:\InputsForAutomation</vmArg>
</vmArgs>

Related

Unable to access directory inside workspace in jenkins

So I have a Jenkins job wherein as part of the build.
I run one script which creates a folder in the workspace say "test"
so the script runs fine and creates the folder test.
After this, I have a maven command wherein I want to access this test folder(as an argument) I am trying it as $workspace/test
but it's not working.
Can anyone guide if i am missing anything here
Can you give us more information - maybe code snippets?
I'm not sure what you mean with 'maven command' and '$workspace/test'
If you want use a variable in a pom.xml like:
<path>${workspace}</path>
you will have to assign it in the properties:
<workspace>...location...</workspace>
Otherwise you can use maven preassigned variables like
${basedir}/

Unable to get Sonar-Qube to analyze project

I have seen the other 2 appends and added sonar.languages=COBOL to my sonar-project.properties file to no avail.
I think it's basically more a case of not understanding the documentation (or the latter never having been "idiot tested"").
My problem is as follows. My properties file contains the following entries:-
# sonar.sources=../../mfuser/seb/source/
sonar.sources=C:/mfuser/SEB/Source
sonar.cobol.file.suffixes=cbl,cpy
sonar.cobol.copy.suffixes=cpy
#
sonar.languages=COBOL
When I run the sonar-scanner bat file, I'm seeing output like this:-
WARN File C:\mfuser\seb\source\vvira20.cbl is ignored. It is not located in module basedir c:\sonar-scanner\bin
To me this gives the impression that I can point to the directory containing my COBOL code, but at the same time the actual code HAS to be in c:\sonar-scanner\bin. Surely, that can't be the case? If it is, what is the point with the sonar.sources entry in the properties file?
In addition, onece I get this working, is there some way of specifying a parm/wild card so as to analyze SPECIFIC files. I tried sonar.sources=C:/mfuser/SEB/Source/vno* but that didn't seem to make any difference.
Thanks
You ran sonar-scanner from its own directory instead of running from the project directory. As the documentation says:
Run the following command from the project base directory
sonar-scanner
This same documentation recommends to create the sonar-project.properties file at the root of the project directory and to set the "sonar.sources" property to a path which is relative to the sonar-project.properties file.
Alternatively, you may want to use the "sonar.projectBaseDir" property. See the documentation for analysis parameters.

Relative path inside tests with TeamCity

Inside my MsTests I have to reach and use a file in my project. So I am using Path.GetFullPath(#"......\name_of_file")
But when running the build I get a file not found error because the context of the path is the temp directory (C:\TeamCity\buildAgent\temp\buildTmp) instead of the checkout directory where all my files are (C:\TeamCity\buildAgent\work\e87255825b2f3eb1)
Is there a config to change that? Or a better way to do it?
I couldn't find a TeamCity option to specify the directory the unit tests should be run. Someone else might be able to help there.
However, I usually include files that are needed for the unit tests as embedded resources so that during execution you know for sure the file will always be accessible no matter where it is running from. You can easily get a Stream from an embedded resource and if you need to use an API that only takes a file name you can write the file to Path.GetTempPath().
I modified my tests to refer to the files like this:
string currentDir = new System.Diagnostics.StackFrame(true).GetFileName();
var workingFile = new FileInfo(currentDir);
string fileContents = File.ReadAllText(workingFile.Directory + #"\ResourceFolder\MyFile.xml");
I know this isn't a good way to do it, but this works for me locally and when called from TeamCity.

How to access test artifacts from Jenkins if test fails

I have a Maven project which performs a number of time consuming tests as part of the integration-test Maven cycle. I'm using Jenkins as the CI server.
During the integration test a number of files are produced in the target folder. For example, an "actual" BMP file is produced and compared to an "expected" BMP file. If the test fails, I need to look at the files in the target folder to determine how to deal with the error. Maybe the actual BMP looks fine and so it should be promoted to the new expected BMP. On the other hand, it may reveal a problem that requires a code fix.
The thing is I don't have any way to get access to these files, other than to ssh into the CI server and manually scp the files over to my own machine for closer inspection. It would be extremely helpful if I could access these files from the Jenkins web interface.
I tried using the build-helper-maven-plugin to attach the relevant files as Maven artifacts, but the problem is that there is no suitable phase in Maven that executes after an integration-test, if any test fails.
What can I do? Can I use the "Copy Artifact" plugin for this?
1) The files in the target folder can be accessed using a link such as /ws/projectname/target/filename...
2) Rather than typing the url each time, the SideBar plugin can be used to add a link to the file to Jenkins' left menu, making it easily accessible.
You need to copy your files into your workspace in a build step and archive them from there - Jenkins lets you specify artifacts only relative to the workspace.
I usually create a directory keyed by the BUILD_ID in the workspace, so that artifacts from different builds do not get mixed up in case I do not clean the workspace and archive from there (specifying ${BUILD_ID}/**/* in the archiving step).
In case your build fails before it can run the copying step and because of it does not do the copy, take a look at this question.

How to bundle an openframeworks application in xcode (relative resource linking?)

An trying to get openframeworks to build me my application so that i can open it from anywhere and it will load the needed images from within the apps Resources folder.
I believe this is relative linking?
I have done it before, on an older xcode and oF 61.
To do this i dragged the needed images into the project file on the left and added it to the executable target, with in a 'build phase' -> 'copy files'.
Been trying all sorts of methods, ofSetDataPathRoot() which solved the problem last time isnt working for me this time.
Any ideas/help would be appreciated!
Thanks
First you need to tell xCode to copy your /bin/data directory into your application bundle by adding a build phase:
1. Click on your project in the Project Navigator
2. Select "Build Phases"
3. Toggle open the "Run Script" section and paste in the following:
cp -r bin/data "$TARGET_BUILD_DIR/$PRODUCT_NAME.app/Contents/Resources";
Then tell your app where to find the data folder relative to itself within the bundle.
Inside the setup method of your oF app:
ofSetDataPathRoot("../Resources/data/");
ofSetDataPathRoot() should solve this problem. Perhaps you are setting the replacement root path incorrectly?
Try calling ofToDataPath() yourself on a string path and print out the result, then use Terminal and cd inside the .app bundle to check if the path sounds correct. Paths are expressed relative to the location of the actual executable inside the .app bundle, so if the executable is at myApp.app/Contents/MacOS/myApp and the data files are at myApp.app/Contents/Resources then ofToDataPath( "texture.png" ) should return something like ../Resources/texture.png.
You can double-check the current working directory (myApp.app/Contents/MacOS in my example) by calling getcwd(), open up a terminal and type man getcwd for more info on that.
oF now sets data path root and does internal calls to ofToDataPath() by default. What version are you using?
Have you looked inside the product's package contents to make sure your resources are getting copies in the proper build phase?

Resources