Best Python code snippet using lemoncheesecake
test_carreport.py
Source:test_carreport.py
...8from titan import SeleniumDriver9detail_url = 'https://m.taoche.com/buycar/b-dealermd233736134t.html'10# 详æ
页ç¹å»ãæ£æµæ¥åãæ£æ¥11class Report(Base):12 def test_report_title(self):13 """æµè¯æ£æµæ¥åtitleæ¾ç¤ºçæ¯å¦æ£ç¡®@author:zhangyanli"""14 self.driver.get(detail_url)15 sleep(2)16 self.driver.execute_script("window.scrollTo(0, 1300)")17 report_title = self.driver.find_element(CarDetail_Locator.REPORT_TITLE).text18 tt_check.assertEqual("æ£æµæ¥å", report_title, "æ£æµæ¥åtabçtitleï¼æææ¯æ£æµæ¥åï¼å®é
æ¯%s" % report_title)19 def test_report_type(self):20 """æµè¯æ£æµæ¥ååç±»åæ¾ç¤ºçæ¯å¦æ£ç¡®@author:zhangyanli"""21 self.driver.get(detail_url)22 sleep(2)23 self.driver.execute_script("window.scrollTo(0, 1300)")24 report_type = self.driver.find_element(CarDetail_Locator.REPORT_TYPE).find_elements_by_class_name('display-flex')25 # for i in range(len(report_type)):26 # LOG.info(report_type[i].text)...
test_cli.py
Source:test_cli.py
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3"""Tests for `bitbucket_code_insight_reports` package."""4from argparse import ArgumentError5import pytest6from bitbucket_code_insight_reports import cli7def test_arg_parse():8 """Test the parsing from the CLI."""9 args = [10 "--user",11 "test_user",12 "--password",13 "test_password",14 "--report_key",15 "test_report_key",16 "--report_title",17 "test_report_title",18 "--report_desc",19 "test_report_desc",20 "--base_url",21 "test_url",22 "--project_key",23 "test_project_key",24 "--repo_slug",25 "test_repo_slug",26 "--commit",27 "test_commit",28 "--report_type",29 "custom",30 "--status",31 "PASS",32 "--annotations",33 "test_annotations",34 "--file",35 "test_file.txt",36 "--file_list",37 "test_file_1",38 "test_file_2",39 "--dict",40 "/some/path/to/dictionary",41 "--silent",42 ]43 parser = cli.parse_args(args)44 assert parser.user == "test_user"45 assert parser.password == "test_password"46 assert parser.report_key == "test_report_key"47 assert parser.report_title == "test_report_title"48 assert parser.report_desc == "test_report_desc"49 assert parser.base_url == "test_url"50 assert parser.project_key == "test_project_key"51 assert parser.repo_slug == "test_repo_slug"52 assert parser.commit == "test_commit"53 assert parser.report_type == "custom"54 assert parser.status == "PASS"55 assert parser.annotations == "test_annotations"56 assert parser.file == "test_file.txt"57 assert parser.file_list == ["test_file_1", "test_file_2"]58 assert parser.dict == ["/some/path/to/dictionary"]...
discord_bot.py
Source:discord_bot.py
1import os,sys,time,threading,json2import shlex3import subprocess4import re5import discord6import asyncio7from discord.ext import commands8client = discord.Client()9channel_id = '555317913788219395'10test_report_msg = '@everyone'11test_branch = sys.argv[1]12test_commit_id = sys.argv[2]13test_report_title = sys.argv[3]14test_result = sys.argv[4].split(" ")15@client.event16async def on_ready():17 channel_list = client.get_all_channels()18 for c in channel_list:19 if c.name == "test-report":20 target_channel = c21 break22 if target_channel:23 embed = discord.Embed(title=test_report_title, type="rich", color=0x00FF00, url="http://192.168.50.206:8080/job/submit_build_for_{}/HTML_20Report/".format(test_branch))24 embed.add_field(name="Branch", value=test_branch, inline=True)25 embed.add_field(name="Commit ID", value=test_commit_id, inline=True)26 embed.add_field(name="Total", value=test_result[2], inline=True)27 embed.add_field(name="Fail", value=test_result[1], inline=True)28 embed.add_field(name="Log", value="http://192.168.50.206:8080/view/daily_build/job/daily_auto_test_for_{}/ws/".format(test_branch), inline=True)29 try:30 await target_channel.send(test_report_msg, embed=embed)31 except Exception as err:32 print(err)33 finally:34 await client.logout()35if __name__ == "__main__":...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!