在基于JSF 1.1的Web应用程序中缩小js和css的最佳方法(Best method to minify js and css in a JSF 1.1 based web app)
在JSF应用程序中缩小js和css可以遵循哪些最佳实践?
What are the best practices that can be followed to minify js and css in a JSF application?
原文:https://stackoverflow.com/questions/6551371
最满意答案
你必须使用参数化 。
只是在脚本中使用变量而不是硬编码值时。 这使您有机会在每次新运行时为该变量分配新值。
以下是有关参数化脚本的官方文档的示例:
Vars * Define usr="default-at-example.com" pwd Input username EnterText ${usr} Input password EnterText ${pwd} Button LOGIN Tap
在此清单中,您可以看到已使用默认值(“default-at-example.com”)定义了“usr”变量。
因此,您可以通过多种不同方式调用参数化脚本。
在这种情况下,“pwd”变量将具有“我喜欢奶酪”的价值:
Script login.mt Run joe-at-doe.com "i like cheese"
以下示例显示了脚本调用,但未指定变量的任何参数:
Script login.mt Run * password1
它会产生以下效果:变量“usr”将具有其默认值,而“pwd”变量将具有“password1”值
不要忘记这些变量的范围仅限于脚本。 这意味着它们是可见的,并且只能在已经定义它们的脚本中使用。
此外,您可以使用外部数据源为数据提供测试。 它被称为数据驱动测试 。 以下是使用* .csv文件(逗号分隔)作为此类数据源的脚本示例:
//data.csv joe-at-doe.com, "i like cheese" alpha-at-beta.net, password1 charlie-at-dog.org, abc123
要使用此类* .csv文件,只需运行以下命令:
Script login.mt RunWith data.csv
You have to use parameterization.
It's simply when you use variables in your script instead of hardcoded values. That gives you an opportunity to assign new values to that variables with each new run.
Here is an example from official documentation regarding parametrizing the script:
Vars * Define usr="default-at-example.com" pwd Input username EnterText ${usr} Input password EnterText ${pwd} Button LOGIN Tap
In this listing you can see that you've defined "usr" variable with default value ("default-at-example.com").
As a result, you can invoke you parametrized script in a number of different ways.
In this case "pwd" variable will have "i like cheese" value:
Script login.mt Run joe-at-doe.com "i like cheese"
Following example shows script invocation without specifying any arguments for variables:
Script login.mt Run * password1
It'll have following effect: variable "usr" will have its' default value and "pwd" variable will have "password1" value
Don't forget that those variables' scope is limited only to the script. It means that they're visible and can be used only inside of script where they have been defined.
Moreover you can use external data sources in order to feed your tests with data. It's called data driven testing. Here is an example of script which uses *.csv file (coma separated) as such data source:
//data.csv joe-at-doe.com, "i like cheese" alpha-at-beta.net, password1 charlie-at-dog.org, abc123
In order to use such *.csv file just run following command:
Script login.mt RunWith data.csv
相关问答
更多-
没有尝试过这个,但是由于MonkeyTalk代理使用HTTP与脚本运行工具(例如,MonkeyTalkIDE,或junit,或MonkeyTalk ant任务)进行通信,因此它似乎不太可行。 当通过USB运行时,MonkeyTalk使用adb端口转发。 但是,从代理的角度来看,它仍然通过TCP / IP端口响应HTTP请求。 Haven't tried this, but it seems very unlikely that it would work since the MonkeyTalk agent ...
-
使用MonkeyTalk与EAGLView生成的javascript(Using the javascript generated by MonkeyTalk with EAGLView)[2023-05-25]
这是一个问题,因为javascript没有任何非标准对象的功能。 解决方案是将类(在这种情况下为EAGLView)更改为它继承的任何内容(在本例中可能是View)。 因此,要使此示例正常工作,您可以使用: this.app.view("MonkeyID").drag(); 但是,这将要求MonkeyID是唯一的 - 您可以在此处找到有关获取唯一MonkeyID的更多信息 This is a problem because the javascript does not have functions for ... -
要同时运行,您必须使用多个进程或多个线程(或多个计算机)。 & with shell使用多进程方法。 在Tcl中,您也可以使用& ,但只能使用启动子进程的exec命令(它也必须是最后一个参数IIRC)。 假设您已将代码放入四个Tcl脚本a.tcl , b.tcl , c.tcl和d.tcl ,那么您将与此并行启动它们: exec [info nameofexecutable] a.tcl & exec [info nameofexecutable] b.tcl & exec [info nameofexec ...
-
即使MonkeyTalk开发人员从未直接在他们的论坛上回答我,他们最新发布的“2014年8月25日 - MonkeyTalk社区v2.0.8”等内容包含“现在支持的ActionBar溢出项目”。 所以看起来他们终于解决了这个问题。 Even though the MonkeyTalk devs never answered me directly on their forum, their newest release "August 25, 2014 - MonkeyTalk Community v2.0 ...
-
使用monkeytalk测试Android应用程序,记录按钮被禁用(Using monkeytalk to test android app, the record button is disabled)[2022-08-01]
这可能是由几个问题引起的: 未配置主机和仿真器之间的端口转发(请参阅详细信息)。 运行以下命令以解决此问题: adb forward tcp:[PORT_NUMBER_IN_USE] tcp:[PORT_NUMBER_IN_USE] 未正确设置MonkeyTalk首选项中Android SDK的路径。 您必须首先安装Android SDK ,然后在MonkeyTalk中指定它的路径。 您还应该选中“包括Android测试?”复选框。 本教程在MonkeyTalk中设置Android代理也很有用。 This ... -
你必须使用参数化 。 只是在脚本中使用变量而不是硬编码值时。 这使您有机会在每次新运行时为该变量分配新值。 以下是有关参数化脚本的官方文档的示例: Vars * Define usr="default-at-example.com" pwd Input username EnterText ${usr} Input password EnterText ${pwd} Button LOGIN Tap 在此清单中,您可以看到已使用默认值(“default-at-example.com”)定义了“usr ...
-
Appium是一个跨平台的工具,适用于混合和本机应用程序,而MonkeyTalk不支持混合应用程序。 Appium is a cross-platform tool and works for hybrid as well as native apps where as MonkeyTalk doesn't support hybrid apps.
-
当我尝试从与Monkey Talk代理集成的应用程序中调用另一个应用程序(没有Monkey Talk代理)时,我收到了同样的错误。 所以我在猴子谈话源代码中添加了一个空指针检查并修复了问题。 ActivityManager.cjava - checkIsClipped()函数: // Adding a null pointer check for the case where the application invokes another application that does not have ...
-
是的,可以使用MonkeyTalk测试Web应用程序。 试试最新的MonkeyTalk Professional 2.0.1版本以获得更多功能。 Yes, It is possible to test web application using MonkeyTalk. Try the latest MonkeyTalk Professional 2.0.1 edition for more functionalities.
-
看起来你在python和bash之间混合了,你不需要在bash脚本中导入。 #!/usr/bin/env bash python camera_centroid.py & python testsss.py & wait # wait for jobs to be done 确保向脚本添加执行权限 chmod +x testsss.py camera_centroid.py 最后运行脚本./your_file.sh Looks like you have mixed between python and ...