We are automating tests using selenium, and I would like to be able to update the test to their latest status based on the result of the automated test.
I'm able to identify the test, but it appears the Status property does not have a setter.
It sounds like you're using the Object Model library.
The Object Model library does not, in fact, have a setter for that property. It may expect you to use an Operation on that asset to adjust status, such as .Close()
The SDK API library has more fine-grained access and allows more arbitrary asset editing. You may also hit the rest-1.v1 API endpoint directly with an XML body describing your attribute change. You'd need to know the ID of the TestStatus list item you want to set it to, and do a single-valued relation update
Do you have code you can share?
Once I have a VersionOne.SDK.ObjectModel.Test object I was able to do the following:
Test test = null;
test = FindTest(regressionTest); // This finds the Test object.
test.Status.CurrentValue = status;
test.Save();
Related
I use the repositoryFactory in a custom plugin's Vue file in Shopware 6. When I save an entity I do this:
this.settingsRepository
.save(this.setting, Shopware.Context.api)
.then((result) => {
In case the person sends the form and this function is called, I want to get back the id of the setting in case the person hit's the save button again. But then the entity needs to be updated and not created. As I see from the response, there is an id, but it's in config.data -> json serialised.
How's the default way of solving this issue?
The best practice would be to re-fetch the entity after persisting it. This is because some entities may have fields that get automatically computed or indexed server-side and you'd probably always want to have the entity in its actual current state. If you're absolutely sure you don't want to fetch the entity again, you could manually set the _isNew flag to false after persisting:
this.setting._isNew = false;
This will then cause the save function to use the update instead of the create route. Keep in mind that this is actually kind of an internal property, as there is no setter for it and as already mentioned fetching the entity again is encouraged.
Also you shouldn't have to worry about the id. It should've already been generated client-side and set to the entity, when using the repository to create a new entity like that:
this.setting = this.settingsRepository.create();
Im doing a customization and need to get a field value from the screen in view mode using a ClientScript.
I've tried many ways using record and currentrecord Modules.
define(['N/record', 'N/currentRecord'], function (currentRecord) {
idTransacao = context.currentRecord.getValue({fieldId:
'internalid'});
}
i expect to learn how to handle screen information in view mode using ClientScrip,
Any hel is appreciated!
You've stated dependencies on two modules, N/record and N/currentRecord, but then only actually parameterized one as currentRecord. Then you're interrogating context.currentRecord without ever defining anything named context.
Recommend watching this tutorial on building your first 2.0 module: https://www.youtube.com/watch?v=I-7HzlhyXNI
Then you'll want to study the API for the N/currentRecord module. That is the correct module for working with the record in context within a Client Script. You'll note that the first thing you need to do is retrieve a reference to that record via the module's get() method.
However, by default, Client Scripts are not executed in View mode, so what else are you doing that deploys your Client Script to View mode?
I use Xamarin Forms with azure-mobile-apps-net-client with the .net backend. What I noticed is, that if I change a value in my mobile app for my model like
var dog = get_dog_from_sqlite_database();
dog.Color = "black";
and call
await dogTable.UpdateAsync(dog);
and then sync with the server, the Delta<Dog> patch object in the
public Task<Dog> PatchDog(string id, Delta<Dog> patch)
method in the backend, contains every property from my dog model, although changing just one value.
Is it possible to change some settings, that just changed values are patched to the backend? I ask, as I have to do some restrictions on who can change what values, so my backend code would be cleaner as I just have to look if a forbidden property was changed and then throw an exception.
No - when we do offline sync, we don't necessarily know which fields have changed - we don't keep that granular information. We just keep the new record. You can check out the operations queue in the SQLite database to confirm this.
How to access a connector / Data Base from the initial/instantiation Form/Page?
Hi every body, any help will be appreciated.
I try to access using the API Rest, but the method need the activyty/task id or the instance flow id.
This is because the connector stores its result in a proces/local/Busines data model or Variables,
but in the initial form I don't have an
instance of the flow/task/activity and I can't access to the variable that stores the value.
I need to use the connector to access data base and to the Ldap
to get some values to show in the initial form before instantiating the process.
Is there any way to call a Groovy Script from initial Form?, if there is,
I can access from that script to the data base, and save this value into a form variable, to show it in the form I think.
P.S.: I use Bonita 7.2
thanks!
Sounds like you have a chicken and egg problem.
Can you instantiate the process with minimal data, then use a connector out to populate the BDM with the connector data, and then make the first step of your process the "initial" form? At that point you then have the case, taskid, etc.
If the data is not task/case specific, you can access the BDM data via the REST API and a custom query - i.e. you're not just limited to the API's that require the case/task/instance, etc. However, you may need to get clever with how you isolate that record. For example, I have some global parameters that I keep in in the BDM, and access them within my form by requesting the first record in that table via the rest API:
I created a variable called "globals" of type "External API" with the following REST call that retrieves the record with persistenceId=1:
../API/bdm/businessData/com.company.model.GlobalParameters/1
In your case, you probably need to use a REST Api extensions. Basically, you can create a new REST Endpoint using Groovy script. There is a documentation available here: http://documentation.bonitasoft.com/rest-api-extensions-808
Cheers
I m working on a user interface in JavaFX. It is the front-end of an infrastructure service that I have already developed and is operational. I read here and there that mock can be used to avoid running all the system when it is to heavy to run, but also for isolation purpose.
At present I want to run some basic test as I am also learning how to use JavaFX and I would not want to run all my infrastructure for the matter.
Basically I have a TreeView that I would like to update based on what is coming from the service. Normally the service that runs in background would update the model and call a Platform.runlater() method to ask the UI to refresh.
I was wondering how can I achieve that using mocking. How can I have a mock object update a simplified shared structure such as a list(model) and then call Platform.runlater()? Actually I would first ask: is it a possible and appropriate usage of mock and if yes how can it be done, with which framework?
Personally what is a bit not clear to me is the involvement of multi-threading. Indeed my object under test which is the interface would not be calling any method of my mock, expect indirectly, the Run() method, given that my service is a runnable.
Hence I would appreciate if anyone could enlighten me a bit further on the matter. I'm confused....
Best,
Maatari
First prepare applications (or change your current app to support test mode) which can populate your TreeView with specific data. The entity which will provide fake data for TreeView will be your mock object for specific data. It should look like a service from TreeView point of view, which means you need to extract common methods from your services class into interface and make TreeView use this interface instead of concrete class.
To handle UI testing you can you use JemmyFX library. You can create simple test which will verify any UI properties of your TestView or imitate user actions like mouse clicks or text input. You may not worry about threading issues, jemmy will handle it for you.
It can look next way (I use junit as test harness here):
public class TreeTest {
#BeforeClass
public static void setUpClass() throws Exception {
// running your specially crafted FX application with mock service data
// you can do it any way, e.g. by calling main() method with some parameters
AppExecutor.executeNoBlock(TreeApp.class);
}
#Test // this is junit annotation for test
public void fooTest() {
// here we are receiving special jemmyfx entity which knows how to handle
// tree views and is attached to your TreeView
// (if you app has only one TreeView, you may need additional logic for several ones)
TreeViewDock tree = new TreeViewDock(new SceneDock().asParent());
// this way we can find some item which you expected to see in you TreeView
// because you've created you mock data this way.
// Note that underlying code will respect UI threading,
// will understand that UI can have delay and will give it certain time without blocking
// and will throw descriptive exception in case expected item wasn't found
tree.asTree().selector().select(new ByToStringLookup("item1"));
// you can find subitems
tree.asTree().selector().select(new ByToStringLookup("item1"), new ByToStringLookup("subitem1");
// and perform operations on them, e.g. expand:
new TreeItemDock(tree.asItemParent(), new EqualsLookup("item2")).asTreeItem().expand();
//etc
}
You can find more info on site on just by code completion hints