How to resuse selenium test file in another selenium test - selenium

Is there way where I can use one selenium test file in another test file like an include directive or something?
I do not want to create duplicate files, there is only one change I have to make in an existing test file so I thought if there was a way to use an existing test file ?
Thanks for your reply, I am using Ruby

It depends on what language you use for coding. In java to reuse another selenium test file we use the import directive. If you are using java I can show you a sample pseudocode.
What language are you using?

Related

TestCafe Studio: How do I import ES modules so I can use them in a TestCafe Script?

I want to use imported functions in TestCafe Scripts (which are basically copied into the test method). To me these scripts would be great to create reusable code snippets.
But I did not find a place where I could import a module which is then added to the import statements in the header of the test file.
An example:
I have a test-function I use for visual regression tests. It basically takes a screenshot of the page and compares it to a screenshot stored on disk. Since this also includes reading and writing files from/to disk using nodes fs API and calling packages like graphicsmagik, it quickly becomes a huge script. I might be able to copy it into a a TestCafe Script block, but it is not reusable and hardly scales.
Is there something I missed?
Of course I could create some command-line task that adds the import line to the top of all generated js files. But the test would only work after someone made them js files and ran my script. It would not be possible to run these tests directly from TestCafe Studio.
You can put your code to a separate module and import it using the Run TestCafe Script:

How to specify which binary Intelij uses when running tests with the JUnit plugin

I use InteliJ to run JUnit tests.
I would like to specify the name/path of the command it uses to execute them. Specifically, rather than the specified JDKs/bin/java, I'd like to use a custom command (e.g. my_java).
My particular reason is that I'd like my_java to be a small script that launches "java" at a lower priority. If there is an alternate approach, that would be just as useful.
I reached out to JetBrains and asked them directly. According to them, specifying a custom binary is "not possible". They did suggest I look at writing a custom external tool.

I want to create bat file, The Selenium Project is been developed using TESTNG and Java. I have suite in xml.

Now i want to create bat file, Please file in creating bat file.
I don't have main function in my project.
I want to run the test suite in Main class. How can i do that ? Source code please.
You can generate your xml from main function.
I can provide source code, but it is against policy of stackOverflow.
first show your research.
I think many might have answered this.
Hint: use TestNG class
and add XMLTest, XMLSuite and XMLClass objects to it.

What files I should use in Automation testing framework

I am making Automation Framework using Selenium , JAVA, Maven, TestNG & Eclipse.
So my question is regarding which TYPE OF FILE I should use for:
Keeping test Data ? (Right now I am using XML file as it is light &
free unlike Excel)
Creating test case. ? (Currently I am using simple .Java text file for each test case)
For creating Reports ? (Thinking to make XML report & then display it using HTML file)
Will be nice if you share Pros & Cons along with your views/recommendation/suggestion.
I think this will help me finalize my file structure. We can add functionality & facilities anytime.
Thanks a lot.
Keeping test Data, you might want to try using .Java files to store data, then use getter and setter. If you are using TestNG you can use the annotation #DataProvider() which will really help you on keeping test data.
Constants can also be put in . Java files as an interface
Creating test case --> It is a good thing to use .Java file
Creating reports --> Yep, you got the idea. Try to use TestNG, it's easy to set up.

Create Fitnesse pages without using Camel-Case

I am currently migrating a huge amount of scripts to Fitnesse. I implemented a converter that takes the existing scripts XML and converts them to Fitnesse Files (e.g. content.txt). This is working correctly. However, I am still facing a problem with the names since they are not camel-case formatted (an example of a script name is the following: BANK_Tran_BankStmtLoad_Add). Most of the scripts have such names. It is possible to programatically remove the "_" but this won't work as well since we still have several consecutive capital letters. Is there a way to create new pages in Fitnesse without having to write the names in Camel-case.
Thanks in advance.
Looks like this is baked into FitNesse. I tried manually creating the FitNesse folders but no luck. You can run tests outside FitNesse with Folder Runner: http://fitsharp.github.com/Fit/FolderRunner.html or http://fitnesse.org/FitNesse.UserGuide.FitLibraryUserGuide.FolderRunner