How to pass random parameters to Workbench or Classic Record&Play Scenario
I am new to SilkTest and don't have any scripting background. What I need to do is to record some test cases and then play them to check my system. After getting used to it, I plan to learn scripting and dive into it, but first things first.
What I need is to pass random generated (or randomly read from a text file or pre-defined) parameters into the recordins so that every time I run the tests, different parameters are used. For example, there is a component in which I write some letters and the component filters the result based on the text. Then, I select one of the results. Now, instead of recording the same letters everytime, can I use random given parameters?
If you are using the Silk Test Workbench you have a number of options, you could use an ActiveData file, essentially a reference CSV, TXT or Excel file that holds your data. Change the references to the hard coded values to calls to the ActiveData file.
You can also create .Net scripts and Visual tests so that they accept parameters, these can be passed to them via the command line STW.EXE (see the documentation).
Thanks @eggbox, I see you also answered my question in so, thank you for your time.
Does SilkTest only support .Net scripts or can I also use Groovy or Java Script?
I will check the documentation. I managed to use local variables. I think I am getting a hold of this
Silk Test comes with the following clients,
- Silk Test Workbench - Offers Visual tests (no coding) and VB.NET scripts.
- Silk4Net - Integrates with Visual Studio, scripts are written with C# or VB.NET.
- Silk4J - Integrates with Eclipse and uses Java as the scripting language.
Since all these environments are standard programming languages (except the Visual test) you should be able to use any third party library in your scripts, all you do is add a reference to the library and code against it.
Thanks @eggbox. I have another question:
Assume there is a component in which you write some letters and the component filters the results based on the entered letters. The filtering starts with the third letter and with every other letter, the filtering continues. Assume I want to write "sqaforums". Now, when I run this code from Eclipse, after the first 3 letters, the component filters the results while SilkTest is still active. Therefore, the remaining chars are not appended to the first 3 but they are overwritten. So, the result is not based on "sqaforums" but, say, is based on "forums". If I use sleep(2000) after write("sqaforums") command, the problem could be solved but a friend of mine told me it is not good to use sleep to overcome these problems.
Long story short, is sleep a bad thing to use or can I use it freely whenever I need it? If it is harmful, what other choices do I have?
Thanks for your time
To answer your question about ST Classic, you can of course pass arguments to 4test scripts, as well creating testcases and alter them using Data Driven Workflow, so you turn "normal" testcases into data driven testcases, that can use external files or tables of data. In addition Rand* functions may be of special interest to you to pick random values for your test actions.
About your last question: I guess it will depend on the behavior of your application, but you may like to change typeKeys("sqaforums") to setText("sqaforums") which may be quicker and more stable for your automations. Also sleep() can of course be used if you are fine with it - although there are smarter methods for synchronizing special needs like .Exits() or WaitFor* methods.
Having said this you can of course get further assistence to all of these concepts in our product help.
Thanks @stpoweruser, your response helps me great.
I can change the typeKeys() to setText(), the command was given by the Workbench automatically. I think I will have to make some adjustments. I also downloaded full documentation and following the tutorials.
Another question that I would like to ask is;
Assume there is a work flow that when I sign a document, the documents is sent to another person for approval. All the signed documents are collected in a pool waiting for approval. Now, assume the scenario is as follows:
1. I sign a document with the number N001
2. Meanwhile, others also sign some documents with numbers as N002, N003, N004
3. The approver signs in to the system and clicks on "Waiting for Approval" button and lists the documents
4. The systems displays the documents as "the laters signed is in the first row" therefore, the list will look like:
5. While recording, assuming nobody else sent any documents, I can easily find the document with the id N001 because it is the first one. However, while playing it or even recording it, somebody might sent documents for approcal and this will change the order of my document.
6. The test will fail (or maybe pass but with the wrong document)
Now what I need to do is, search for all documents in the queue, look for the document with N0001, find it, and proceed with it.
Is this doable with Workbench or do I have to use Silk4J?
Ps. Sorry for the long post, I wanted to explaing everything in detail.