Test case / Scenario:
4.SBI Savings account transaction
Pre-requisities:
Login to the net banking and send money successfully
Steps Description:
First launch the url and click on "Net Banking" button. Now click on "LOGIN" button add_text PERSONAL, Now click on "CONTINUE TO LOGIN" button. You will see a username field there now enter username, enter password and click "Login" button. Now enter one time password or OTP received to your mobile, click "submit" button. Now click on "Payments / Transfers" button, and click on "Quick Transfer (Without Adding Beneficiary)" option. Enter Beneficiary Name, enter Beneficiary Account Number, Re-enter Beneficiary Account Number, select "Within SBI" option, now enter the amount and also choose rent "Rent" option in purpose.Finally accept the terms & conditions by clicking on checkbox.
Test case / Scenario:
5.SBI Savings account transaction
Pre-requisities:
Login to the net banking and send money successfully
Steps Description:
First launch the url and click on "Net Banking" button. Now click on "LOGIN" button add_text PERSONAL, Now click on "CONTINUE TO LOGIN" button. You will see a username field there now enter username, enter password and click "Login" button. Now enter one time password or OTP received to your mobile, click "submit" button. Now click on "Payments / Transfers" button, and click on "Quick Transfer (Without Adding Beneficiary)" option. Enter Beneficiary Name, enter Beneficiary Account Number, Re-enter Beneficiary Account Number, select "Within SBI" option, now enter the amount and also choose rent "Rent" option in purpose.Finally accept the terms and conditions by clicking on checkbox.
字符串
现在如何转换“测试用例/场景:”,“先决条件”,“步骤描述”,作为数据框列和“步骤描述”列数据应拆分成行,如果它们有“逗号”,“句号”,“和”。如何做我尝试并与此代码:
import pandas as pd
import re
def split_steps_description(data):
# Find the index of the "Steps Description" heading
steps_index = data.index("Steps Description:") + 1
# Get the content under the "Steps Description" heading
steps_description = data[steps_index].strip()
# Split the content based on commas, "and," or full stops
steps = re.split(r',|\sand\s|\.', steps_description)
# Clean up the steps (remove leading/trailing spaces)
steps = [step.strip() for step in steps if step.strip()]
return steps
def text_input(file):
# Read the text data from a file
with open(file, "r") as f:
data = f.read().splitlines()
scenarios = []
current_scenario = None
for line in data:
line = line.strip()
if line.startswith("Test case / Scenario:"):
current_scenario = line.replace("Test case / Scenario:", "").strip()
elif line.startswith("Steps Description:"):
steps = split_steps_description(data)
# Add each split step as a separate row in the DataFrame
for step in steps:
scenarios.append({
'Test case / Scenario:': current_scenario,
'Steps': step
})
# Convert scenarios to DataFrame
df = pd.DataFrame(scenarios)
return df
df = text_input('testing.txt')
print(df)
型
我得到的输出是:
Test case / Scenario: Steps
0 First launch the url
1 click on "Net Banking" button
2 Now click on "LOGIN" button add_text PERSONAL
3 Now click on "CONTINUE TO LOGIN" button
4 You will see a username field there now enter ...
5 enter password
6 click "Login" button
7 Now enter one time password or OTP received to...
8 click "submit" button
9 Now click on "Payments / Transfers" button
10 click on "Quick Transfer (Without Adding Benef...
11 Enter Beneficiary Name
12 enter Beneficiary Account Number
13 Re-enter Beneficiary Account Number
14 select "Within SBI" option
15 now enter the amount
16 also choose rent "Rent" option in purpose
17 Finally accept the terms & conditions by click...
18 First launch the url
19 click on "Net Banking" button
20 Now click on "LOGIN" button add_text PERSONAL
21 Now click on "CONTINUE TO LOGIN" button
22 You will see a username field there now enter ...
23 enter password
24 click "Login" button
25 Now enter one time password or OTP received to...
26 click "submit" button
27 Now click on "Payments / Transfers" button
28 click on "Quick Transfer (Without Adding Benef...
29 Enter Beneficiary Name
30 enter Beneficiary Account Number
31 Re-enter Beneficiary Account Number
32 select "Within SBI" option
33 now enter the amount
34 also choose rent "Rent" option in purpose
35 Finally accept the terms & conditions by click...
型
我期待这样的输出:
Test case / Scenario: Steps
0 4.SBI Savings account transaction First launch the url
1 4.SBI Savings account transaction click on "Net Banking" button
2 4.SBI Savings account transaction Now click on "LOGIN" button add_text PERSONAL
3 4.SBI Savings account transaction Now click on "CONTINUE TO LOGIN" button
型
如何实现最终结果,请帮助我在这方面。谢谢。
1条答案
按热度按时间t5fffqht1#
字符串