I am a tester in a Scrumteam trying to automate our test regressionset.
Our front-end is developed in Java Angular and we use Tosca testsuite to automate our testset. The problem I am encountering is as follows:
With Tosca you can scan the application and all the fields, atributes, divs, and so on are shown to the user. The moment I scan one of our datatables I see them as what they are: a table. However, every field/button/icon/etc is being scanned as a seperate object.The table has 1 body, but the individual rows are not found. Meaning that the rows within the tables are not identified.
This makes it impossible for me to perform an automated search on a table, because the rows and therefor the colums are not identified, only the header is.
Anyone ever encountered this issue with a testtool or found a sollution how to fix this in the coding of the front-end in Java Angular?
This is a common scenario when the application under test is developed using UI Libraries, where the complex controls (e.g. Table, Combobox etc.) are rendered not as a single HTML tag (<TABLE> for Table or <SELECT> for combobox). Instead you will find bunch of other HTML tags (<DIV>, <SPAN>, <TABLE>, <UL> and what not!)
If I understood correctly, there are two ways to automate this scenario -
You mentioned that you are able to find a <TABLE> tag (The header). There good
chances that each row in the table is itself a <TABLE> and that's
why you are not able to see all the contents in a single one (you
can cross check this in the Content View section of XScan
window). If you just need a single row for verification (I am just
assuming!), you can select any one of them and use ConstraintIndex to get to the right row data. You can also look for a parent control (basically another <TABLE>) which clubs all the child table. This parent table might show all the data in one place. Table Verification will work with this control. Please remember that it is
just a workaround and might not fit into your scenario.
You can write a custom control to handle this. Custom control is a way where user can define how a control looks like. Once you implement this, Tosca will be able to recognize the table as a single control containing all the data. For more information on this, check the Tosca API reference here
For a project, I need to create a table to read the data from user in UI..and just need to create an XML document from these values which I want to do via calling a method...there is no back end DB for this...
What I have done is create a Entity object without existing Schema Object and created an view object from that Entity object....
But when I am running it, it gives an error..."View or table does not exist"..
What is wrong with this approach? or can anyone suggest me a better approach for this..
EOs represent a table in the database. So, as Endrik said, if you have no table you do not need an EO. You want a programatic VO. Try here.
I have two radiobuttons(Say rbtn_Asia,rbtn_Europe)and one JTable. When I select rbtn_Asia, table must contains Asia's data. Similarly when I select rbtn_Europe, table must contains Europe's data. (Asia's data and Europe's data is in same database which will be updated periodically). I have implemented upto this.
My problem is like this: Consider the following case: I have selected rbtn_Asia and obviously table will contain Asia's data. Now let database has got two new tuples of Asia, how can I update the JTable dynamically without selecting the rbtn_Asia once again (because rbtn_Asia is already in selected state).
In your button handler, update your implementation of TableModel, which should then fire the appropriate event. A structure that supports clear() such as Map, shown here, is convenient. More examples may be found here.
I need the sample program in Java for keeping the history of table if user inserted, updated and deleted on that table. Can anybody help in this?
Thanks in advance.
If you are working with Hibernate you can use Envers to solve this problem.
You have two options for this:
Let the database handle this automatically using triggers. I don't know what database you're using but all of them support triggers that you can use for this.
Write code in your program that does something similar when inserting, updating and deleting a user.
Personally, I prefer the first option. It probably requires less maintenance. There may be multiple places where you update a user, all those places need the code to update the other table. Besides, in the database you have more options for specifying required values and integrity constraints.
Well, we normally have our own history tables which (mostly) look like the original table. Since most of our tables already have the creation date, modification date and the respective users, all we need to do is copy the dataset from the live table to the history table with a creation date of now().
We're using Hibernate so this could be done in an interceptor, but there may be other options as well, e.g. some database trigger executing a script, etc.
How is this a Java question?
This should be moved in Database section.
You need to create a history table. Then create database triggers on the original table for "create or replace trigger before insert or update or delete on table for each row ...."
I think this can be achieved by creating a trigger in the sql-server.
you can create the TRIGGER as follows:
Syntax:
CREATE TRIGGER trigger_name
{BEFORE | AFTER } {INSERT | UPDATE |
DELETE } ON table_name FOR EACH ROW
triggered_statement
you'll have to create 2 triggers one for before the operation is performed and another after the operation is performed.
otherwise it can be achieved through code also but it would be a bit tedious for the code to handle in case of batch processes.
You should try using triggers. You can have a separate table (exact replica of your table of which you need to maintain history) .
This table will then be updated by trigger after every insert/update/delete on your main table.
Then you can write your java code to get these changes from the second history table.
I think you can use the redo log of your underlying database to keep track of the operation performed. Is there any particular reason to go for the program?
You could try creating say a List of the objects from the table (Assuming you have objects for the data). Which will allow you to loop through the list and compare to the current data in the table? You will then be able to see if any changes occurred.
You can even create another list with a object that contains an enumerator that gives you the action (DELETE, UPDATE, CREATE) along with the new data.
Haven't done this before, just a idea.
Like #Ashish mentioned, triggers can be used to insert into a seperate table - this is commonly referred as Audit-Trail table or audit log table.
Below are columns generally defined in such audit trail table : 'Action' (insert,update,delete) , tablename (table into which it was inserted/deleted/updated), key (primary key of that table on need basis) , timestamp (the time at which this action was done)
It is better to audit-log after the entire transaction is through. If not, in case of exception being passed back to code-side, seperate call to update audit tables will be needed. Hope this helps.
If you are talking about db tables you may use either triggers in db or add some extra code within your application - probably using aspects. If you are using JPA you may use entity listeners or perform some extra logic adding some aspect to your DAO object and apply specific aspect to all DAOs which perform CRUD on entities that needs to sustain historical data. If your DAO object is stateless bean you may use Interceptor to achive that in other case use java proxy functionality, cglib or other lib that may provide aspect functionality for you. If you are using Spring instead of EJB you may advise your DAOs within application context config file.
Triggers are not suggestable, when I stored my audit data in file else I didn't use the database...my suggestion is create table "AUDIT" and write java code with help of servlets and store the data in file or DB or another DB also ...
As we know Data Blocks style layout in oracle can view in 2 way:
1. FORM
2. TABULAR
I want to know in Java is there any component have same behavior? I mean I want to have table(in form style) same as a data blocks that customer enter his data than after he press save all data go to database, is it possible or not?
Unlike .NET, Java doesn't have a UI component which can be connected directly to a database table for editing.
I'm also not aware of a framework which adds this. There are DB tools like SQuirreL SQL which have inline table editing.
There are lots of frameworks to map DB tables to Java POJOs (Hibernate, for example) but that means you need to define Java mappings for your database tables. With that, you can use UI frameworks like Metawidget to create an editor.