The way you should design will depend on what you need to test.
For eg. in your example if TEST A failed (Opening application) there are no way of running TEST -B
how could you run other tests if application failed to open?..will it be pass second time if you do same?
But in second case if you pass TEST A and failed TEST B (Add user) you can still run TEST C with some existing user.
I would rather design TEST C independent of TEST B (newly add user not used in TEST C)
So with the TEST D
My advice is make it simple. Design each test as much as independent.
So even TEST B fails your TEST C will run.
Also design a set of smoke tests (link) which runs b'for actual test run
In your eg TEST A and TEST E can be part of smoke tests.
this is a usual dilemma faced by testers who start automate testing.
The way you should design will depend on what you need to test.
For eg. in your example if TEST A failed (Opening application) there are no way of running TEST -B
how could you run other tests if application failed to open?..will it be pass second time if you do same?
But in second case if you pass TEST A and failed TEST B (Add user) you can still run TEST C with some existing user.
I would rather design TEST C independent of TEST B (newly add user not used in TEST C)
So with the TEST D
My advice is make it simple. Design each test as much as independent.
So even TEST B fails your TEST C will run.
Also design a set of smoke tests (link) which runs b'for actual test run
In your eg TEST A and TEST E can be part of smoke tests.
I see 2 solutions:
1. Add this logic into script. And run your tests from script instead of test items.
2. Use project or project suite variables as flags. Next test will just stop if flag was set. In this case logic should be added into existing tests. You can set flags inside OnLogError event handler.
I see 2 solutions:
1. Add this logic into script. And run your tests from script instead of test items.
2. Use project or project suite variables as flags. Next test will just stop if flag was set. In this case logic should be added into existing tests. You can set flags inside OnLogError event handler.
I was thinking about add some logic into all my test scripts but i wanted avoid it.
I think i will use it too. Just made test and it works exacly as i wants before every test i will check if app is on main window.
NisHera
I am creating tests independent as much as i can but in start/close application i wanted to avoid restarting app after every test.For example i have print document test and if i would want to make this on doc i created in previous step it would be rlly hard to handle all cases that can happen :) (if there is actual date printed document for example).
So after reading all ur advices i decided to try use Test Enigine Events - OnStartTest.
Like:
abstract code:
import os\nimport OpenAppTest\ndef GeneralEvents_OnStartTest(Sender):\nIf (mainwindow=true):\npass\nelse:\nfilepath=\"...\\\\checkprocess.bat\"\nfh = os.popen(filepath \"application.exe\")\noutput=fh.read()\nif \"SUCCESS\" in output:\nLog.Message(output)\nLog.Message(\"Killed process application.exe\")\nelse:\nLog.Warning(output)\nLog.Error(\"Didn't found process application.exe\")\nfh.close()\nOpenAppTest.main()
Thanks for all advices.
:)
I was thinking about add some logic into all my test scripts but i wanted avoid it.
I think i will use it too. Just made test and it works exacly as i wants before every test i will check if app is on main window.
I am creating tests independent as much as i can but in start/close application i wanted to avoid restarting app after every test.For example i have print document test and if i would want to make this on doc i created in previous step it would be rlly hard to handle all cases that can happen :) (if there is actual date printed document for example).
So after reading all ur advices i decided to try use Test Enigine Events - OnStartTest.
Like:
abstract code:
import os\nimport OpenAppTest\ndef GeneralEvents_OnStartTest(Sender):\nIf (mainwindow=true):\npass\nelse:\nfilepath=\"...\\\\checkprocess.bat\"\nfh = os.popen(filepath \"application.exe\")\noutput=fh.read()\nif \"SUCCESS\" in output:\nLog.Message(output)\nLog.Message(\"Killed process application.exe\")\nelse:\nLog.Warning(output)\nLog.Error(\"Didn't found process application.exe\")\nfh.close()\nOpenAppTest.main()
Thanks for all advices.
:)
Well, because i dont want to make exception for test A and test E i wont run there test separated as i do now.
BeforeTest Even will open app if its needed.
","body@stripHtml({\"removeProcessingText\":false,\"removeSpoilerMarkup\":false,\"removeTocMarkup\":false,\"truncateLength\":200})@stringLength":"158","kudosSumWeight":0,"repliesCount":0,"postTime":"2016-10-14T02:56:41.014-07:00","lastPublishTime":"2016-10-14T02:56:41.014-07:00","metrics":{"__typename":"MessageMetrics","views":2853},"visibilityScope":"PUBLIC","placeholder":false,"originalMessageForPlaceholder":null,"isEscalated":null,"solution":false,"entityType":"FORUM_REPLY","eventPath":"category:TestComplete_forum/community:nwkab66374board:testcomplete-questions/message:129011/message:129096","replies":{"__typename":"MessageConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"readOnly":false,"editFrozen":false,"body@stringLength":"168","rawBody":"Well, because i dont want to make exception for test A and test E i wont run there test separated as i do now.
BeforeTest Even will open app if its needed.
","images":{"__typename":"AssociatedImageConnection","edges":[],"totalCount":0,"pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null}},"attachments":{"__typename":"AttachmentConnection","pageInfo":{"__typename":"PageInfo","hasNextPage":false,"endCursor":null,"hasPreviousPage":false,"startCursor":null},"edges":[]},"timeToRead":1,"currentRevision":{"__ref":"Revision:revision:129096_1"},"latestVersion":null,"messagePolicies":{"__typename":"MessagePolicies","canModerateSpamMessage":{"__typename":"PolicyResult","failureReason":{"__typename":"FailureReason","message":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","key":"error.lithium.policies.feature.moderation_spam.action.moderate_entity.allowed.accessDenied","args":[]}}},"customFields":[]},"QueryVariables:MessageSolutions":{"__typename":"QueryVariables","id":"MessageSolutions","value":{"first":10,"constraints":{"topicId":{"eq":"message:129011"},"solution":{"eq":true}},"sorts":{"postTime":{"direction":"ASC"}},"useAvatar":true,"useAuthorLogin":true,"useAuthorRank":false,"useBody":true,"useKudosCount":false,"useTimeToRead":false,"useMedia":true,"useRepliesCount":false,"useSearchSnippet":false,"useAcceptedSolutionButton":true,"useSolvedBadge":false,"useAttachments":true,"useTags":false,"useUserHoverCard":false,"useNodeHoverCard":false,"usePreviewSubjectModal":false,"useMessageStatus":false}},"CachedAsset:text:en_US-components/messages/EscalatedMessageBanner-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/EscalatedMessageBanner-1741125846000","value":{"escalationMessage":"Escalated to Salesforce by {username} on {date}","viewDetails":"View Details","modalTitle":"Case Details","escalatedBy":"Escalated by: ","escalatedOn":"Escalated on: ","caseNumber":"Case Number: ","status":"Status: ","lastUpdateDate":"Last Update: ","automaticEscalation":"automatic escalation","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-components/users/UserLink-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/users/UserLink-1741125846000","value":{"authorName":"View Profile: {author}","anonymous":"Anonymous"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/users/UserRank-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserRank-1741125846000","value":{"rankName":"{rankName}","userRank":"Author rank {rankName}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageTime-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageTime-1741125846000","value":{"postTime":"Published: {time}","lastPublishTime":"Last Update: {time}","conversation.lastPostingActivityTime":"Last posting activity time: {time}","conversation.lastPostTime":"Last post time: {time}","moderationData.rejectTime":"Rejected time: {time}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolvedBadge-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolvedBadge-1741125846000","value":{"solved":"Solved"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSubject-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSubject-1741125846000","value":{"noSubject":"(no subject)"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageBody-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageBody-1741125846000","value":{"showMessageBody":"Show More","mentionsErrorTitle":"{mentionsType, select, board {Board} user {User} message {Message} other {}} No Longer Available","mentionsErrorMessage":"The {mentionsType} you are trying to view has been removed from the community.","videoProcessing":"Video is being processed. Please try again in a few minutes.","bannerTitle":"Video provider requires cookies to play the video. Accept to continue or {url} it directly on the provider's site.","buttonTitle":"Accept","urlText":"watch"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageCustomFields-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageCustomFields-1741125846000","value":{"CustomField.default.label":"Value of {name}"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageReplyButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageReplyButton-1741125846000","value":{"repliesCount":"{count}","title":"Reply","title@board:BLOG@message:root":"Comment","title@board:TKB@message:root":"Comment","title@board:IDEA@message:root":"Comment","title@board:OCCASION@message:root":"Comment"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageSolutionList-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageSolutionList-1741125846000","value":{"emptyDescription":"No has been message solutions yet"},"localOverride":false},"CachedAsset:text:en_US-components/messages/AcceptedSolutionButton-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/AcceptedSolutionButton-1741125846000","value":{"accept":"Mark as Solution","accepted":"Marked as Solution","errorHeader":"Error!","errorAdd":"There was an error marking as solution.","errorRemove":"There was an error unmarking as solution.","solved":"Solved","topicAlreadySolvedErrorTitle":"Solution Already Exists","topicAlreadySolvedErrorDesc":"Refresh the browser to view the existing solution"},"localOverride":false},"CachedAsset:text:en_US-components/messages/MessageView/MessageViewInline-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-components/messages/MessageView/MessageViewInline-1741125846000","value":{"bylineAuthor":"{bylineAuthor}","bylineBoard":"{bylineBoard}","anonymous":"Anonymous","place":"Place {bylineBoard}","gotoParent":"Go to parent {name}"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/common/Pager/PagerLoadMore-1741125846000","value":{"loadMore":"Show More"},"localOverride":false},"Revision:revision:129025_1":{"__typename":"Revision","id":"revision:129025_1","lastEditTime":"2016-10-13T07:21:34.661-07:00"},"Revision:revision:129096_1":{"__typename":"Revision","id":"revision:129096_1","lastEditTime":"2016-10-14T02:56:41.014-07:00"},"Revision:revision:129091_4":{"__typename":"Revision","id":"revision:129091_4","lastEditTime":"2016-10-14T02:34:37.740-07:00"},"Revision:revision:129065_2":{"__typename":"Revision","id":"revision:129065_2","lastEditTime":"2016-10-13T15:55:35.822-07:00"},"Revision:revision:129041_1":{"__typename":"Revision","id":"revision:129041_1","lastEditTime":"2016-10-13T09:33:42.154-07:00"},"CachedAsset:text:en_US-shared/client/components/users/UserAvatar-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/users/UserAvatar-1741125846000","value":{"altText":"{login}'s avatar","altTextGeneric":"User's avatar"},"localOverride":false},"CachedAsset:text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000":{"__typename":"CachedAsset","id":"text:en_US-shared/client/components/ranks/UserRankLabel-1741125846000","value":{"altTitle":"Icon for {rankName} rank"},"localOverride":false}}}},"page":"/forums/ForumMessagePage/ForumMessagePage","query":{"boardId":"testcomplete-questions","messageSubject":"how-to-auto-run-some-script-if-some-test-in-our-test-plan-fail-","messageId":"129011"},"buildId":"q_bLpq2mflH0BeZigxpj6","runtimeConfig":{"buildInformationVisible":false,"logLevelApp":"info","logLevelMetrics":"info","openTelemetryClientEnabled":false,"openTelemetryConfigName":"smartbear","openTelemetryServiceVersion":"25.2.0","openTelemetryUniverse":"prod","openTelemetryCollector":"http://localhost:4318","openTelemetryRouteChangeAllowedTime":"5000","apolloDevToolsEnabled":false,"inboxMuteWipFeatureEnabled":false},"isFallback":false,"isExperimentalCompile":false,"dynamicIds":["./components/seo/QAPageSchema/QAPageSchema.tsx","./components/community/Navbar/NavbarWidget.tsx","./components/community/Breadcrumb/BreadcrumbWidget.tsx","./components/messages/TopicWithThreadedReplyListWidget/TopicWithThreadedReplyListWidget.tsx","./components/messages/MessageListForNodeByRecentActivityWidget/MessageListForNodeByRecentActivityWidget.tsx","./components/messages/RelatedContentWidget/RelatedContentWidget.tsx","./components/customComponent/CustomComponent/CustomComponent.tsx","./components/messages/MessageView/MessageViewStandard/MessageViewStandard.tsx","./components/messages/ThreadedReplyList/ThreadedReplyList.tsx","../shared/client/components/common/List/UnstyledList/UnstyledList.tsx","./components/messages/MessageView/MessageView.tsx","./components/messages/MessageView/MessageViewInline/MessageViewInline.tsx","../shared/client/components/common/Pager/PagerLoadMore/PagerLoadMore.tsx","./components/customComponent/CustomComponentContent/TemplateContent.tsx"],"appGip":true,"scriptLoader":[]}