Blog to understand automation concepts in QTP, Selenium Webdriver and Manual Testing concepts
How to create array from string separated by delimiter using vbscript split function
Labels:
qtp Scripts,
Test Scripts,
VBScript
Suppose we have a string with value as : stringA = "nitin>joshi>qa>qtp>automation"
'' We can create an array using split function
Strarray = Split(StringA, ">")
'' we can loop through the array element using:
intPropSet = Ubound(Strarray) ''this gives the length or upper bound index of array.
for i = 0 to intPropSet
msgbox strarray(i)
Next
''This can be useful to loop in validating multiple values ''e.g : Validating existence of multiple links with name as nitin or joshi or qtp or automation
''We can combine the values in an array using join statement
If (IsArray(Strarray)) then
stringB = Join(Strarray, ">")
msgbox "array with text: " + stringB
Else
msgbox "not an array"
End If
So while understanding How to create array from string separated by delimiter using vbscript split function, we have now understanding of Join, split, IsArray,Ubound and lbound also
How to Create and execute Runnable JAR file for Java Project from command Prompt/Batch file
Labels:
Selenium Automation
In this article, we will discuss steps to create an executable JAR file from a java project. This can be useful for our selenium Project. We are using Eclipse IDE for illustrating the example.
Prerequisite – It is assumed a java project is created.
Steps to create an executable jar file:
Define the Run Configuration for execution
1. Navigate to Run>Run Configuration for the Project.
2. Select Java Application and click on New launch configuration
3. Provide the name to configuration and provide the main lass name to run.
4. You can also define default argument for the execution.
5. Save the configuration
Creating run configuration
Export the Project as executable Jar file
1. Click on Project>Export
2. Select export destination as Java>Runnable JAR files
Exporting as runnable JAR file |
3. Select Run Configuration as one defined in step A.
Providing export location and launch configuration |
4. Provide export destination
5. Click on finish
Run the executable JAR file
Through command prompt.
1. Open command prompt
2. Navigate to folder in which JAR file is saved.
3. Run the following command java -jar driverJAR.jar where driverJAR.jar is the name of JAR file
Double clicking on a batch file
1. Create a new text file in the same location as the JAR file.
2. Rename the file as test.bat, thus creating a batch file.
3. Add following content in the bat file
@echo "this is for testing the jar file"java -jar testingJAR.jar
pause
4. Save the file.
5. Double click the file, it will run the jar file
Subscribe to:
Posts (Atom)