Hey guys, i need some help.
Im doing a Automated software test, i already finish all my click’s etc…
I want create a system report for this. My ideia is when he is running the process, he creates a column in the excel for each sequence he write sucessful or fail… I already try use try catch but i dont know how it works. For example in “Open Application” he fail… then he will create a cell in excel with the name “Open Application” → “Fail” if nothing happens he write Sucessful. its a kind of Log File created by me.
Fine
—along with these sequence of workflow in this flowchart Include one more that has BUILD DATATABLE ACTIVITY in it with Column structure we want to have in the excel final report and get the output with a variable of type datatable named dt. Keep this as first workflow in the sequence next to START
—then keep each of the workflow in this flowchart Inside a TRY Block of TRY CATCH activity (individual sequence inside try block of try catch activity and not as whole)
So in each of its TRY Block include a ADD DATA ROW ACTIVITY and in the property panel of that activity mention the value in the ArrayRow property like this {“value1”,”value2”,”valuen”,…,”valuen”} based on the number of columns in the datatable we have built in the build datatable activity and in the datatable property mention as dt
Followed by that use a WRITE RANGE ACTIVITY and mention the file path of the excel and datatable dt as input
—similarly in all the catch block include the same Add datarow activity with same data in the property panel but with different value like “failed” when we mention values in the ArrayRow property
Followed by that same write range activity
This will enter the data as per the success or failure of the process into the excel
Hope this would help you
Cheers @ivopath
Hello, thanks a lot for your help.
its a little be confused but i will try follow your’s tips.
When i finishing follow your tips i send you a print for tell me whats wrong.
Cheers @Palaniyappan.
I dont understood this step sorry, im a beginner.
maybe i need to create variable object “value1”?
i already create another flowchart put in the first step that process will run, and inside have a Build datatable with variable type datable named dt and its connected to a excel scope with insert column inside.
Fine
kindly delete that variable value and explicitly mention as {“Successful”} if its inside the TRY block along the ARRAYROW property of add data row activity or as {“Failed”} if its inside the CATCH block along the ARRAYROW property of add data row activity
Cheers @ivopath
you were almost done buddy
just small changes
remove this variable Successful
and directly mention the value in ARRAY ROW property and not as a variable
like this
{“Successful”}
similarly in catch block mention as {“Failed”}
Cheers @ivopath
so what i need to do? im sorry for all that weird questions.
But im pretty happy for made this, because i did it! i have a smile in my face
cheers @Palaniyappan
yes here.
@Palaniyappan i already fix this but he just wrote in excel sucessfull 1 time and failed 1 time…
i want each sequence that he execute tell me if everything fine → “Sucessful” or "Failed if occured a error… and write in the first column the sequence name that he execute followed the second column with the status “Sucessful” or “Failed”, this for all the process…
Hello,
I did not read all the conversation with Palaniyappan but personally here is what I do for manage log as you have asked:
- Encapsulate your Flowchart with a TRY CATCH block.
- Create a dataset to stack messages (Two columns of type string) (Scoped on the TRY CATCH)
- Create new variable called CurrentActivity (as String) (Scoped on the TRY CATCH)
- At the beginning of each sequence, define currentActivity with the sequence name (eg CurrentActivity = “OpenApplication”)
- At the end of each sequence add a line to the DataSet: {CurrentActivity, “Success”}
- In the CATCH section: Add a line to the dataset with “FAIL” : {CurrentActivity, " FAIL: " & exception.Message}
- In the FINALLY section: put a WriteRange of the dataset into your excel file
So your dataset with all the logs will be flushed at the end of the TRY CATCH block.
Pay attention to “build” your dataset before your first sequence.
Don’t be afraid to customize this system to fit it more to your needs.
Regards
thanks a lot for your sugestion, i was killing my mind to try find a way to do this thing
Hope your suggestion works.
i will try it.
Thanks one more time @Boaepa
cheers @Boaepa
You’r welcome @ivopath
I wrote the post directly but it should work.
As I said, don’t hesitate to update it, by adding a column to the dataset for more informations for exemple.
For more details, The “CATCH” section start when en error occurs in the “TRY” section. The “exception” variable is available in the CATCH part and expose informations about the error.
The “FINALLY” section is always “played” at the end, whatever it occurs in the “TRY” or “CATCH” section
UIPath documentation about TryCatch.