SendStatistics.rst.txt 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. **************
  2. SendStatistics
  3. **************
  4. While running tests on ``baangt`` we might need to share the report to multiple persons in a team. To do this one might
  5. have to be present in front of screen and wait for completion of the test. But to overcome this issue we have added a
  6. functionality in ``baangt`` to send the reports in various platform automatically, thus you don't need to waste your
  7. time in front of screen just for waiting of completion, our program will take care of that.
  8. Their are 4 different services where we can send test reports. They are:
  9. 1. Email
  10. 2. Ms Teams
  11. 3. Slack
  12. 4. Telegram
  13. Lets first discuss things we need to use this services in our program one by one.
  14. **Note :- If you don't need to use any service from the following you just skip that part**
  15. Email
  16. =====
  17. We don't need anything(except recipients email ids).
  18. Ms Teams
  19. ========
  20. We need webhook url of Ms Teams channel where we need to send reports. If you need any help in getting webhook url you can
  21. refer to this link:- https://docs.microsoft.com/en-us/microsoftteams/platform/webhooks-and-connectors/how-to/connectors-using#setting-up-a-custom-incoming-webhook
  22. Slack
  23. =====
  24. We need incoming webhook url for the app which has permission to post message in your group. For further assistance you
  25. can refer to "`Set up Incoming Webhooks`" section of https://slack.com/intl/en-in/help/articles/115005265063-Incoming-webhooks-for-Slack
  26. Telegram
  27. ========
  28. To send message in telegram channel we need channel username and a bot's HTTP API token who has administrator privilage
  29. in your channel.
  30. First, to get username of the channel you can simply go to info section of your channel where you will find invite link
  31. which will look like `t.me/your_channel_username` here your_channel_username is what we need.
  32. Now to get HTTP API token of bot, first we need to create a bot. To create a new bot you need to search for `@botfather` in
  33. telegram. If you are first time user of BotFather then you will see an introduction and a start button in the bottom. If
  34. you don't see start button but seeing a text area in bottom you can just type ``/start`` then to create a new bot you
  35. have to select or type ``/newbot`` after that it will ask a name for your bot. You can name it anything but I for best
  36. practice we will use `ChannelName bot` after that it will ask a username for your bot which must be unique and the
  37. username must end with `bot` word so we can use `ChannelName_bot` after sending this you should get a congratulations
  38. message which means your bot is created. In this congratulation message you will get `HTTP API access token` we will
  39. need this further in our program.
  40. Our next step is to add the bot in our channel as administrator. Please visit this link for further assistance :-
  41. https://stackoverflow.com/a/33497769/8784795
  42. Configuring Baangt
  43. ==================
  44. Once we have all the necessary things we just need to add them in ``main.ini`` which must be inside ``ini`` folder.
  45. If you have used windows installer to setup ``baangt`` then it must be inside `C:/Users/{username}/baangt` directory,
  46. else it will be in the root directory of baangt. Once you find the ``ini`` folder their must be a main.ini file inside
  47. it. If it is not their you can make one. Just create a new file name `main` and extension `ini` which will look like
  48. ``main.ini``. Then you can edit it via any text editor. It should look like.
  49. | [Default]
  50. | sendmailto = <email>
  51. | notificationwithattachment = <True or False>
  52. | mswebhook = <MsTeam channel webhook url>
  53. | slackwebhook = <Slack App webhook url>
  54. | telegrambot = <telegram bot access token>
  55. | telegramchannel = <telegram channel name>
  56. Configurations of mail:- ``sendmailto`` and ``notificationwithattachment`` are the settings for email. ``sendmailto``
  57. can contain single recipients or multiple recipients which would look like.
  58. **sendmailto = example1@xyz.com, example2@xyz.com, example3@xyz.com** inshort they should be comma seperated.
  59. **notificationwithattachment** should be True if you want to send xlsx result file as attachment in the mail else it
  60. should be False.
  61. Configuration of MsTeam:- ``mswebhook`` takes single or multiple(comma seperated as above) webhook url and will send
  62. report in them.
  63. Configuration of Slack:- ``slackwebhook`` takes single or multiple(comma seperated as above) webhook url and will send
  64. report in them.
  65. Configurations of Telegram:- ``telegrambot`` and ``telegramchannel`` are the settings for telegram. ``telegrambot`` will
  66. take single value containing API token of bot. ``telegramchannel`` may contain single or multiple(comma seperated as
  67. above) username of channels. Make sure that all the channels have this bot as administrator.
  68. **Note:- If you don't need to use any of the service out of these four, you can just leave their settings empty**