Class: Fastlane::Actions::AllureCreateTestcaseAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb

Documentation collapse

Class Method Summary collapse

Class Method Details

.available_optionsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb', line 27

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      env_name: 'ALLURE_TOKEN',
      key: :token,
      description: 'Allure API Token'
    ),
    FastlaneCore::ConfigItem.new(
      key: :url,
      description: 'Testops URL'
    ),
    FastlaneCore::ConfigItem.new(
      key: :project_id,
      description: 'Project identifier in Allure Testops'
    )
  ]
end

.descriptionObject



23
24
25
# File 'lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb', line 23

def self.description
  'Creates testcase on Allure Testops'
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb', line 45

def self.is_supported?(platform)
  true
end

.run(params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/fastlane/plugin/stream_actions/actions/allure_create_testcase.rb', line 4

def self.run(params)
  body = { projectId: params[:project_id], name: 'Automatically created testcase', deleted: true }.to_json

  testcase_id = other_action.allure_api(
    url: params[:url],
    token: params[:token],
    path: 'testcase',
    http_method: 'POST',
    request_body: body
  )['id']

  UI.success("Testcase with id #{testcase_id} created successfully 🎉")
  testcase_id
end