Parallel execution with TestNG and appium - multithreading

I'm currently busy with an test automation project for mobile devices and I want to store my results in a database.
I do this with a custom assertclass which I created, this one stores the result.
The layout is as following -> There are runs which contain Tests which contain Steps.
When I want to run in parallel, I create a unique id for the run based on thread and date and store this one in a static list. This is #BeforeTest.
At the #BeforeClass, I search in the list for the right thread and assign the correct name to the variable of the class.
But I receive constantly a Nullpointerexception for the list in the beforeclass or the variable is null while it was filled in in the #beforetest.
What are we missing here? Or how is this done when you need to store a parameter that is generated once for the whole run?
Thanks in advance,
Jonas Vandevelde

Related

Jira Scriptrunner - Update a parent's field when modifying the child's field

In Jira, we have a series of subtasks all belonging to a common parent task. For ease of explanation, these subtasks will referred to as such, and the parent task will be referred to as the lesson.
On each subtask, there is a field 'Percent Complete', which is manually updated by the user as progress is made on the subtask.
The lesson will also have a 'Percent Complete' field, which the user cannot manually update. Instead, I would like it to be updated through the execution of a Groovy script when a subtask's 'Percent Complete' field is updated by a user, since the lesson's Percent Complete will be comprised of the weighted sums of the child subtask's Percent Complete field.
I'm a programmer with no experience in Jira customization. The actual logic behind getting the Percent Complete value for the Lesson task is super simple, but I don't know how to 'hook everything up'. So my question is this:
How can I trigger a field in a parent task (the lesson) to be updated to a calculated value when the value of the child (subtask) field is changed?
My original thought was to create a Custom Scripted Field in the subtask, and in the groovy script which is attached, find its parent task (the lesson), and then iterate through all of its subtasks, performing the relevant calculations on the required fields and then writing the result to a custom field belonging to the parent.
Is this the right approach?
A script field is not a good approach for what you try to achieve. A script field gets evaluated and runs its script every time an issue is requested, so it would run far too often for your needs. E.g. it will also run for every issue whenever a jira reindex is performed or whenever a user looks at an issue.
Zeddzull commented with a better approach. In a script listener, you can respond to issue updated events and check which field was updated and only update your parent issue if needed.
More documentation is available here.
If you google a bit you'll also find info about how to check for changed fields or how to update a custom field.
Getting your parent issue is as simple as calling the getParentObject() on your issue instance.

Multiple mongo-oplog instances for Node.js

I'm trying to read in and loop through a configuration file which contains different mongoURIs and then trying to monitor their activity using mongo-oplog. I don't really know how to set the listeners (such as for update, insert, and delete) for all of these databases dynamically. Any ideas as to how I can go about doing so?
This is what I ended up doing (in case it helps someone out in the future).
I stored each URI in a list along with anther list that contains it's details like DB and collection name, and it turns out that you can loop through the list and set up each mongo-oplog one by one.
After you're done doing that the listeners are still active and whatever action you specified will be executed without you having to do anything related to the mongo-oplog again.

Script Type(s) for Updating All Item Records in NetSuite

I'm still new to NetSuite, so I appreciate any help you all can provide. I've created a script to update a couple custom fields on item records. Currently, it is a Client script, and while I do want it to execute when a user updates a record, I'd also like it to execute after a server update as well. In addition, I'd like to apply this to all current item records to provide a baseline for future changes.
Have I made this overly complicated? What script type should I be using? Can I get this done with one script, or do I need multiples? Thank you for the help!
You should use one User Event script that would run whenever a record is updated. you can deploy the script to run on items. In the user event you can check for context (e.g.: user interface, particular script type, maxss update etc.) if you do not want to run it in all context

How to compare a value in the response with earlier values in soapUI?

I'm working with soapUI and groovy to do a test whether a particular value regenerates again?
I'll have a soapUI request with JSON which gives a id in the response, i should extract tat id and store it in a dynamic location so that the when i run the test case again, i should be able to compare the prev id. if it both matches then the test case should fail, if not then the new value should be added and the when the test case runs now, it should compare the prev two values.
This goes on for a min of 10000 runs. so 10000th id should compare with all the 9999th id to check for repetition. If it exists, it should fail else the test should pass.
Please help me.. Thanks in advance!
March, 2013...wow..sorry for the late answer and hopefully you were able to find an answer to this question.
I do not have access to soapUI right so i cannot offer code for this answer but off the top of my head i would say..instead of saving the value in the dynamic location store it in a test suite, test case or project level property and each time you want to compare..just read that value and compare.
I understand you are going to have to store 10000 times so instead of creating so many properties, store the values in a list or map and store that map in the properties. Every time you need to check the value, you access that property, find what you are looking for an compare.
I'll have access to soapUI tomorrow so i'll try to write some code for you.

soapUi: possible to send list of parameters to test case

Is it possible to send a list of parameters to a test case / step in soapUI? I want to perform some database validation, and I would like to be able to pass a list of the expected values to the test case and / or step that performs the validation.
I know it's possible to send single parameters ("properties") to a test case, but I don't think that's good enough for this use case. My idea is to write a single "test case" that performs the validation that can be called from other test cases, and they pass in the values they expect to find in the database.
If you can generate the list of Random parameters through Groovy script then the best solution is: Through groovy script set the property field's value and pass this value into request using property transfer. The property field value will change at each and every run of the groovy script.
Now run the request in loop in groovy script.
So we can able to run the one test request multiple times with different parameter values.
We have a similar issue. We need to run multiple XML-files as source files for the sequence of requests. We got about 15 steps in the test, and the only thing that changes is the initial XML.
We solved this by using groovy to set a propperty to a comma seperated list, then pick the first element, remove it from the list, and run the tests. In the end, we return to the "pick first element from list"-step if the propperty is not empty.
This is a goto implementation of a basic loop, and we would prefer to do this differently, but we have not figured out how to (we run soapUI via maven2).
If you are using soapUI Pro, you can create a data source step > request step > dataSource loop step.
dataSource step can take excel, XML, grid as the soure. You need to create a property and select the type of the source.
The next step is running the request.
Then you should create a dataSource loop step. This steps returns to the dataSource until running all the request.
Please check soapui documentation
if you are not using soap Pro version, creating a groovy script is the solution as described with the previous answer.

Resources