-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bce7b92
commit 08bce63
Showing
5 changed files
with
71 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
- [x] Create dynamic test run and update test results in it | ||
- [x] Update multi-testrail cases from a single automation scenario | ||
- [x] Static status comments on all the scenarios | ||
- [x] Support for RSpec `shared examples` | ||
|
||
## Installation | ||
|
||
|
@@ -54,7 +55,7 @@ Prefix TestRail Case ID on start of your rspec scenario; say, `C845` | |
``` | ||
|
||
#### Update multi-cases at a time | ||
Prefix multiple TestRail Case IDs on start of your rspec scenario; say, `C845 C845 your scenario description` | ||
Prefix multiple testrail case id(s) on start of your rspec scenario; say, `C845 C845 your scenario description` | ||
|
||
```ruby | ||
describe 'Verify Google Home Page' do | ||
|
@@ -75,7 +76,7 @@ Prefix multiple TestRail Case IDs on start of your rspec scenario; say, `C845 C8 | |
``` | ||
|
||
#### Use context blocks to update cases | ||
Prefix context blocks with TestRail Case IDs to make use of Shared Examples | ||
`Context blocks` with testrail case id(s) to make use of `Shared Examples` | ||
|
||
```ruby | ||
shared_examples 'log in' do | ||
|
@@ -86,62 +87,55 @@ shared_examples 'log out' do | |
it 'logs out' | ||
end | ||
|
||
describe 'basic user stuff' do | ||
context 'A regular user can' do | ||
describe 'User login' do | ||
context 'Regular user' do | ||
let(:user) { create(:regular_user) } | ||
context 'C1232' do | ||
context 'C845 single case' do | ||
include_examples 'log in' | ||
end | ||
|
||
context 'C1233' do | ||
context 'C847' do | ||
include_examples 'log out' | ||
end | ||
end | ||
|
||
context 'An admin user can' do | ||
context 'Admin user' do | ||
let(:user) { create(:admin_user) } | ||
context 'C1234' do | ||
context 'C850 C853 multi cases' do | ||
include_examples 'log in' | ||
end | ||
|
||
context 'C1235' do | ||
context 'nothing to update in test-rail' do | ||
include_examples 'log out' | ||
end | ||
end | ||
end | ||
``` | ||
|
||
## TestRail Configuration | ||
|
||
Provide TestRail details by creating a config file, `testrail_config.yml` in the project parent folder | ||
|
||
> With existing `Test Run` | ||
- Add testrail details (`url`, `user`, `password`, and `run_id`) | ||
- `run_id` is the dynamically generated id from your testrail account (say, `run_id: 111`) | ||
|
||
```yaml | ||
testrail: | ||
url: https://your_url.testrail.io/ | ||
user: [email protected] | ||
password: ****** | ||
run_id: 111 | ||
``` | ||
> Create dynamic `Test Run` and update results | ||
|
||
- Add testrail details following `project_id` and `suite_id` | ||
- `project_id` and `suite_id` are the dynamically generated id from your testrail account | ||
- `run_id` is optional here; you may (or) may not have it in this case | ||
|
||
```yaml | ||
testrail: | ||
url: https://your_url.testrail.io/ | ||
user: [email protected] | ||
password: ****** | ||
project_id: 10 | ||
suite_id: 110 | ||
``` | ||
#### Configuration | ||
|
||
1. Create a config file, `testrail_config.yml` in the project's parent folder | ||
2. Enter the testrail details based on demand | ||
3. To execute tests against the existing `Test Run`, | ||
```yaml | ||
testrail: | ||
url: https://your_url.testrail.io/ | ||
user: [email protected] | ||
password: ****** | ||
run_id: 111 | ||
``` | ||
Here, `run_id` is the dynamically generated id from your testrail account (say, `run_id: 111`) | ||
|
||
4. To create a dynamic `Test Run` and to update results, | ||
```yaml | ||
testrail: | ||
url: https://your_url.testrail.io/ | ||
user: [email protected] | ||
password: ****** | ||
project_id: 10 | ||
suite_id: 110 | ||
``` | ||
Here, `project_id` and `suite_id` are the dynamically generated id from your testrail account; `run_id` is optional in this case. | ||
|
||
#### Hooks | ||
|
||
|
@@ -152,7 +146,7 @@ config.after(:each) do |scenario| | |
end | ||
``` | ||
**Is there a demo available for this gem?** | ||
**Is there any demo available for this gem?** | ||
Yes, you can use this `capybara` demo as an example, https://github.com/prashanth-sams/testrail-rspec | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
task :test do |_task| | ||
system "rspec spec/features/*_spec.rb" | ||
system "rspec spec/features/google_search_spec.rb" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
require 'spec_helper' | ||
|
||
feature 'Verify Google Home Page' do | ||
before do | ||
@app.google_home.load | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
shared_examples 'pass' do | ||
it 'pass' do | ||
expect(true).to be true | ||
end | ||
end | ||
|
||
shared_examples 'fail' do | ||
it 'fail' do | ||
expect(false).to be true | ||
end | ||
end | ||
|
||
describe 'Generic scenarios' do | ||
context 'A regular user can' do | ||
context 'C845' do | ||
include_examples 'pass' | ||
end | ||
|
||
context 'C847' do | ||
include_examples 'fail' | ||
end | ||
end | ||
|
||
context 'Complex scenarios' do | ||
context 'C850 C853 multi cases' do | ||
include_examples 'pass' | ||
end | ||
|
||
context 'Not going to update in test-rail' do | ||
include_examples 'fail' | ||
end | ||
end | ||
end |