How to provide nested folder path in testcafe commandline? - testing

I'm unable to provide nested directory path in testcafe command line
I have created different directories under the test folder to consolidate different type of test
Example: I have folder "BVT" and "UnitTest" under test folder
Test -> BVT
Test -> UnitTest
To run only BVT test, I'm using below command to provide nest folder path but testcafe unable to find under sub-directory
Example: testcafe chrome /test/btv/
Error: "ERROR No tests to run. Either the test files contain no tests or the filter function is too restrictive."

You need to add a dot indicating the current directory. You can also omit the trailing slash as it is redundant:
testcafe chrome ./test/bvt
Your path specifies the folder located in the root.

Related

How to set the user define path for log/output/report file of robot framework on command line

I am using robot framework with pycharm.
I am running all the tests of my folder using
testfolder>robot .
I want to set the path of log/output/report file to my customized location.
I have change the path of screenshot as D:/Screenshot folder in my variables.robot.
But How to set the path for mentioned file?
I also wanted to know
What is the common to run on terminal/cmd to run all the scripts of same folder with defined log file path?
Robot Framework User Guide walks you through the Basic Usage in quite good detail. Additionally the same document contains a section for the Different Command Line Options Available where you can get quite good picture on the options you have available.
Specifically --outputdir or -d will make Robot to save Log.html, Report.html and output.xml to the specified folder.
As mentioned by #Morkkis, the -d or --outputdir would do the trick. Also, it works for both command line and PyCharm Arguments field
For the screenshots, you could use the screenshot_directory command line argument. Please, check the Keyworkd documentation for more details ScreenShot Library Documentation
Also, for the report/logs file location, you can use these variables:
${LOG LEVEL} Current log level.
${OUTPUT FILE} An absolute path to the output file.
${LOG FILE} An absolute path to the log file or string NONE when no log file is created.
${REPORT FILE} An absolute path to the report file or string NONE when no report is created.
${DEBUG FILE} An absolute path to the debug file or string NONE when no debug file is created.
${OUTPUT DIR} An absolute path to the output directory.

How can I run all test files that are in different folders using mocha?

I want to run my mocha test using npm test the problem is that the tests may vary their location.
The locations may be lib/modules/somefolder/test/*-test.js or lib/modules/somefolder/anotherfolder/test/*-test.js
Currently my test script is like this node_modules/.bin/mocha lib/modules/*/test/*-test.js --reporter spec but this won't find the test files located in the second location.
Is there any way to find the tests in both locations?
You should be able to accomplish this by doing ./**/*-test.js. This should find any files with -test.js in the name in any directory relative to the one you are in.

Testcafe - How to set relative instead of absolute screenshot path in reports

I'm using spec and xunit reports. My .testcaferc.json is:
{
"screenshotPath": "artifacts/screenshots",
"takeScreenshotsOnFails": true,
"screenshotPathPattern": "${DATE}_${TIME}/${USERAGENT}/test-${TEST_INDEX}.png"
}
When the test failed in the spec and xunit reports shows the link to the screenshot, but that link has an absolute path. That is ok when I run tests locally. When running in Jenkins CI/CD the publish xunit report can't find the screenshot using absolute path due to using a relative path from "workspace" folder. Is there any way to config Testcafe to put the relative path into testRunInto.screenshotPath. I need a relative path to screenshots for any report providers.
Upd: I'm using a Jenkins Agent server to run test. The absolute path to workspace in this case: /home/jenkins/workspace/e2e. Screenshoots located in relative path: artifacts/screenshots or absolute path /home/jenkins/workspace/e2e/artifacts/screenshots. In xunit report (or any other) we got an absolute path for the screenshots. When all test finished Jenkins Agent push the whole workspace to the Master Jenkins server and absolute path to workspace became: /home/jenkins/job/test/ws/e2e and path to the screenshots: /home/jenkins/job/test/ws/e2e/artifacts/screenshots. Then Jenkins post-build action publish "Junit test result report". But inside that report we have the absolute path to the screenshot came from Jenkins Agent Server. As a result Master Jenkins unable to find the screenshot when shows the test result report.
Previously I used to use Selenium and Maven or Gradle to run the test and there was a relative path to the screenshots.
At present, TestCafe does not have an option to use relative paths in reports. I've created a suggestion in the TestCafe repository for your case - https://github.com/DevExpress/testcafe/issues/3497. If this feature is important for you, then you can try to implement it yourself.
It is not difficult. You need to do following: add a new option (see an example here) and change the path resolving mechanism depending this option (see an example here).

Does UFT (14.xx) supports Relative Path to call the existing API Test from GUI Test

Does UFT supports Relative Path to call the existing API Test from GUI Test? Right now I am calling the API test from GUI Action using option (Insert Call to NewAction -> Call to Existing API Test/Action -> Navigate to the directory where API test exists). Here Test is being added using absolute path.
But Here I would like to use the relative path to call the existing API test. But During the navigate to the directory, If I try to give the relative path (Let's say if API test is present inside the folder APITest inside the GUI test directory, If I provide the relative path as //APITest), it doesn't identify the test present.
Inside the options -> Folder, Current test directory has been already added by default.
Can anyone please help me to fix this issue?
Thanks
An other alternative would be that you compose the path yourself:
RunApiTest Environment("TestDir") & "(\..\)rel\path\to\api\test"
Environment("TestDir") always contains the full path of the current test be it the FileSystem or HPE ALM

Location for install.rdf

I am trying to write a plug-in for selenium UI and following this tutorial. Below is an excerpt from this.
First, what you need is an ‘install.rdf’ file and is located in the
root dir of your workspace
I am not sure what is root directory of workspace here mean. So I have firefox and selenium installed on my computer. Where exactly should I create this install.rdf
The root directory mentioned here is the root directory of the IDE source code. You can download IDE src code from location given below and put the install.rdf in the root.
Selenium IDE src code
Once you have made changes to the plugin src as per your needs. You can build it and install the .xpi hence built to your firefox instance like a regular extension and test it.